JSV namespace for JSON Schema Viewer.
- Source:
Members
(static) baseSvg
Properties:
Name | Type | Description |
---|---|---|
baseSvg |
array | The base SVG element for the d3 diagram |
- Source:
(static) counter
Counter for generating unique ids
- Source:
(static) duration
The default duration of the node transitions
- Source:
(static) example
Currently loaded example
- Source:
(static) focusNode
Currently focused node
- Source:
(static) labels
Properties:
Name | Type | Description |
---|---|---|
labels |
object | Nodes to render as non-clickable in the tree. They will auto-expand if child nodes are present. |
- Source:
(static) maxDepth
Default maximum depth for recursive schemas
- Source:
(static) plain
If true, render diagram only on init, without the jQuery Mobile UI.
The legend and nav tools will be rendered with any event listeners.
- Source:
(static) schema
The root schema to load.
- Source:
(static) svgGroup
Properties:
Name | Type | Description |
---|---|---|
svgGroup |
array | SVG group which holds all nodes and which the zoom Listener can act upon. |
- Source:
(static) treeData
Properties:
Name | Type | Description |
---|---|---|
treeData |
object | The diagram nodes |
- Source:
(static) version
The version of the schema.
- Source:
(static) viewerHeight
The current viewer height
- Source:
(static) viewerInit
The initialization status of the viewer page
- Source:
(static) viewerWidth
The current viewer width
- Source:
(static) zoomListener
The zoomListener which calls the zoom function on the 'zoom' event constrained within the scaleExtents
- Source:
Methods
(static) buildSearchList()
Build Search.
- Source:
(static) buildValError(err, title)
Build a collapsible validation block.
Parameters:
Name | Type | Description |
---|---|---|
err |
object | The error object |
title |
string | The title for the error block |
- Source:
(static) centerNode()
Function to center node when clicked so node doesn't get lost when collapsing with large amount of children.
- Source:
(static) click()
Toggle children on node click.
- Source:
(static) clickTitle()
Show info on node title click.
- Source:
(static) collapse()
Helper functions for collapsing nodes.
- Source:
(static) compileData()
Create the tree data object from the schema(s)
- Source:
(static) compilePath()
Create a "breadcrumb" for the node.
- Source:
(static) contentHeight()
(Re)set the viewer page height, set the diagram dimensions.
- Source:
(static) createDiagram(callback)
Create the d3 diagram.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Function to run after the diagram is created |
- Source:
(static) createPre(el, obj, title, exp)
Create a *pre* block and append it to the passed element.
Parameters:
Name | Type | Description |
---|---|---|
el |
object | jQuery element |
obj |
object | The obj to stringify and display |
title |
string | The title for the new window |
exp |
string | The string to highlight |
- Source:
(static) diagonal1()
The d3 diagonal projection for use by the node paths.
- Source:
(static) expand()
Helper functions for expanding nodes.
- Source:
(static) expandNodePath()
Expand an index-based path for the node from the root.
- Source:
(static) flashNode()
Flash node text
- Source:
(static) getNodePath()
Create an index-based path for the node from the root.
- Source:
(static) init(config, callback)
Initializes the viewer.
Parameters:
Name | Type | Description |
---|---|---|
config |
object | The configuration. |
callback |
function | Function to run after schemas are loaded and diagram is created. |
- Source:
(static) interpolateZoom()
Perform the d3 zoom based on position and scale
- Source:
(static) loadInputExample()
Load an example in the specified input field.
- Source:
(static) resetTree()
Reset the tree starting from the passed source.
- Source:
(static) resetViewer()
Reset and center the tree.
- Source:
(static) resizeBtn(minSize)
Hides navbar button text on smaller window sizes.
Parameters:
Name | Type | Description |
---|---|---|
minSize |
number | The navbar width breakpoint. |
- Source:
(static) resizeViewer()
Resize the diagram
- Source:
(static) setInfo(node)
Set the content for the info panel.
Parameters:
Name | Type | Description |
---|---|---|
node |
object | The d3 tree node. |
- Source:
(static) setPermalink()
Create a "permalink" for the node.
- Source:
(static) setVersion(version)
Set version of the schema and the content
of any elemant with the class *schema-version*.
Parameters:
Name | Type | Description |
---|---|---|
version |
string |
- Source:
(static) showError(msg)
Display an error message.
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | The message to display. |
- Source:
(static) showValResult(result)
Display the validation result
Parameters:
Name | Type | Description |
---|---|---|
result |
object | A result object, ouput from validate |
- Source:
(static) sortTree()
Sort the tree according to the node names
- Source:
(static) toggleChildren()
Toggle children function
- Source:
(static) update()
Update the tree, removing or adding nodes from/to the passed source node
- Source:
(static) validate()
Validate using tv4 and currently loaded schema(s).
- Source:
(static) visit()
A recursive helper function for performing some setup by walking
through all nodes
- Source:
(static) zoom()
Zoom the tree
- Source:
(static) zoomClick()
Click handler for the zoom control
- Source: