MCPcopy Create free account
hub / github.com/sshwsfc/xadmin / constructor

Method constructor

packages/xadmin-model/src/base.js:10–25  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

8class Model extends React.Component {
9
10 constructor(props) {
11 super(props)
12 const { name, schema, modelKey, initialValues, props: modelProps } = props
13
14 const model = name ? this.getModel(name, modelKey, modelProps) : {
15 ...schema,
16 key: modelKey || schema.name,
17 ...modelProps
18 }
19 let initial = initialValues
20 if(!initial && model.initialValues) {
21 initial = _.isFunction(model.initialValues) ? model.initialValues() : model.initialValues
22 }
23 app.context.store.dispatch({ type: 'INITIALIZE', model, initial })
24 this.state = { model }
25 }
26
27 getModel(name, key, props) {
28 const model = app.get('models')[name]

Callers

nothing calls this directly

Calls 1

getModelMethod · 0.95

Tested by

no test coverage detected