elektron-tauon-pagecontext
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

Elektron Tauon Page Context module

Welcome to the Elektron Tauon Page Context module.
This module provides classes for elektron solutions to use against SharePoint pages.

There are 3 classes available in this module:

- PageContext: Allows you get the content type Id of a SharePoint page.
- PageEditor: Moves the editing fields of a SharePoint page to a specific HTML location in the same page for inline-editing behavior based on SharePoint page layouts.
- PageValidation: Handle validation behaviors for a specific content type on a SharePoint page in editing mode against required fields. 

General Behavior

PageContext

To use this control, import the PageContext class from this module: import { PageContext } from 'elektron-tauon-pagecontext';

Instanciate the object using the constructor: const pageContext = new PageContext('list id', 'item id'); The first parameter is the Id of the list containing the page (can be used with _spPageContextInfo.pageListId for the current page). The second parameter is the item Id of the page (can be used with _spPageContextInfo.pageItemId for the current page).

To get the content type id of the page, call the GetContentTypeId() method like so pageContext.GetContentTypeId();. Returns the content type id as a string.

PageEditor

To use this control, import the PageEditor from this module: import { PageEditor } from 'elektron-tauon-pagecontext';

Instanciate the control using the constructor: const pageEditor = new PageEditor($('targetContainerSelector'), $('sourceContainerSelector'), specificFields, exclusiveFields);

The first parameter is the jQuery container object where the edition fields should be moved to. In order to work, the target HTML element where the edition field should be moved to must declare the following attribute data-elektron-editable="". The value of this attribute is a space separated list containing the static name of the fields that are supposed to be rendered at this location in editing mode.

The second parameter is the jQuery container oject where the edition fields are originally located.

The third parameter is optional. It allows to specify an array of PageLayoutSpecificField objects for editing fields that are specific to a particular content type based on the attribute value defined above.

The fourth parameter is optional. It allows to specify an array of PageLyoutExclusiveField objects which are for specific fields which should not be moved for a particular content type.

To move the fields on the page, call the BindInplaceEditing() method like so pageEditor.BindInplaceEditing(contentTypeId);.

PageValidation

To use this control, import the PageContext class from this module: import { PageValidation } from 'elektron-tauon-pagecontext';

Instanciate the object using the constructor: const pageValidation = new PageValidation('content type id');

Load/Retrieve the required fields for a specific list: pageValidator.GetRequiredFields(listId);;

Then call the BindRequiredField() method to append the asterisk and the error message to the field: pageValidator.BindRequiredField();

Getting Started

Tools

  • latest current version of NodeJs
  • We recommend using Visual Studio Code as a lot of settings are pre-configured for it.

Having your environment ready

npm i typescript tslint -g

Installing the dependencies

npm i  

Building

npm run build

Debugging

Run this command from this repo:
npm link
(npm unlink to undo)
Create a project using the generator.
Run this command from the debugging repo:
npm link elektron-tauon-pagecontext
(npm unlink elektron-tauon-pagecontext to undo)

Publishing

Please refer to the following documentation

Continuous integration

Please refer to the following documentation
static analysis url.
No unit testing in place at the moment.

Contributing

Please refer to the following documentation
repo url

Package Sidebar

Install

npm i elektron-tauon-pagecontext

Weekly Downloads

2

Version

3.0.1

License

MIT

Unpacked Size

77.6 kB

Total Files

69

Last publish

Collaborators

  • kk2tolead
  • 2toleadjordan
  • 2toleadmike