Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@rollup/plugin-commonjs": "^22.0.1",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/jest": "^28.1.6",
"@types/lodash": "^4.14.197",
"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"eslint": "^8.21.0",
Expand All @@ -39,7 +40,7 @@
"jest": "^28.1.3",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-admin": "^4.2.5",
"react-admin": "4.7.6",
"react-dom": "^18.2.0",
"rollup": "^2.77.2",
"rollup-plugin-delete": "^2.0.0",
Expand All @@ -50,10 +51,11 @@
},
"peerDependencies": {
"react": "*",
"react-admin": "*",
"react-admin": "4.7.6",
"react-dom": "*"
},
"dependencies": {
"lodash": "^4.17.21",
"react-json-view": "^1.21.3"
}
}
3 changes: 2 additions & 1 deletion src/JsonField.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react";
import { FieldProps, useRecordContext } from "react-admin";
import ReactJson, { ReactJsonViewProps } from "react-json-view";
import { get } from "lodash";

type Props = {
source: string;
Expand All @@ -15,7 +16,7 @@ export const JsonField: React.FC<Props> = ({
}) => {
const record = useRecordContext();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all components use a pattern

const record = useRecordContext(props);

this allows passing record={{override: ...}} with <FunctionField> this enabled pretty much any type of transformation

get(record, source) doesn't compose with jsonString being done a line below

anyway this seems like a dead repo :/


let src = record[source];
let src = get(record, source);

if (jsonString) {
src = JSON.parse(src);
Expand Down
81 changes: 49 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,11 @@
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==

"@types/lodash@^4.14.197":
version "4.14.197"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.197.tgz#e95c5ddcc814ec3e84c891910a01e0c8a378c54b"
integrity sha512-BMVOiWs0uNxHVlHBgzTIqJYmj+PgCo4euloGF+5m4okL3rEYzM2EEv78mw8zWSMM57dM7kVIgJ2QDvwHSoCI5g==

"@types/minimatch@*":
version "3.0.5"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40"
Expand Down Expand Up @@ -1627,6 +1632,11 @@ dom-helpers@^5.0.1:
"@babel/runtime" "^7.8.7"
csstype "^3.0.2"

dompurify@^2.4.3:
version "2.4.7"
resolved "https://registry.yarnpkg.com/dompurify/-/dompurify-2.4.7.tgz#277adeb40a2c84be2d42a8bcd45f582bfa4d0cfc"
integrity sha512-kxxKlPEDa6Nc5WJi+qRgPbOAbgTpSULL+vI3NUXsZMlkJxTqYI9wg5ZTay2sFrdZRWHPWNi+EdAhcJf81WtoMQ==

electron-to-chromium@^1.4.202:
version "1.4.217"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.217.tgz#f1f51b319435f4c1587a850806a0dfebe9774598"
Expand Down Expand Up @@ -2253,6 +2263,11 @@ hoist-non-react-statics@^3.3.1:
dependencies:
react-is "^16.7.0"

hotscript@^1.0.12:
version "1.0.13"
resolved "https://registry.yarnpkg.com/hotscript/-/hotscript-1.0.13.tgz#6eb5de757e9b33444ffc22555e98dbc17fa31fb4"
integrity sha512-C++tTF1GqkGYecL+2S1wJTfoH6APGAsbb7PAWQ3iVIwgG/EFseAfEVOKFgAFq4yK3+6j1EjUD4UQ9dRJHX/sSQ==

html-escaper@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
Expand Down Expand Up @@ -2995,7 +3010,7 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==

lodash@~4.17.5:
lodash@^4.17.21, lodash@~4.17.5:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -3385,10 +3400,10 @@ queue-microtask@^1.2.2:
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==

ra-core@^4.2.7:
version "4.2.7"
resolved "https://registry.yarnpkg.com/ra-core/-/ra-core-4.2.7.tgz#56f23f6ab5c5eab9d09ea6d74c07d6daae2c60ea"
integrity sha512-DFrQXsajMv95d2juhXpArDz2I7FVU6x8YtaJpmGaFsClGYK3qcMOfE+duVFdxpihczsihg4YSPumsvNtdtlg6w==
ra-core@^4.13.0, ra-core@^4.7.6:
version "4.13.0"
resolved "https://registry.yarnpkg.com/ra-core/-/ra-core-4.13.0.tgz#afbb590f1db6b4856209e4adb576940c0b0d1136"
integrity sha512-CxMAWwlvJ/p4N9JwJu/mWXua5D08MwqcSBnUnSYyn9MBY1xmnKkeKrvqYqihJ8xAPwoVcsKfhnsbHfNfm3Fzcg==
dependencies:
clsx "^1.1.1"
date-fns "^2.19.0"
Expand All @@ -3401,29 +3416,31 @@ ra-core@^4.2.7:
react-is "^17.0.2"
react-query "^3.32.1"

ra-i18n-polyglot@^4.2.7:
version "4.2.7"
resolved "https://registry.yarnpkg.com/ra-i18n-polyglot/-/ra-i18n-polyglot-4.2.7.tgz#c6de4e73eece7f454635cb62a09f06360f4b1f5a"
integrity sha512-jCoGcMFCh6HZJ4PtGcFRtF80V+w6h8O3NIxXAyLAmAQWvmczyvA8ARFO3wR/PzbCbSRhlJSprL02poeFfC+fGQ==
ra-i18n-polyglot@^4.7.6:
version "4.13.0"
resolved "https://registry.yarnpkg.com/ra-i18n-polyglot/-/ra-i18n-polyglot-4.13.0.tgz#bd64862ea55b79c51e17acf57d7614bfcccc6cfd"
integrity sha512-Q5lpGGvN6PaoI7ZA42osw6gRfLH4DWT8rDSAG17B7fhii02SDev09R1Je5qXzlUP5ihju4oH9U7Risjod2Smgg==
dependencies:
node-polyglot "^2.2.2"
ra-core "^4.2.7"
ra-core "^4.13.0"

ra-language-english@^4.2.7:
version "4.2.7"
resolved "https://registry.yarnpkg.com/ra-language-english/-/ra-language-english-4.2.7.tgz#ec5ce1b66e37f87a30748dff84c1af182ddffaf2"
integrity sha512-Kp2VdgX5U1HkMS7UT5XnXz75KFCVGm/+vzoqKWG2I4EADXb3xEw2cIQ7P4eQnmK8it+DqU7V7zuNQMA3eYdAEA==
ra-language-english@^4.7.6:
version "4.13.0"
resolved "https://registry.yarnpkg.com/ra-language-english/-/ra-language-english-4.13.0.tgz#985a69316982551e65494e0da2ff8eb5ea595df8"
integrity sha512-DJPBNIFoLmGkY5t+CD93CUFmEpn9z3xC9fmudYnzOZ0pTuLOJ2q3V9gW25X7HGPKFxgtfph9rtPzFILDjSUa0g==
dependencies:
ra-core "^4.2.7"
ra-core "^4.13.0"

ra-ui-materialui@^4.2.7:
version "4.2.7"
resolved "https://registry.yarnpkg.com/ra-ui-materialui/-/ra-ui-materialui-4.2.7.tgz#17a88ab64bb13aa977153b8967f00602e542aeee"
integrity sha512-rXdVE0JwchjICxECYc266U5aGVMkeIvL9MG/SBsMK1ekKnIibwmyHwcKJnywPUQSiB6InLQI1v0p4WtJRNp2kg==
ra-ui-materialui@^4.7.6:
version "4.13.0"
resolved "https://registry.yarnpkg.com/ra-ui-materialui/-/ra-ui-materialui-4.13.0.tgz#066d481159a2658040b89d8d23a466caa5e8b158"
integrity sha512-zBUKPI6HvmFMm7Y2qxCGQU4vIziQ42Xi6gBCwF0VxNSYB5+uY8fsqKm8iV6HJk6WqnAyhR7QHSSdfDMA0viKhQ==
dependencies:
autosuggest-highlight "^3.1.1"
clsx "^1.1.1"
css-mediaquery "^0.1.2"
dompurify "^2.4.3"
hotscript "^1.0.12"
inflection "~1.12.0"
jsonexport "^3.2.0"
lodash "~4.17.5"
Expand All @@ -3434,21 +3451,21 @@ ra-ui-materialui@^4.2.7:
react-query "^3.32.1"
react-transition-group "^4.4.1"

react-admin@^4.2.5:
version "4.2.7"
resolved "https://registry.yarnpkg.com/react-admin/-/react-admin-4.2.7.tgz#09b9c7a8e3affd5e74fbd68028de90a40c375938"
integrity sha512-FqeGVbM91FMwBpjx43UjQnJZ7FStGq9wKvC/S8SPV9zzWRa4xwPCRIyj7LgmiRNCKdTnn9B1nR6cO0/Wrux3WQ==
react-admin@4.7.6:
version "4.7.6"
resolved "https://registry.yarnpkg.com/react-admin/-/react-admin-4.7.6.tgz#c188288bba0f69132ecd5e4f72685ae91031b478"
integrity sha512-rCWE5frfzZOA4rDPh5WohPUae5Nbefwqlx734H1X7YjlyjPrQAzRwY01LaE1DHk47HOwMpdm2DJodUAW+viX8g==
dependencies:
"@emotion/react" "^11.4.1"
"@emotion/styled" "^11.3.0"
"@mui/icons-material" "^5.0.1"
"@mui/material" "^5.0.2"
history "^5.1.0"
ra-core "^4.2.7"
ra-i18n-polyglot "^4.2.7"
ra-language-english "^4.2.7"
ra-ui-materialui "^4.2.7"
react-hook-form "^7.31.0"
ra-core "^4.7.6"
ra-i18n-polyglot "^4.7.6"
ra-language-english "^4.7.6"
ra-ui-materialui "^4.7.6"
react-hook-form "^7.40.0"
react-router "^6.1.0"
react-router-dom "^6.1.0"

Expand Down Expand Up @@ -3486,10 +3503,10 @@ react-error-boundary@^3.1.4:
dependencies:
"@babel/runtime" "^7.12.5"

react-hook-form@^7.31.0:
version "7.34.0"
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.34.0.tgz#22883b5e014e5c5e35f3061d0e3862153b0df2ec"
integrity sha512-s0/TJ09NVlEk2JPp3yit1WnMuPNBXFmUKEQPulgDi9pYBw/ZmmAFHe6AXWq73Y+kp8ye4OcMf0Jv+i/qLPektg==
react-hook-form@^7.40.0:
version "7.45.4"
resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.45.4.tgz#73d228b704026ae95d7e5f7b207a681b173ec62a"
integrity sha512-HGDV1JOOBPZj10LB3+OZgfDBTn+IeEsNOKiq/cxbQAIbKaiJUe/KV8DBUzsx0Gx/7IG/orWqRRm736JwOfUSWQ==

react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1"
Expand Down