@mikezimm/fps-library-v2
Version:
Library of reusable typescript/javascript functions, interfaces and constants
34 lines • 2.2 kB
JavaScript
import { removeFpsSpService } from '@mikezimm/fps-core-v7/lib/components/molecules/source-props/createSources/cloneSourceProps';
import * as React from 'react';
import ReactJson from '@microlink/react-json-view';
import { check4This, Check4 } from '@mikezimm/fps-core-v7/lib/logic/Links/CheckSearch';
/**
* Builds ReactJson object with FPS Defaults
*
* import { FPSReactJSON } from '@mikezimm/fps-library-v2/lib/components/atoms/ReactJSON/ReactJSONObjectV2';
*
* @param props
* @returns
*/
export function FPSReactJSON(props) {
let jsonObject = props.jsonObject ? props.jsonObject : null;
const collapsed = props.collapsed ? props.collapsed : false;
if (check4This(Check4.showJSONState_Eq_true) === true) {
console.log('FPSReactJSON - handle object - before', props.name, jsonObject);
}
// Automatically remove service any time it's found at this point.
jsonObject = removeFpsSpService(jsonObject);
// if ( ( props.name === 'props' || props.name === 'bannerProps' ) && check4This( Check4.showJSONState_Eq_true ) ) {
// console.log('FPSReactJSON - handle object - after', props.name, jsonObject );
// }
// Fixed this during PivotTiles testing because the old if-logic would set false inputs to true
const displayDataTypes = props.displayDataTypes === false ? false : true;
const displayObjectSize = props.displayObjectSize === false ? false : true;
const enableClipboard = props.enableClipboard === false ? false : true;
const style = props.style ? props.style : { padding: '20px 0px' };
const themeJSON = props.theme ? props.theme : 'rjv-default';
const indentWidth = props.indentWidth ? props.indentWidth : 2;
const result = React.createElement(ReactJson, { src: jsonObject, name: props.name, collapsed: collapsed, displayDataTypes: displayDataTypes, displayObjectSize: displayObjectSize, enableClipboard: enableClipboard, style: style, theme: themeJSON, indentWidth: indentWidth, collapseStringsAfterLength: props.maxStrLength, groupArraysAfterLength: props.arrayGroupSize, quotesOnKeys: props.quotesOnKeys });
return result;
}
//# sourceMappingURL=ReactJSONObjectV2.js.map