@kaspernj/api-maker 1.0.391 → 1.0.392
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
package/src/inputs/input.jsx
CHANGED
|
@@ -40,6 +40,11 @@ const ApiMakerInputsInput = memo(shapeComponent(class ApiMakerInputsInput extend
|
|
|
40
40
|
this.useStates({
|
|
41
41
|
blankInputName: digg(this, "props", "inputProps", "type") == "file"
|
|
42
42
|
})
|
|
43
|
+
useMemo(() => {
|
|
44
|
+
if ("defaultValue" in this.props) {
|
|
45
|
+
this.tt.form?.setValue(this.props.defaultValue)
|
|
46
|
+
}
|
|
47
|
+
}, [])
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
render () {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
|
-
import {FormContext} from "../../form"
|
|
3
2
|
import {memo} from "react"
|
|
4
3
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
5
4
|
|
|
@@ -7,17 +6,12 @@ export default memo(shapeComponent(class EditAttributeContent extends BaseCompon
|
|
|
7
6
|
setup() {
|
|
8
7
|
const {inputs, name} = this.p
|
|
9
8
|
|
|
10
|
-
this.form = useContext(FormContext)
|
|
11
9
|
this.useStates({
|
|
12
10
|
value: () => this.defaultValue()
|
|
13
11
|
})
|
|
14
12
|
|
|
15
13
|
useMemo(() => {
|
|
16
14
|
inputs[name] = this.s.value
|
|
17
|
-
|
|
18
|
-
if (this.form) {
|
|
19
|
-
this.form.setValue(name, this.s.value)
|
|
20
|
-
}
|
|
21
15
|
}, [])
|
|
22
16
|
}
|
|
23
17
|
|
|
@@ -48,10 +42,6 @@ export default memo(shapeComponent(class EditAttributeContent extends BaseCompon
|
|
|
48
42
|
|
|
49
43
|
inputs[name] = newValue
|
|
50
44
|
|
|
51
|
-
if (this.form) {
|
|
52
|
-
this.form.setValue(name, newValue)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
45
|
this.setState({value: newValue})
|
|
56
46
|
}
|
|
57
47
|
}))
|