GithubHelp home page GithubHelp logo

hilkenan / sp-formgen-react Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 304 KB

SharePoint form generator with JSON for react. UI Fabric controls are used for rendering

License: MIT License

HTML 2.60% TypeScript 97.12% JavaScript 0.27%
ui-fabric react form forms form-builder translation json reindering language

sp-formgen-react's Introduction

SharePoint React Form Generator with UI Fabric React Components

All of you are very welcome to contribute with this project! Also my other project formgen-react. This project is only the injection for SharePoint for the formgen-react project. See formgen-react documentation.

Join the chat at https://gitter.im/formgen-react/Lobby npm version License: MIT Build Status Dependency Status Downloads

Features

  • Same as for formgen-react project
  • Replace the People Picker control with a SharePoint People Picker control
  • Dependency Injection for SharePoint List loading for the controls:
    • DropDonw
    • Combobox
    • Choice Group
    • Cascading Dropdonw (over multiple lists)
  • Load translated list content from sharepoint

Installation

The package can be installed via NPM:

npm install sp-formgen-react --save

Documentation

Full documentation from formgen-react
Full documentation from sp-formgen-react

Configuration

The example below shows how to use the form generator with a simple json definition. This JSON need to map to the JSON schema:

import * as React from 'react';
import Form from 'formgen-react';
var jsonForm = require('./test.json');

export class Example extends React.Component {
render() {
  return (
  <SPForm 
    useLocalHost={ false }
    onCancelForm={ () => console.log("cancel click") }
    onSubmitForm={ (formData:any) => console.log("submit click: " + JSON.stringify(formData)) }
    jsonFormData={ jsonForm }  />
);
}

The above ./test.json file could look like this:

{
     "$schema": "../schemas/jfrom-schema.json",
     "id": "testform",
     "theme": "red",
     "title": "Test EN",
     "title_trans": {
         "de": "Test DE",
         "fr": "Test FR",
         "it": "Test IT"
    },
	"sp_config": {
		"lists": [{
			"key": "configKeyList",
			"config": {
				"view_name": "All Elementes",
				"key_field": "ID",
				"list_name": "yoursharepointlist",
				"display_fields": [{
					"internal_name": "Title"
				}]
			}
        }]
    },
    "rows": [{
        "columns": [{
			"controls": [{
                "id": "choiceGroup",
				"title": "ChoiceGroup",
				"dataProviderConfigKeys": [ "configKeyList" ],
                "control_type": [ "ChoiceGroup" ],
                "label_position": [ "Top"]
            }]
        }]
    }]
 }

The JSON has to fit the Schema Definition:
Form Schema
SharePoint Config
You need also the following global Schemas:
Translation
Object Translation

Local Development

The master branch contains the latest version of the Form component. To start your example app, use the following steps:

  1. npm run proxy
  2. Enter your SharePoint Environment url with credentials
  3. Ctrl Brack to stop the server
  4. npm run serve

We use sp-rest-proxy as server to route the calls to an sharePoint applicaiton. For more info see this module. With "npm run serve" you start this proxy AND a simple webserver on http://localhost:3000. The proxy for your SharePoint runs at http://localhost:4323.

Remark, that the used SharePoint Poeple Picker nor correctly runs with the proxy server. It shows the control but no users are found.

Publishing to SharePoint

When you publish the solution to sharepoint you has to set the property useLocalHost from the SPForm to false:

  <SPForm 
    useLocalHost={ false } />

otherwise it will still search sharepoint at your localhost proxy.

License

Copyright (c) 2018 to hilkenan and individual contributors. Licensed under MIT license, see LICENSE for the full license.

sp-formgen-react's People

Contributors

hilkenan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.