@mikezimm/npmfunctions
Version:
Functions used in my SPFx webparts
147 lines • 6.94 kB
JavaScript
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCacheTableSmall = exports.createPerformanceTableSmall = exports.createPerformanceTableVisitorXtra = exports.createPerformanceTableVisitor = exports.createCacheRows = exports.createPerformanceRows = void 0;
var React = __importStar(require("react"));
// import { Icon, IIconProps } from 'office-ui-fabric-react/lib/Icon';
var IPerformance_1 = require("./IPerformance");
require('./styles.css');
function createPerformanceRows(performance, keysToShow) {
// const { fetch, analyze } = performance;
var loadRows = [
React.createElement("tr", null,
React.createElement("th", null, "Process"),
React.createElement("th", null, "Mode"),
React.createElement("th", null, "Time"),
React.createElement("th", null, "ms"))
];
if (!keysToShow || keysToShow.length === 0) {
keysToShow = IPerformance_1.LoadPerformanceOps;
}
keysToShow.map(function (part) {
if (part.indexOf('setting') > -1) {
var thisPart = performance.sets[part];
if (thisPart) {
loadRows.push(React.createElement("tr", null,
React.createElement("td", null, thisPart.label),
React.createElement("td", null, "".concat(thisPart.value))));
}
}
else {
var thisPart = performance.ops[part];
if (thisPart) {
var time = thisPart.startStr;
loadRows.push(React.createElement("tr", null,
React.createElement("td", null, thisPart.label),
React.createElement("td", null, thisPart.mode === 1 ? 'View' : 'Edit'),
React.createElement("td", null, time),
React.createElement("td", null, thisPart.ms)));
}
}
});
return loadRows;
}
exports.createPerformanceRows = createPerformanceRows;
// export function createCacheRows( cacheInfo: ICacheInfo ) {
function createCacheRows(cacheInfo) {
var loadRows = [
React.createElement("tr", null,
React.createElement("th", { style: { minWidth: '150px' } }, "Property"),
React.createElement("th", { style: { minWidth: '150px' } }, "Value"))
];
var skipProps = ['wasCached', 'enableHTMLCache', 'EditorName', 'FileRef', 'size'];
Object.keys(cacheInfo).map(function (part) {
if (skipProps.indexOf(part) < 0 && cacheInfo[part]) {
loadRows.push(React.createElement("tr", null,
React.createElement("td", null, part),
React.createElement("td", null, cacheInfo[part])));
}
});
return loadRows;
}
exports.createCacheRows = createCacheRows;
/**
* USED BY: ALVFM This is used for the visitor panel, not code pane
* @param performance
* @returns
*/
function createPerformanceTableVisitor(performance, keysToShow) {
if (performance) {
var loadSummary = React.createElement("div", { className: 'fps-performance', style: { paddingLeft: '15px', paddingTop: '30px' } },
React.createElement("div", { className: 'fps-header-styles' }, "Load Performance:"),
React.createElement("table", null, createPerformanceRows(performance, keysToShow)));
return (loadSummary);
}
else {
return (React.createElement("div", null));
}
}
exports.createPerformanceTableVisitor = createPerformanceTableVisitor;
/**
* USED BY: SecureScript7 loadTable >> loadSummary in \secureScript7\components\SecureScriptVisitorPanel.tsx
* @param performance
* @returns
*/
function createPerformanceTableVisitorXtra(performance, titleAboveTable, keysToShow, objAboveTable) {
if (titleAboveTable === void 0) { titleAboveTable = ''; }
if (objAboveTable === void 0) { objAboveTable = null; }
var loadSummary = React.createElement("div", { className: 'fps-performance', style: { paddingLeft: '15px', paddingTop: '30px' } },
React.createElement("div", { className: 'fps-header-styles' }, "Load Performance:"),
!titleAboveTable ? null : React.createElement("div", { style: { paddingBottom: '8px' } },
titleAboveTable,
" ",
JSON.stringify(objAboveTable)),
React.createElement("table", null, createPerformanceRows(performance, keysToShow)));
return (loadSummary);
}
exports.createPerformanceTableVisitorXtra = createPerformanceTableVisitorXtra;
/**
* USED BY: SecureScript7 loadTable >> loadSummary in \secureScript7\components\SecureScript7.tsx
* @param performance
* @param cacheOnClick
* @returns
*/
function createPerformanceTableSmall(performance, keysToShow, cacheOnClick) {
var loadSummary = React.createElement("div", { className: 'fps-performance', style: { paddingLeft: '15px' } },
React.createElement("div", { className: 'fps-tableheading' }, "Performance Details"),
React.createElement("table", null, createPerformanceRows(performance, keysToShow)));
return (loadSummary);
}
exports.createPerformanceTableSmall = createPerformanceTableSmall;
/**
* USED BY: SecureScript7 code pane and includes cache info
* @param cache
* @param cacheOnClick
* @returns
*/
// export function createCacheTableSmall( cache: ICacheInfo, cacheOnClick: any ) {
function createCacheTableSmall(cache, cacheOnClick) {
var loadSummary = React.createElement("div", { className: 'fps-performance', style: { paddingLeft: '15px' } },
React.createElement("div", { className: 'fps-tableheading' }, "Cache Details"),
React.createElement("table", null, createCacheRows(cache)));
return (loadSummary);
}
exports.createCacheTableSmall = createCacheTableSmall;
//# sourceMappingURL=tables.js.map
;