@kaspernj/api-maker 1.0.249 → 1.0.251

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.249",
19
+ "version": "1.0.251",
20
20
  "type": "module",
21
21
  "description": "",
22
22
  "main": "index.js",
@@ -71,16 +71,10 @@ class ApiMakerBootstrapInput extends React.PureComponent {
71
71
  }
72
72
  {type == "money" &&
73
73
  <Money
74
- attribute={attribute}
75
- currenciesCollection={currenciesCollection}
76
- currencyName={currencyName}
77
- model={model}
78
74
  name={inputProps.name}
79
75
  className={this.inputClassName()}
80
- onChange={this.props.onChange}
81
- placeholder={this.props.placeholder}
82
- small={this.props.small}
83
76
  ref="money"
77
+ {...this.moneyProps()}
84
78
  />
85
79
  }
86
80
  {type != "money" &&
@@ -147,6 +141,17 @@ class ApiMakerBootstrapInput extends React.PureComponent {
147
141
  return classNames.join(" ")
148
142
  }
149
143
 
144
+ moneyProps() {
145
+ const moneyProps = {}
146
+ const forwardedProps = ["attribute", "currenciesCollection", "currencyName", "model", "onChange", "placeholder", "small"]
147
+
148
+ for (const forwardedProp of forwardedProps) {
149
+ if (forwardedProp in this.props) moneyProps[forwardedProp] = this.props[forwardedProp]
150
+ }
151
+
152
+ return moneyProps
153
+ }
154
+
150
155
  wrapperClassName () {
151
156
  const classNames = ["form-group", "component-bootstrap-string-input"]
152
157
 
@@ -108,6 +108,8 @@ export default class ApiMakerCommandsPool {
108
108
 
109
109
  return response
110
110
  }
111
+
112
+ throw new Error("Could successfully execute request")
111
113
  }
112
114
 
113
115
  async flush () {
@@ -1,5 +1,5 @@
1
1
  import {Input as ApiMakerInput} from "@kaspernj/api-maker/src/inputs/input"
2
- import {Checkbox} from "components/inputs/checkbox"
2
+ import {Checkbox} from "./checkbox"
3
3
 
4
4
  export default class ApiMakerInputsAttachment extends BaseComponent {
5
5
  static propTypes = {
@@ -8,7 +8,8 @@ export default class ApiMakerInputsAttachment extends BaseComponent {
8
8
  }
9
9
 
10
10
  render() {
11
- const {className, inputProps, model, wrapperOpts, ...restProps} = this.props
11
+ const {checkboxComponent, className, inputProps, model, wrapperOpts, ...restProps} = this.props
12
+ const CheckboxComponent = checkboxComponent || Checkbox
12
13
 
13
14
  inputProps.type = "file"
14
15
 
@@ -21,7 +22,7 @@ export default class ApiMakerInputsAttachment extends BaseComponent {
21
22
  }
22
23
  {this.getUrl() &&
23
24
  <div className="input-checkbox" style={{paddingTop: "15px", paddingBottom: "15px"}}>
24
- <Checkbox inputProps={{id: this.getPurgeInputId(), name: this.getPurgeInputName(), value: 1}} />
25
+ <CheckboxComponent inputProps={{id: this.getPurgeInputId(), name: this.getPurgeInputName()}} />
25
26
  <label className="checkbox-label" htmlFor={this.getPurgeInputId()}>
26
27
  {I18n.t("js.shared.delete")}
27
28
  </label>