@colisweb/rescript-toolkit 2.50.0 → 2.50.2
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 +1 -1
- package/src/form/Reform.res +13 -13
- package/src/vendors/BsReactSelect.res +5 -0
package/package.json
CHANGED
package/src/form/Reform.res
CHANGED
|
@@ -131,12 +131,12 @@ module Make = (Config: Config) => {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
module Provider = {
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
134
|
+
let provider = React.Context.provider(formContext)
|
|
135
|
+
|
|
136
|
+
@react.component
|
|
137
|
+
let make = (~value: api, ~children) => {
|
|
138
|
+
React.createElement(provider, {"value": Some(value), "children": children})
|
|
139
|
+
}
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
module Field = {
|
|
@@ -203,7 +203,7 @@ module Make = (Config: Config) => {
|
|
|
203
203
|
None
|
|
204
204
|
},
|
|
205
205
|
)
|
|
206
|
-
| SetFieldsState(fieldsState) => Update({...state, fieldsState
|
|
206
|
+
| SetFieldsState(fieldsState) => Update({...state, fieldsState})
|
|
207
207
|
| ValidateField(field) =>
|
|
208
208
|
SideEffects(
|
|
209
209
|
self => {
|
|
@@ -320,7 +320,7 @@ module Make = (Config: Config) => {
|
|
|
320
320
|
values: initialState,
|
|
321
321
|
formState: Pristine,
|
|
322
322
|
})
|
|
323
|
-
| SetValues(values) => Update({...state, values
|
|
323
|
+
| SetValues(values) => Update({...state, values})
|
|
324
324
|
| SetFieldValue(field, value) =>
|
|
325
325
|
Update({...state, values: Config.set(state.values, field, value)})
|
|
326
326
|
| RaiseSubmitFailed(err) => Update({...state, formState: SubmitFailed(err)})
|
|
@@ -405,14 +405,14 @@ module Make = (Config: Config) => {
|
|
|
405
405
|
let raiseSubmitFailed = error => send(RaiseSubmitFailed(error))
|
|
406
406
|
|
|
407
407
|
let interface: api = {
|
|
408
|
-
state
|
|
408
|
+
state,
|
|
409
409
|
submit: () => send(TrySubmit),
|
|
410
410
|
resetForm: () => send(ResetForm),
|
|
411
411
|
setValues: values => send(SetValues(values)),
|
|
412
412
|
setFieldValue: (field, value, ~shouldValidate=true, ()) =>
|
|
413
413
|
shouldValidate ? send(FieldChangeValue(field, value)) : send(SetFieldValue(field, value)),
|
|
414
|
-
getFieldState
|
|
415
|
-
getFieldError
|
|
414
|
+
getFieldState,
|
|
415
|
+
getFieldError,
|
|
416
416
|
handleChange: (field, value) => send(FieldChangeValue(field, value)),
|
|
417
417
|
arrayPush: (field, value) => send(FieldArrayAdd(field, value)),
|
|
418
418
|
arrayUpdateByIndex: (~field, ~index, value) =>
|
|
@@ -421,8 +421,8 @@ module Make = (Config: Config) => {
|
|
|
421
421
|
arrayRemoveByIndex: (field, index) => send(FieldArrayRemove(field, index)),
|
|
422
422
|
validateField: field => send(ValidateField(field)),
|
|
423
423
|
validateForm: () => send(ValidateForm(false)),
|
|
424
|
-
validateFields
|
|
425
|
-
raiseSubmitFailed
|
|
424
|
+
validateFields,
|
|
425
|
+
raiseSubmitFailed,
|
|
426
426
|
isSubmitting: state.formState == Submitting,
|
|
427
427
|
isErrored: state.formState == Errored,
|
|
428
428
|
isDirty: state.formState == Dirty,
|
|
@@ -13,6 +13,7 @@ type optionMessageCb = {inputValue: string}
|
|
|
13
13
|
module ReactSelect = {
|
|
14
14
|
@module("react-select") @react.component
|
|
15
15
|
external make: (
|
|
16
|
+
~defaultMenuIsOpen: option<bool>=?,
|
|
16
17
|
~name: string,
|
|
17
18
|
~autoFocus: option<bool>=?,
|
|
18
19
|
~isMulti: option<bool>=?,
|
|
@@ -35,6 +36,7 @@ module ReactSelectMultiple = {
|
|
|
35
36
|
@module("react-select") @react.component
|
|
36
37
|
external make: (
|
|
37
38
|
~name: string,
|
|
39
|
+
~defaultMenuIsOpen: option<bool>=?,
|
|
38
40
|
~autoFocus: option<bool>=?,
|
|
39
41
|
~isMulti: option<bool>=?,
|
|
40
42
|
~isDisabled: option<bool>=?,
|
|
@@ -55,6 +57,7 @@ module ReactSelectMultiple = {
|
|
|
55
57
|
~name: string,
|
|
56
58
|
~autoFocus: option<bool>=?,
|
|
57
59
|
~isSearchable: option<bool>=?,
|
|
60
|
+
~defaultMenuIsOpen: option<bool>=?,
|
|
58
61
|
~isDisabled: option<bool>=?,
|
|
59
62
|
~isLoading: option<bool>=?,
|
|
60
63
|
~placeholder: option<string>=?,
|
|
@@ -73,6 +76,7 @@ module ReactSelectMultiple = {
|
|
|
73
76
|
isMulti=true
|
|
74
77
|
?isSearchable
|
|
75
78
|
?placeholder
|
|
79
|
+
?defaultMenuIsOpen
|
|
76
80
|
?className
|
|
77
81
|
?classNamePrefix
|
|
78
82
|
defaultValue
|
|
@@ -178,6 +182,7 @@ module ReactSelectMultipleCreateInput = {
|
|
|
178
182
|
onChange(value->Array.concat([inputValue]))
|
|
179
183
|
e->ReactEvent.Keyboard.preventDefault
|
|
180
184
|
}
|
|
185
|
+
|
|
181
186
|
| _ => ()
|
|
182
187
|
}
|
|
183
188
|
}
|