Skip to content

Commit

Permalink
feat: enhance the render method of the Copied component. #35 2101c36
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Feb 29, 2024
1 parent 22dbc16 commit 3b4ecf3
Show file tree
Hide file tree
Showing 76 changed files with 190 additions and 202 deletions.
6 changes: 3 additions & 3 deletions asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"files": {
"main.css": "/static/css/main.020a7543.css",
"main.js": "/static/js/main.ac91276e.js",
"main.js": "/static/js/main.d58d0924.js",
"refractor-prismjs-vendor.0abbb2f3.js": "/static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js",
"react-vendor.js": "/static/js/react-vendor.7038eeb0.js",
"refractor-prismjs-vendor.3665b250.js": "/static/js/refractor-prismjs-vendor.3665b250.eec550b5.js",
"refractor-prismjs-vendor.a81a7d65.js": "/static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js",
"index.html": "/index.html",
"main.020a7543.css.map": "/static/css/main.020a7543.css.map",
"main.ac91276e.js.map": "/static/js/main.ac91276e.js.map",
"main.d58d0924.js.map": "/static/js/main.d58d0924.js.map",
"refractor-prismjs-vendor.0abbb2f3.4ed442e7.js.map": "/static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js.map",
"react-vendor.7038eeb0.js.map": "/static/js/react-vendor.7038eeb0.js.map",
"refractor-prismjs-vendor.3665b250.eec550b5.js.map": "/static/js/refractor-prismjs-vendor.3665b250.eec550b5.js.map",
Expand All @@ -20,6 +20,6 @@
"static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js",
"static/js/react-vendor.7038eeb0.js",
"static/css/main.020a7543.css",
"static/js/main.ac91276e.js"
"static/js/main.d58d0924.js"
]
}
8 changes: 4 additions & 4 deletions badges.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="keywords" content="react,react-component,array-viewer,base-16,component,interactive,interactive-json,json,json-component,json-display,json-tree,json-view,json-viewer,json-inspector,json-tree,react,react-component,react-json,theme,tree,tree-view,treeview,jaywcjlove"><meta name="description" content="A React component for displaying and editing javascript arrays and JSON objects."><link rel="shortcut icon" href="/favicon.ico"><title>react-json-view</title><script defer="defer" src="./static/js/refractor-prismjs-vendor.3665b250.eec550b5.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js"></script><script defer="defer" src="./static/js/react-vendor.7038eeb0.js"></script><script defer="defer" src="./static/js/main.ac91276e.js"></script><link href="./static/css/main.020a7543.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="keywords" content="react,react-component,array-viewer,base-16,component,interactive,interactive-json,json,json-component,json-display,json-tree,json-view,json-viewer,json-inspector,json-tree,react,react-component,react-json,theme,tree,tree-view,treeview,jaywcjlove"><meta name="description" content="A React component for displaying and editing javascript arrays and JSON objects."><link rel="shortcut icon" href="/favicon.ico"><title>react-json-view</title><script defer="defer" src="./static/js/refractor-prismjs-vendor.3665b250.eec550b5.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.a81a7d65.e53936ae.js"></script><script defer="defer" src="./static/js/refractor-prismjs-vendor.0abbb2f3.4ed442e7.js"></script><script defer="defer" src="./static/js/react-vendor.7038eeb0.js"></script><script defer="defer" src="./static/js/main.d58d0924.js"></script><link href="./static/css/main.020a7543.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
2 changes: 1 addition & 1 deletion lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
53 changes: 49 additions & 4 deletions lcov-report/src/Container.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,22 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<a name='L44'></a><a href='#L44'>44</a>
<a name='L45'></a><a href='#L45'>45</a>
<a name='L46'></a><a href='#L46'>46</a>
<a name='L47'></a><a href='#L47'>47</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<a name='L47'></a><a href='#L47'>47</a>
<a name='L48'></a><a href='#L48'>48</a>
<a name='L49'></a><a href='#L49'>49</a>
<a name='L50'></a><a href='#L50'>50</a>
<a name='L51'></a><a href='#L51'>51</a>
<a name='L52'></a><a href='#L52'>52</a>
<a name='L53'></a><a href='#L53'>53</a>
<a name='L54'></a><a href='#L54'>54</a>
<a name='L55'></a><a href='#L55'>55</a>
<a name='L56'></a><a href='#L56'>56</a>
<a name='L57'></a><a href='#L57'>57</a>
<a name='L58'></a><a href='#L58'>58</a>
<a name='L59'></a><a href='#L59'>59</a>
<a name='L60'></a><a href='#L60'>60</a>
<a name='L61'></a><a href='#L61'>61</a>
<a name='L62'></a><a href='#L62'>62</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand Down Expand Up @@ -154,6 +169,21 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">import React, { forwardRef, useId } from 'react';
import { NestedClose } from './comps/NestedClose';
Expand Down Expand Up @@ -193,8 +223,23 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
};
return (
&lt;div className={defaultClassNames} ref={ref} {...elmProps} {...reset}&gt;
&lt;NestedOpen expandKey={subkeyid} value={value} level={level} keyName={keyName} initialValue={initialValue} /&gt;
&lt;KeyValues expandKey={subkeyid} value={value} level={level} keys={keys} /&gt;
&lt;NestedOpen
expandKey={subkeyid}
value={value}
level={level}
keys={keys}
parentValue={parentValue}
keyName={keyName}
initialValue={initialValue}
/&gt;
&lt;KeyValues
expandKey={subkeyid}
value={value}
level={level}
keys={keys}
parentValue={parentValue}
keyName={keyName}
/&gt;
&lt;NestedClose expandKey={subkeyid} value={value} level={level} /&gt;
&lt;/div&gt;
);
Expand All @@ -208,7 +253,7 @@ <h1><a href="../index.html">All files</a> / <a href="index.html">src</a> Contain
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/TriangleArrow.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/arrow</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/TriangleSolidArrow.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/arrow</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion lcov-report/src/arrow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1><a href="../../index.html">All files</a> src/arrow</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
46 changes: 23 additions & 23 deletions lcov-report/src/comps/Copied.tsx.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,17 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">22x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">1293x</span>
<span class="cline-any cline-yes">1291x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
<span class="cline-any cline-yes">6x</span>
Expand All @@ -203,31 +202,32 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">37x</span>
<span class="cline-any cline-yes">32x</span>
<span class="cline-any cline-yes">35x</span>
<span class="cline-any cline-yes">30x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-yes">27x</span>
<span class="cline-any cline-yes">25x</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
Expand All @@ -240,21 +240,20 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
import { useShowToolsStore } from '../store/ShowTools';
import { useSectionStore } from '../store/Section';
import { type TagType } from '../store/Types';
import { type SectionElementResult } from '../store/Section';
&nbsp;
export type CopiedOption&lt;T extends object&gt; = {
value?: T;
copied: boolean;
setCopied: React.Dispatch&lt;React.SetStateAction&lt;boolean&gt;&gt;;
};
&nbsp;
export interface CopiedProps&lt;T extends object&gt; extends React.SVGProps&lt;SVGSVGElement&gt; {
value?: T;
keyName: string | number;
export interface CopiedProps&lt;T extends object&gt; extends React.SVGProps&lt;SVGSVGElement&gt;, SectionElementResult&lt;T&gt; {
expandKey: string;
}
&nbsp;
export const Copied = &lt;T extends object, K extends TagType&gt;(props: CopiedProps&lt;T&gt;) =&gt; {
const { keyName, value, expandKey, ...other } = props;
const { keyName, value, parentValue, expandKey, keys, ...other } = props;
const { onCopied, enableClipboard } = useStore();
const showTools = useShowToolsStore();
const isShowTools = showTools[expandKey];
Expand Down Expand Up @@ -304,7 +303,8 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
} as React.SVGProps&lt;SVGSVGElement&gt;;
const isRender = render &amp;&amp; typeof render === 'function';
const child =
isRender &amp;&amp; render({ ...elmProps, 'data-copied': copied } as React.HTMLAttributes&lt;K&gt;, { value, keyName });
isRender &amp;&amp;
render({ ...elmProps, 'data-copied': copied } as React.HTMLAttributes&lt;K&gt;, { value, keyName, keys, parentValue });
if (child) return child;
if (copied) {
return (
Expand All @@ -328,7 +328,7 @@ <h1><a href="../../index.html">All files</a> / <a href="index.html">src/comps</a
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2024-02-26T05:10:55.321Z
at 2024-02-29T08:53:45.489Z
</div>
<script src="../../prettify.js"></script>
<script>
Expand Down
Loading

0 comments on commit 3b4ecf3

Please sign in to comment.