@kaspernj/api-maker 1.0.300 → 1.0.302
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 +1 -1
- package/src/model-name.mjs +2 -6
- package/src/with-model.jsx +4 -6
package/package.json
CHANGED
package/src/model-name.mjs
CHANGED
|
@@ -6,9 +6,7 @@ export default class ModelName {
|
|
|
6
6
|
this.data = data
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
camelizedLower()
|
|
10
|
-
return this.data.modelClassData.camelizedLower
|
|
11
|
-
}
|
|
9
|
+
camelizedLower = () => this.data.modelClassData.camelizedLower
|
|
12
10
|
|
|
13
11
|
human(args) {
|
|
14
12
|
let argsToUse = args
|
|
@@ -31,7 +29,5 @@ export default class ModelName {
|
|
|
31
29
|
return Config.getI18n().t(key, {defaultValue: defaultModelName})
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
paramKey()
|
|
35
|
-
return this.data.modelClassData.paramKey
|
|
36
|
-
}
|
|
32
|
+
paramKey = () => this.data.modelClassData.paramKey
|
|
37
33
|
}
|
package/src/with-model.jsx
CHANGED
|
@@ -13,11 +13,9 @@ export default (WrappedComponent, modelClassArg, argsArg = {}) => {
|
|
|
13
13
|
|
|
14
14
|
modelClass = this.resolveModelClass(modelClassArg)
|
|
15
15
|
args = this.resolveArgs()
|
|
16
|
-
|
|
16
|
+
modelVariableName = inflection.camelize(this.modelClass.modelClassData().name, true)
|
|
17
17
|
paramsVariableName = `${this.modelClass.modelName().paramKey()}_id`
|
|
18
18
|
|
|
19
|
-
nothing = console.error(this.modelClass.modelName())
|
|
20
|
-
|
|
21
19
|
state = {
|
|
22
20
|
model: undefined,
|
|
23
21
|
modelId: this.getModelId(),
|
|
@@ -117,9 +115,9 @@ export default (WrappedComponent, modelClassArg, argsArg = {}) => {
|
|
|
117
115
|
const {model, modelId, notFound} = digs(this.state, "model", "modelId", "notFound")
|
|
118
116
|
const wrappedComponentProps = {}
|
|
119
117
|
|
|
120
|
-
wrappedComponentProps[this.
|
|
121
|
-
wrappedComponentProps[`${this.
|
|
122
|
-
wrappedComponentProps[`${this.
|
|
118
|
+
wrappedComponentProps[this.modelVariableName] = model
|
|
119
|
+
wrappedComponentProps[`${this.modelVariableName}Id`] = modelId
|
|
120
|
+
wrappedComponentProps[`${this.modelVariableName}NotFound`] = notFound
|
|
123
121
|
|
|
124
122
|
return (
|
|
125
123
|
<>
|