Skip to content

Commit

Permalink
Merge pull request #201 from gunjandatta/gdatta
Browse files Browse the repository at this point in the history
Intellisense - Code Review and Reorg
  • Loading branch information
gunjandatta authored Jan 21, 2019
2 parents b6661ec + 5d22083 commit 6d9a86f
Show file tree
Hide file tree
Showing 147 changed files with 7,179 additions and 7,209 deletions.
3 changes: 1 addition & 2 deletions build/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ __export(require("./loader"));
__export(require("./methods"));
__export(require("./ribbonLink"));
__export(require("./sbLink"));
__export(require("./sp"));
__export(require("./spCfg"));
__export(require("./taxonomy"));
__export(require("./webpart"));
var SP = require("./sp");
exports.SP = SP;
64 changes: 36 additions & 28 deletions build/helper/sp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
/**
* Modal Dialog
*/
exports.ModalDialog = {
var ModalDialog = {
// Closes the dialog
close: function (dialogResult) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.close(dialogResult); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.close(dialogResult); });
},
// Close the dialog
commonModalDialogClose: function (dialogResult, returnVal) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.commonModalDialogClose(dialogResult, returnVal); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.commonModalDialogClose(dialogResult, returnVal); });
},
// Open a dialog
commonModalDialogOpen: function (url, options, callback, args) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.commonModalDialogOpen(url, options, callback, args); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.commonModalDialogOpen(url, options, callback, args); });
},
// Method to ensure the core library is loaded
load: function () {
// Return a promise
return new Promise(function (resolve, reject) {
// See if the class exists
if (SP && SP.UI && SP.UI.ModalDialog) {
if (window["SP"] && window["SP"].UI && window["SP"].UI.ModalDialog) {
resolve();
}
else {
// Wait for the core script to be loaded
SP.SOD.executeFunc("sp.js", "SP.UI.ModalDialog", function () {
window["SP"].SOD.executeFunc("sp.js", "SP.UI.ModalDialog", function () {
// Resolve the promise
resolve();
});
Expand All @@ -39,57 +39,57 @@ exports.ModalDialog = {
// Opens a pop-up page
OpenPopUpPage: function (url, callback, width, height) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.OpenPopUpPage(url, callback, width, height); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.OpenPopUpPage(url, callback, width, height); });
},
// Refreshes the page
RefreshPage: function (dialogResult) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.RefreshPage(dialogResult); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.RefreshPage(dialogResult); });
},
// Shows a modal dialog
showModalDialog: function (options) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.showModalDialog(options); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.showModalDialog(options); });
},
// Shows a pop-up dialog
ShowPopupDialog: function (url) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.ShowPopupDialog(url); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.ShowPopupDialog(url); });
},
// Shows a wait screen
showWaitScreenSize: function (title, message, callback, height, width) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.showWaitScreenSize(title, message, callback, height, width); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.showWaitScreenSize(title, message, callback, height, width); });
},
// Shows a wait screen w/ no close button
showWaitScreenWithNoClose: function (title, message, height, width) {
// Load the library and call the method
exports.ModalDialog.load().then(function () { SP.UI.ModalDialog.showWaitScreenWithNoClose(title, message, height, width); });
ModalDialog.load().then(function () { window["SP"].UI.ModalDialog.showWaitScreenWithNoClose(title, message, height, width); });
}
};
/**
* Notification
*/
exports.Notify = {
var Notify = {
// Adds a notification
addNotification: function (html, sticky) {
// Return a promise
return new Promise(function (resolve, reject) {
// Load the library and call the method
exports.Notify.load().then(function () { resolve(SP.UI.Notify.addNotification(html, sticky)); });
Notify.load().then(function () { resolve(window["SP"].UI.Notify.addNotification(html, sticky)); });
});
},
// Method to ensure the core library is loaded
load: function () {
// Return a promise
return new Promise(function (resolve, reject) {
// See if the class exists
if (SP && SP.UI && SP.UI.Notify) {
if (window["SP"] && window["SP"].UI && window["SP"].UI.Notify) {
resolve();
}
else {
// Wait for the core script to be loaded
SP.SOD.executeFunc("sp.js", "SP.UI.Notify", function () {
window["SP"].SOD.executeFunc("sp.js", "SP.UI.Notify", function () {
// Resolve the promise
resolve();
});
Expand All @@ -99,21 +99,21 @@ exports.Notify = {
// Removes a notification
removeNotification: function (id) {
// Load the library and call the method
exports.Notify.load().then(function () { SP.UI.Notify.removeNotification(id); });
Notify.load().then(function () { window["SP"].UI.Notify.removeNotification(id); });
}
};
/**
* Status
*/
exports.Status = {
var Status = {
// Adds a status
addStatus: function (title, html, prepend) {
// Return a promise
return new Promise(function (resolve, reject) {
// Load the library
exports.Status.load().then(function () {
Status.load().then(function () {
// Add the status and resolve the promise
resolve(SP.UI.Status.addStatus(title, html, prepend));
resolve(window["SP"].UI.Status.addStatus(title, html, prepend));
});
});
},
Expand All @@ -122,9 +122,9 @@ exports.Status = {
// Return a promise
return new Promise(function (resolve, reject) {
// Load the library
exports.Status.load().then(function () {
Status.load().then(function () {
// Add the status and resolve the promise
resolve(SP.UI.Status.appendStatus(id, title, html));
resolve(window["SP"].UI.Status.appendStatus(id, title, html));
});
});
},
Expand All @@ -133,12 +133,12 @@ exports.Status = {
// Return a promise
return new Promise(function (resolve, reject) {
// See if the class exists
if (SP && SP.UI && SP.UI.Status) {
if (window["SP"] && window["SP"].UI && window["SP"].UI.Status) {
resolve();
}
else {
// Wait for the core script to be loaded
SP.SOD.executeFunc("sp.js", "SP.UI.Status", function () {
window["SP"].SOD.executeFunc("sp.js", "SP.UI.Status", function () {
// Resolve the promise
resolve();
});
Expand All @@ -148,21 +148,29 @@ exports.Status = {
// Removes all status messages
removeAllStatus: function (hide) {
// Load the library and call the method
exports.Status.load().then(function () { SP.UI.Status.removeAllStatus(hide); });
Status.load().then(function () { window["SP"].UI.Status.removeAllStatus(hide); });
},
// Removes a status
removeStatus: function (id) {
// Load the library and call the method
exports.Status.load().then(function () { SP.UI.Status.removeStatus(id); });
Status.load().then(function () { window["SP"].UI.Status.removeStatus(id); });
},
// Sets the status color
setStatusPriColor: function (id, color) {
// Load the library and call the method
exports.Status.load().then(function () { SP.UI.Status.setStatusPriColor(id, color); });
Status.load().then(function () { window["SP"].UI.Status.setStatusPriColor(id, color); });
},
// Updates the status
updateStatus: function (id, html) {
// Load the library and call the method
exports.Status.load().then(function () { SP.UI.Status.updateStatus(id, html); });
Status.load().then(function () { window["SP"].UI.Status.updateStatus(id, html); });
}
};
/**
* SharePoint Components
*/
exports.SP = {
ModalDialog: ModalDialog,
Notify: Notify,
Status: Status
};
2 changes: 1 addition & 1 deletion build/mapper/audit.js → build/mapper/mapper/audit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Audit
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Event Receiver
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/file.js → build/mapper/mapper/file.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Attachment
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/graph.js → build/mapper/mapper/graph.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Graph v1.0
*/
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion build/mapper/list.js → build/mapper/mapper/list.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Content Type
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Navigation
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Property Values
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/search.js → build/mapper/mapper/search.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Search
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Role Assignment
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/site.js → build/mapper/mapper/site.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Features
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/social.js → build/mapper/mapper/social.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* People Manager
*/
Expand Down
2 changes: 1 addition & 1 deletion build/mapper/user.js → build/mapper/mapper/user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* Group
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("../utils");
var utils_1 = require("../../utils");
/**
* User Custom Action
*/
Expand Down
26 changes: 3 additions & 23 deletions build/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,12 @@ var Mapper = require("./mapper");
* SharePoint REST Library
*/
exports.$REST = {
__ver: 4.48,
__ver: 4.52,
AppContext: function (siteUrl) { return Lib.Site.getAppContext(siteUrl); },
ContextInfo: Lib.ContextInfo,
DefaultRequestToHostFl: false,
Graph: Lib.Graph,
Helper: {
App: Helper.App,
Dependencies: Helper.Dependencies,
createDocSet: Helper.createDocSet,
Executor: Helper.Executor,
FieldSchemaXML: Helper.FieldSchemaXML,
hasPermissions: Helper.hasPermissions,
JSLink: Helper.JSLink,
ListForm: Helper.ListForm,
ListFormField: Helper.ListFormField,
Loader: Helper.Loader,
parse: Helper.parse,
request: Helper.request,
RibbonLink: Helper.RibbonLink,
SP: Helper.SP,
SPCfgFieldType: Helper.SPCfgFieldType,
SPCfgType: Helper.SPCfgType,
SPConfig: Helper.SPConfig,
SuiteBarLink: Helper.SuiteBarLink,
Taxonomy: Helper.Taxonomy,
WebPart: Helper.WebPart
},
Helper: Helper,
List: Lib.List,
ListByEntityName: Lib.List.getByEntityName,
ListDataAsStream: Lib.List.getDataAsStream,
Expand All @@ -60,6 +39,7 @@ if (global == null || global.__ver == null || global.__ver < exports.$REST.__ver
// Ensure the SP lib exists
if (Lib.ContextInfo.window.SP) {
// Alert other scripts this library is loaded
Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("gd-sprest");
Lib.ContextInfo.window.SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("gd-sprest.js");
}
}
Loading

0 comments on commit 6d9a86f

Please sign in to comment.