UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

48 lines (47 loc) 2.23 kB
/** * CodeAnalizerComment: Updated 2 imports on 2024-09-21 23:07:24 * Update:: import { IWebpartHistory } to '@mikezimm/fps-core-v7/lib/banner/features/WebPartHistory/Interface;' * Update:: import { IWebpartHistoryItem2 } to '@mikezimm/fps-core-v7/lib/banner/features/WebPartHistory/Interface;' */ import * as React from 'react'; export function getHistoryContent(webpartHistory) { const thisInstance = createHistoryItem(webpartHistory.thisInstance); let thisInstanceChanges = webpartHistory.thisInstance.changes.length === 0 ? null : React.createElement("div", null, React.createElement("div", { style: { fontSize: 'large', textDecoration: 'underline' } }, "This edit session"), thisInstance); let priorHistoryChanges = null; if (webpartHistory.history && webpartHistory.history.length > 0) { let priorHistory = []; webpartHistory.history.map((item) => { if (webpartHistory.thisInstance.time !== item.time) { priorHistory.push(createHistoryItem(item)); } }); priorHistoryChanges = React.createElement("div", null, React.createElement("div", { style: { fontSize: 'large', textDecoration: 'underline' } }, "Previous edit sessions"), priorHistory); } const content = React.createElement("div", { id: "HistoryPanel", style: { paddingTop: '20px' } }, thisInstanceChanges, priorHistoryChanges); return content; } function createHistoryItem(item) { if (item.changes.length === 0) { return undefined; } const changes = item.changes.map((change, idx) => { return React.createElement("tr", null, React.createElement("td", null, change.prop, " : "), React.createElement("td", { title: change.value }, change.value ? change.value : 'Empty')); }); return React.createElement("div", { className: 'history-item' }, React.createElement("div", null, item.user, " : ", new Date(item.time).toLocaleString()), React.createElement("table", null, changes)); } //# sourceMappingURL=HistoryContent.js.map