@kaspernj/api-maker 1.0.393 → 1.0.395
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/form.jsx
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import BaseComponent from "../../base-component"
|
|
2
2
|
import {memo} from "react"
|
|
3
|
+
import PropTypes from "prop-types"
|
|
4
|
+
import propTypesExact from "prop-types-exact"
|
|
3
5
|
import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
6
|
+
import {useForm} from "../../form"
|
|
4
7
|
|
|
5
8
|
export default memo(shapeComponent(class EditAttributeContent extends BaseComponent {
|
|
9
|
+
static propTypes = propTypesExact({
|
|
10
|
+
attribute: PropTypes.object.isRequired,
|
|
11
|
+
id: PropTypes.string.isRequired,
|
|
12
|
+
model: PropTypes.object.isRequired,
|
|
13
|
+
name: PropTypes.string.isRequired
|
|
14
|
+
})
|
|
15
|
+
|
|
6
16
|
setup() {
|
|
17
|
+
this.form = useForm()
|
|
7
18
|
this.useStates({
|
|
8
19
|
value: () => this.defaultValue()
|
|
9
20
|
})
|
|
@@ -33,5 +44,6 @@ export default memo(shapeComponent(class EditAttributeContent extends BaseCompon
|
|
|
33
44
|
|
|
34
45
|
onChangeValue = (newValue) => {
|
|
35
46
|
this.setState({value: newValue})
|
|
47
|
+
this.tt.form.setValue(this.p.name, newValue)
|
|
36
48
|
}
|
|
37
49
|
}))
|
|
@@ -8,6 +8,10 @@ import {useForm} from "../../form"
|
|
|
8
8
|
|
|
9
9
|
export default memo(shapeComponent(class EditAttributeInput extends BaseComponent {
|
|
10
10
|
static propTypes = propTypesExact({
|
|
11
|
+
attributeName: PropTypes.string.isRequired,
|
|
12
|
+
id: PropTypes.string.isRequired,
|
|
13
|
+
label: PropTypes.string.isRequired,
|
|
14
|
+
model: PropTypes.object.isRequired,
|
|
11
15
|
name: PropTypes.string.isRequired
|
|
12
16
|
})
|
|
13
17
|
|
|
@@ -11,7 +11,7 @@ import {shapeComponent} from "set-state-compare/src/shape-component.js"
|
|
|
11
11
|
|
|
12
12
|
export default memo(shapeComponent(class EditAttribute extends BaseComponent {
|
|
13
13
|
static propTypes = propTypesExact({
|
|
14
|
-
attribute: PropTypes.
|
|
14
|
+
attribute: PropTypes.object.isRequired,
|
|
15
15
|
model: PropTypes.object,
|
|
16
16
|
modelClass: PropTypes.func
|
|
17
17
|
})
|