@kaspernj/api-maker 1.0.260 → 1.0.262

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
@@ -16,7 +16,7 @@
16
16
  ]
17
17
  },
18
18
  "name": "@kaspernj/api-maker",
19
- "version": "1.0.260",
19
+ "version": "1.0.262",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -20,16 +20,16 @@ const inputWrapper = (WrapperComponentClass, wrapperOptions = {}) => {
20
20
  this.setForm()
21
21
  }
22
22
 
23
- render() {
24
- const {errors, form} = digs(this.state, "errors", "form")
25
- const type = this.inputType()
26
- const inputProps = {
27
- id: idForComponent(this),
28
- name: nameForComponent(this),
29
- ref: this.inputRef()
30
- }
31
-
32
- if (!inputProps.ref) throw new Error("No input ref?")
23
+ inputProps() {
24
+ const givenInputProps = this.props.inputProps || {}
25
+ const inputProps = Object.assign(
26
+ {
27
+ id: idForComponent(this),
28
+ name: nameForComponent(this),
29
+ ref: this.inputRef()
30
+ },
31
+ givenInputProps
32
+ )
33
33
 
34
34
  if (this.handleAsCheckbox()) {
35
35
  inputProps.defaultChecked = this.inputDefaultChecked()
@@ -37,6 +37,16 @@ const inputWrapper = (WrapperComponentClass, wrapperOptions = {}) => {
37
37
  inputProps.defaultValue = this.inputDefaultValue()
38
38
  }
39
39
 
40
+ return inputProps
41
+ }
42
+
43
+ render() {
44
+ const {inputProps: oldInputProps, ...restProps} = this.props
45
+ const {errors, form} = digs(this.state, "errors", "form")
46
+ const type = this.inputType()
47
+ const inputProps = this.inputProps()
48
+
49
+ if (!inputProps.ref) throw new Error("No input ref?")
40
50
  if (!this.handleAsSelect()) inputProps.type = type
41
51
 
42
52
  const wrapperOpts = {
@@ -53,7 +63,7 @@ const inputWrapper = (WrapperComponentClass, wrapperOptions = {}) => {
53
63
  <WrapperComponentClass
54
64
  inputProps={inputProps}
55
65
  wrapperOpts={wrapperOpts}
56
- {...this.props}
66
+ {...restProps}
57
67
  />
58
68
  </>
59
69
  )
@@ -117,7 +117,7 @@ export default class ApiMakerBootStrapLiveTableModelRow extends React.PureCompon
117
117
  _modelCallbackArgs () {
118
118
  const {model} = digs(this.props, "model")
119
119
  const modelArgName = inflection.camelize(this.props.liveTable.props.modelClass.modelClassData().name, true)
120
- const modelCallbackArgs = {}
120
+ const modelCallbackArgs = {model}
121
121
 
122
122
  modelCallbackArgs[modelArgName] = model
123
123