Skip to content

Commit

Permalink
Added the custom formatter properties to the content type and view fo…
Browse files Browse the repository at this point in the history
…r the SP Configuration component.
  • Loading branch information
gunjandatta committed Sep 19, 2024
1 parent 3147f84 commit f02fec6
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 4 deletions.
8 changes: 8 additions & 0 deletions @types/helper/spCfg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ export interface IFieldInfoUser extends IFieldInfo {
* SharePoint Configuration - Content Type Information
*/
export interface ISPCfgContentTypeInfo extends ContentTypeCreationInformation {
/**
* The client form custom formatter.
*/
ClientFormCustomFormatter?: string;

/**
* The content type. (This value is set internally.)
*/
Expand Down Expand Up @@ -411,6 +416,9 @@ export interface ISPCfgListInfo {
* SharePoint Configuration - View Information
*/
export interface ISPCfgViewInfo {
/** Custom formatter */
CustomFormatter?: string;

/** Flag to set the view as the default view. */
Default?: boolean;

Expand Down
8 changes: 8 additions & 0 deletions dist/gd-sprest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3765,6 +3765,11 @@ declare module 'gd-sprest/helper/spCfg' {
* SharePoint Configuration - Content Type Information
*/
export interface ISPCfgContentTypeInfo extends ContentTypeCreationInformation {
/**
* The client form custom formatter.
*/
ClientFormCustomFormatter?: string;

/**
* The content type. (This value is set internally.)
*/
Expand Down Expand Up @@ -3888,6 +3893,9 @@ declare module 'gd-sprest/helper/spCfg' {
* SharePoint Configuration - View Information
*/
export interface ISPCfgViewInfo {
/** Custom formatter */
CustomFormatter?: string;

/** Flag to set the view as the default view. */
Default?: boolean;

Expand Down
2 changes: 1 addition & 1 deletion dist/gd-sprest.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gd-sprest.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gd-sprest",
"version": "8.1.9",
"version": "8.2.0",
"description": "An easy way to develop against the SharePoint REST API.",
"author": "Gunjan Datta <[email protected]> (https://gunjandatta.github.io)",
"license": "MIT",
Expand Down
10 changes: 10 additions & 0 deletions src/helper/spCfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ export const SPConfig = (cfg: ISPConfigProps, webUrl?: string): ISPConfig => {
* See if we need to update the properties
*/

// Custom form formatter
if (cfgContentType.ClientFormCustomFormatter != null && cfgContentType.ContentType.ClientFormCustomFormatter != cfgContentType.ClientFormCustomFormatter) {
// Update the configuration
cfgUpdate.ClientFormCustomFormatter = cfgContentType.ClientFormCustomFormatter;

// Set the flag
updateFl = true;
}

// Description
if (cfgContentType.Description != null && cfgContentType.ContentType.Description != cfgContentType.Description) {
// Update the configuration
Expand Down Expand Up @@ -1181,6 +1190,7 @@ export const SPConfig = (cfg: ISPConfigProps, webUrl?: string): ISPConfig => {
typeof (cfg.MobileDefaultView) === "boolean" ? props["MobileDefaultView"] = cfg.MobileDefaultView : null;
typeof (cfg.MobileView) === "boolean" ? props["MobileView"] = cfg.MobileView : null;
typeof (cfg.Tabular) === "boolean" ? props["TabularView"] = cfg.Tabular : null;
cfg.CustomFormatter ? props["CustomFormatter"] = cfg.CustomFormatter : null;
cfg.JSLink ? props["JSLink"] = cfg.JSLink : null;
cfg.RowLimit > 0 ? props["RowLimit"] = cfg.RowLimit : null;
cfg.ViewQuery ? props["ViewQuery"] = cfg.ViewQuery : null;
Expand Down
2 changes: 1 addition & 1 deletion src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { IREST } from "../@types";
* SharePoint REST Library
*/
export const $REST: IREST = {
__ver: 8.19,
__ver: 8.20,
AppContext: (siteUrl: string) => { return Lib.Site.getAppContext(siteUrl); },
Apps: Lib.Apps,
ContextInfo: Lib.ContextInfo,
Expand Down

0 comments on commit f02fec6

Please sign in to comment.