Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
const { _t } = app.context
return (
);
}
}
export default StoreWrap('test', {
data: ({ state }) => ({ title: state.test }),
event: {
mount: ({ dispatch }) => dispatch({ type: '@@xadmin/ADD_NOTICE', headline: 'Test', message: 'Test message' })
}
})(App);
import React from 'react'
import { StoreWrap, app } from 'xadmin'
import { Model } from 'xadmin-model'
import { C } from 'xadmin-ui'
import { UserForgetPassword } from '../models'
export default StoreWrap('auth.forget_password')(({ onSuccess }) => {
const { _t } = app.context
return (
)
})
import React from 'react'
import { StoreWrap, app } from 'xadmin'
import { Model } from 'xadmin-model'
import { C } from 'xadmin-ui'
import { UserSignIn } from '../models'
const SignInForm = StoreWrap('auth.sign_in')(({ onSignIn }) => {
return (
)
})
export default SignInForm
import React from 'react'
import { StoreWrap, app } from 'xadmin'
import { Model } from 'xadmin-model'
import { Page, C } from 'xadmin-ui'
import { UserChangePassword } from '../models'
export default StoreWrap('auth.change_password')(({ onChange }) => {
const { _t } = app.context
return (
)
})
import React from 'react'
import { StoreWrap } from 'xadmin'
import { AlertList } from 'react-bs-notifier'
const Notices = StoreWrap('xadmin.notice')(({ notices, onDismiss }) => {
return
})
export default {
name: 'xadmin.notice',
blocks: {
'main': () =>
},
mappers: {
'xadmin.notice': {
data: ({ state }) => {
return {
notices: state.notices
}
},
method: {
].filter(Boolean).join('.')
_.set(prev, path, err.message)
return prev
}, {})
errors = validateByFields(errors, values, fields)
return errors
}
})(BaseForm)
return { WrapForm, fields }
}, [ formKey, schema ])
return WrapForm && fields ? : null
}
const FormWrap = StoreWrap(Connect => (props) => {
const { state } = props.wrapContext
return (
{ _reduxForm => }
)
})
const useForm = (props, select) => {
const _reduxForm = React.useContext(ReduxFormContext)
const { dispatch, store, state, ...values } = select ?
use('redux', state => select((_reduxForm ? _reduxForm.getFormState(state) : {}) || {})) : use('redux')
return { ...props, form: _reduxForm, ...values,
getFormState: React.useCallback(() => (_reduxForm ? _reduxForm.getFormState(store.getState()) : {}) || {}, [ _reduxForm, store ]),
formState: _reduxForm.getFormState(state) }
import React from 'react'
import { StoreWrap, app } from 'xadmin'
import { Model } from 'xadmin-model'
import { C } from 'xadmin-ui'
import { UserSignUp } from '../models'
const SignUpForm = StoreWrap('auth.sign_up')(({ onSuccess }) => {
const { _t } = app.context
return (
)
})
export default SignUpForm
let initial = initialValues
if(!initial && model.initialValues) {
initial = _.isFunction(model.initialValues) ? model.initialValues() : model.initialValues
}
app.context.store.dispatch({ type: 'INITIALIZE', model, initial })
setState('INITIALIZE')
} else if(state == 'DESTROY') {
app.context.store.dispatch({ type: 'DESTROY', model })
}
}, [ state ])
if(!model || state != 'INITIALIZE') return null
return {children}
}
const ModelWrap = StoreWrap(Connect => (props) => {
const { state } = props.wrapContext
return (
{ model => }
)
})
const ModelBlock = (props) => (
{ model => (
{ blocks => {
const modelBlock = model && model.blocks && model.blocks[props.name]
if(modelBlock) {
const mb = modelBlock(props)
import React from 'react'
import { StoreWrap, config as _c, Block, app } from 'xadmin'
import { IsAuthenticated } from 'xadmin-auth'
import { Layout, Menu, Breadcrumb, Icon } from 'antd'
const { Header, Content, Footer, Sider } = Layout
const SubMenu = Menu.SubMenu
function itemRender(route, params, routes, paths) {
const last = routes.indexOf(route) === routes.length - 1
const click = (to) => () => app.go(to)
return last ? <span>{route.breadcrumbName}</span> : <a>{route.breadcrumbName}</a>
}
@StoreWrap('main.menu')
class MenuBar extends React.Component {
render() {
return (
{items => (
<menu mode="{this.props.mode}">
{items}
</menu>
)}
)
}
}
@IsAuthenticated
import React from 'react'
import { NavDropdown } from 'react-bootstrap'
import Icon from 'react-fontawesome'
import { StoreWrap, app, Block } from 'xadmin'
const UserMenu = StoreWrap('auth.user')(({ user, onLogout, onChangePassword }) => {
const { _t } = app.context
return user && (
{user.username}} id="basic-nav-dropdown">
{_t('Change password')}
{_t('Logout')}
)
})
export default UserMenu