-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
00272c1
commit 6e8b61d
Showing
6 changed files
with
48 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
import taipy as tp | ||
import taipy.gui.builder as tgb | ||
from taipy import Config, Orchestrator, Scope | ||
from taipy.gui import Gui | ||
import json | ||
|
||
# Sample JSON data for testing | ||
json_data = { | ||
"name": "Sample Data", | ||
"type": "Example JSON", | ||
"attributes": { | ||
"id": 123, | ||
"description": "A simple JSON structure for demonstration", | ||
"values": [1, 2, 3, 4, 5], | ||
"nested": { | ||
"flag": True, | ||
"count": 10 | ||
} | ||
} | ||
} | ||
json_config_node = Config.configure_json_data_node( | ||
id="json_node", | ||
default_path="./demo-1248-dn.json", | ||
scope=Scope.GLOBAL, | ||
) | ||
|
||
# Define the page with the JSON viewer | ||
page = """ | ||
<|{json_data}|json|expandable|> | ||
""" | ||
with tgb.Page() as data_node_viewer: | ||
tgb.html("h2", "Discovering Data Node JSON Viewer") | ||
tgb.data_node( | ||
data_node="{json_data_node}" | ||
) | ||
|
||
gui = Gui(page=data_node_viewer) | ||
|
||
if __name__ == "__main__": | ||
Gui(page).run(title="DataNode JSON Viewer Example") | ||
Orchestrator().run() | ||
json_data_node = tp.create_global_data_node(json_config_node) | ||
gui.run(title="1248 JSON Data Node") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// For Import of React Json Tree Lib | ||
|
||
declare module "react-json-tree" { | ||
import { ComponentType } from "react"; | ||
|
||
interface JSONTreeProps { | ||
data: any; | ||
shouldExpandNode?: (keyPath: (string | number)[], data: any, level: number) => boolean; | ||
hideRoot?: boolean; | ||
} | ||
|
||
const JSONTree: ComponentType<JSONTreeProps>; | ||
export = JSONTree; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import JSONTree from "react-json-tree"; | ||
|
||
export default JSONTree; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters