mrhertal / react-admin-json-view Goto Github PK
View Code? Open in Web Editor NEWJSON field and input for react-admin.
License: MIT License
JSON field and input for react-admin.
License: MIT License
It would be very helpful to support fields with stringified json. So unparsed to view and stringified after edit.
Hi @MrHertal!
Firstly, I would like to send you a big thank you for this project! I have a question related to this code. Can I use this project as a separate component in React app?
Hi, and thanks for publishing your work!
I'd be more inclined to use your library if I knew how it looks like, and what I risk by using your code...
Hi @MrHertal, just installed this module and it worked straight. This is awesome, (doesn't matter if you did not do the underlying library). I just wanted to say thank you for sharing this!
Installed and first use gets this error:
Failed to compile
Module not found: Can't resolve 'prop-types' in '/Users/seanonion/code/playground/demosim-admin/ds-admin/node_modules/mini-create-react-context/dist/esm'
[Issue Description]
Currently, the JsonField component in React-Admin does not handle the current theme properly. When a dark theme is set, the text within the JsonField appears black, making it extremely difficult to read. This issue affects the readability of the JsonField component, limiting its usability to only the white theme.
[Proposed Improvement]
JsonField should be updated to ensure proper handling of the current theme in React-Admin. Specifically, when a dark theme is applied, the text within the JsonField should be adjusted to a more readable color, allowing users to view the content regardless of the selected theme. This enhancement will improve the overall usability and accessibility of the JsonField component in different theme settings.
If I pass a defaultValue to the component then also I see an empty object.
The JsonInput should respect the defaultValue passed.
What did you want to do
I wanted to pass a dot notation string to JsonField component
<JsonField source="source.nested" />
What did you expect
I expected to have my nested component displayed correctly
What happened instead
It displays "root":{}
I don't know if this a bug, a upcoming feature or a wanted behavior, but the strange thing is that I have no problem with the JsonInput component using dot notation.
I expected to be able to pass a subset of reactJsonOptions
in TypeScipt, e.g.:
<JsonField
source="example"
reactJsonOptions={{
name: null
}}
/>
however the props declaration for the options is inaccurate resulting in a type-checking error:
error TS2741: Property 'src' is missing in type '{ name: null; }' but required in type 'ReactJsonViewProps'.
The upstream props get re-used here:
react-admin-json-view/src/JsonInput.tsx
Line 13 in d34b25f
src
is declared required here: https://github.com/mac-s-g/react-json-view/blob/2feadcec5e1878f4f9319a2742d51b75d519c4dc/index.d.ts#L9I have a nested object in my record, like this:
{
id: "abcdef",
info: {
tree: {
x: 1,
y: 2
}
}
}
Now if I use the JSON view components and put source="info.tree"
it doesn't work as the component looks for record[source]
. The React Admin native fields and inputs use lodash to resolve nested location:
import get from 'lodash/get';
...
const value = get(record, source);
Could you incorporate this into the field and input?
mac-s-g/react-json-view is no longer being maintained.
The original maintainer has been recommending to switch to this fork : microlinkhq/react-json-view
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.