项目作者: SenseNet

项目描述 :
React controls for sensenet
高级语言: TypeScript
项目地址: git://github.com/SenseNet/sn-controls-react.git
创建时间: 2017-05-23T13:29:00Z
项目社区:https://github.com/SenseNet/sn-controls-react

开源协议:GNU General Public License v2.0

下载


sn-controls-react


This package is not under active development. You can find our latest packages in the sensenset/sn-client monorepo.


Greenkeeper badge
Join the chat at https://gitter.im/SenseNet/sn-controls-react
License
Commitizen friendly

Collection of React components for sensenet ECM with Material-UI

Sense/Net Services

Usage and installation

You can install the latest version from NPM

  1. npm install --save sn-controls-react

You can import fieldcontrol and viewcontrol components into your React App the conventional way.

  1. import { NewView, EditView, CommandButtons } 'sn-controls-react';
  2. ...

View Controls

View Controls are almost the same as the .ascx Content Views in sensenet Webpages. This components define how the given Content will be rendered. As a Content is built up of Fields the View Control displays the Content using Field Controls to provide a surface to display/modify the Field values of the Content. View Control therefore depends on the Content Type of the specific Content.

Content creation form (NewView)

  1. import { NewView } from 'sn-controls-react'
  2. import createBrowserHistory from 'history/createBrowserHistory'
  3. const history = createBrowserHistory()
  4. // content: Content | required | empty Content Object
  5. // history: history Object made with createBrowserHistory() | optional | called after submit | default: window.history.back()
  6. // onSubmit: Function | optional | called on submit event | default: window.history.back()
  7. <NewView
  8. content={content}
  9. history={history}
  10. onSubmit={() => {})} />

Content editor form (EditView)

  1. import { EditView } from 'sn-controls-react'
  2. import createBrowserHistory from 'history/createBrowserHistory'
  3. const history = createBrowserHistory()
  4. // content: Content | required | empty Content Object
  5. // history: history Object made with createBrowserHistory() | optional | called after submit | default: window.history.back()
  6. // onSubmit: Function | optional | called on submit event | default: window.history.back()
  7. <EditView
  8. content={content}
  9. history={history}
  10. onSubmit={() => {})} />

Content browse view (BrowseView)

  1. import { BrowseView } from 'sn-controls-react'
  2. // content: Content | required | empty Content Object
  3. <BrowseView
  4. content={content} />

Field Controls

Just as legacy controls in sensenet Webpages Field Control components provide GUI for setting/modifying Field values of a Content but this time not as .ascx views but React Components.