@kaspernj/api-maker 1.0.442 → 1.0.444
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
|
@@ -54,7 +54,7 @@ export default memo(shapeComponent(class ApiMakerInputsAttachment extends BaseCo
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
getContentType() {
|
|
57
|
-
const {attribute, model} =
|
|
57
|
+
const {attribute, model} = this.p
|
|
58
58
|
const attributeName = `${attribute}ContentType`
|
|
59
59
|
|
|
60
60
|
if (!(attributeName in model)) throw new Error(`No such method on ${model.modelClassData().name}: ${attributeName}`)
|
|
@@ -63,7 +63,7 @@ export default memo(shapeComponent(class ApiMakerInputsAttachment extends BaseCo
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
getPurgeInputId() {
|
|
66
|
-
const {inputProps} =
|
|
66
|
+
const {inputProps} = this.tt
|
|
67
67
|
|
|
68
68
|
return `${inputProps.id}_purge`
|
|
69
69
|
}
|
|
@@ -71,7 +71,7 @@ export default memo(shapeComponent(class ApiMakerInputsAttachment extends BaseCo
|
|
|
71
71
|
getPurgeInputName() {
|
|
72
72
|
if ("purgeName" in this.props) return this.props.purgeName
|
|
73
73
|
|
|
74
|
-
const {inputProps} =
|
|
74
|
+
const {inputProps} = this.tt
|
|
75
75
|
|
|
76
76
|
if (!inputProps.name) return null
|
|
77
77
|
|
|
@@ -82,7 +82,7 @@ export default memo(shapeComponent(class ApiMakerInputsAttachment extends BaseCo
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
getUrl() {
|
|
85
|
-
const {attribute, model} =
|
|
85
|
+
const {attribute, model} = this.p
|
|
86
86
|
const attributeName = `${attribute}Url`
|
|
87
87
|
|
|
88
88
|
if (!(attributeName in model)) throw new Error(`No such method on ${model.modelClassData().name}: ${attributeName}`)
|
package/src/inputs/checkbox.jsx
CHANGED
|
@@ -33,12 +33,19 @@ export default memo(shapeComponent(class ApiMakerInputsCheckbox extends BaseComp
|
|
|
33
33
|
|
|
34
34
|
setup() {
|
|
35
35
|
const {inputProps, restProps: useInputRestProps} = useInput({props: this.props, wrapperOptions: {type: "checkbox"}})
|
|
36
|
+
const {defaultValue, name} = inputProps
|
|
36
37
|
|
|
37
38
|
this.setInstance({
|
|
38
39
|
form: useForm(),
|
|
39
40
|
inputProps,
|
|
40
41
|
useInputRestProps
|
|
41
42
|
})
|
|
43
|
+
|
|
44
|
+
useMemo(() => {
|
|
45
|
+
if (name) {
|
|
46
|
+
this.tt.form?.setValue(name, defaultValue)
|
|
47
|
+
}
|
|
48
|
+
}, [])
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
render () {
|
|
@@ -59,8 +66,6 @@ export default memo(shapeComponent(class ApiMakerInputsCheckbox extends BaseComp
|
|
|
59
66
|
...restProps
|
|
60
67
|
} = useInputRestProps
|
|
61
68
|
|
|
62
|
-
console.log("ApiMakerInputsCheckbox", {inputProps, restProps})
|
|
63
|
-
|
|
64
69
|
return (
|
|
65
70
|
<>
|
|
66
71
|
{autoRefresh && model &&
|
package/src/use-input.mjs
CHANGED
|
@@ -6,7 +6,13 @@ import strftime from "strftime"
|
|
|
6
6
|
import useShape from "set-state-compare/src/use-shape.js"
|
|
7
7
|
import useValidationErrors from "./use-validation-errors.mjs"
|
|
8
8
|
|
|
9
|
-
const useInput = ({props, wrapperOptions}) => {
|
|
9
|
+
const useInput = ({props, wrapperOptions, ...useInputRestProps}) => {
|
|
10
|
+
const useInputRestPropsKeys = Object.keys(useInputRestProps)
|
|
11
|
+
|
|
12
|
+
if (useInputRestPropsKeys.length > 0) {
|
|
13
|
+
throw new Error(`Unknown props given to useInput: ${useInputRestPropsKeys.join(", ")}`)
|
|
14
|
+
}
|
|
15
|
+
|
|
10
16
|
const s = useShape(props)
|
|
11
17
|
|
|
12
18
|
s.useStates({
|
|
@@ -71,8 +77,6 @@ const useInput = ({props, wrapperOptions}) => {
|
|
|
71
77
|
|
|
72
78
|
const inputType = useCallback(() => {
|
|
73
79
|
if ("type" in s.props) {
|
|
74
|
-
console.log("Type in props", s.p.type)
|
|
75
|
-
|
|
76
80
|
return s.props.type
|
|
77
81
|
} else if (s.m.isCheckbox) {
|
|
78
82
|
return "checkbox"
|