Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gd-sprest-react

Package Overview
Dependencies
Maintainers
1
Versions
309
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gd-sprest-react

SharePoint react components.

  • 2.8.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
57
increased by14%
Maintainers
1
Weekly downloads
 
Created
Source

Current Version Downloads Total Downloads

SharePoint React Library

This library is an extension of the gd-sprest framework. This library provides react components designed to work in SharePoint 2013. The Office Fabric-UI React framework is being used to keep a consistent OTB look and feel, similar to Office 365.

Components

  • Field
  • Item Form
  • Panel
  • SharePoint People Picker
  • WebPart (2013/Online)

Field Component

Supported Field Types
  • Attachments
  • Boolean
  • Choice
  • Date
  • Date/Time
  • Lookup
  • Managed Metadata
  • Multi-Choice
  • Multi-User
  • Note (Plain Text)
  • Number
  • Text
  • Url
  • User
Events
  • onChange(value) - The change event for the field.
  • onRender(fieldInfo) - Override the component render method.

Code Examples

Field

The field component requires the list name and internal field name properties to be set. A query will be made to SharePoint and will render based on its properties.

<Field defaultValue={item.Title} listName={listName} name="Title" />
Item Form

The item form component requires the list name to be set. By default, the fields will be loaded from the default content type. An optional array of field information can be provided. The field information element allows you to specify:

  • controlMode
    • Display - Displays the field value.
    • Edit - Does not default the value to the field's default value defined in SharePoint.
    • New - Defaults the value to the field's default value defined in SharePoint.
  • name - The internal field name.
  • onChange(value) - The change event for the field.
  • onRender(fieldInfo) - Override the component render method.
<ItemForm
    item={this.state.item}
    listName={this.props.cfg.ListName}
    showAttachments={true}
/>
Panel

The panel extends the "Panel" component from the Office Fabric React framework, and adds the following methods:

  • hide - Hides the panel.
  • show - Shows the panel.
<Panel ref={panel => { this._panel = panel; }} />

// Hide the panel
hidePanel = () => { this._panel.hide(); }

// Show the panel
showPanel = () => { this._panel.show(); }
SharePoint People Picker

The people picker component searches the user information list by default, but contains a "Search All" option to search all principal sources.

<SPPeoplePicker allowGroups={this.state.fieldInfo.allowGroups} allowMultiple={this.state.fieldInfo.allowMultiple} fieldValue={this.state.value} />
WebPart

The webpart component supports webpart and wiki pages. The component will auto detect the page mode (display or edit) and allow you to render a component based on the page state.

Refer to this blog post for a guide to creating webparts in SharePoint 2013. Refer to this GitHub project for examples of the webpart components available in this library.

import { WebPartListCfg } from "gd-sprest-react";

export class WebPartDemo {
    constructor() {
        new WebPart({
            cfgElementId: "wp-demoCfg",
            displayElement: DemoWebpart,
            editElement: WebPartListCfg,
            targetElementId: "wp-demo"
        });
    }
}

Keywords

FAQs

Package last updated on 25 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc