@microlink/react-json-view 1.19.1 → 1.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts ADDED
@@ -0,0 +1,301 @@
1
+ import * as React from 'react';
2
+
3
+ export interface ReactJsonViewProps {
4
+ /**
5
+ * This property contains your input JSON.
6
+ *
7
+ * Required.
8
+ */
9
+ src: object;
10
+ /**
11
+ * Contains the name of your root node. Use null or false for no name.
12
+ *
13
+ * Default: "root"
14
+ */
15
+ name?: string | null | false;
16
+ /**
17
+ * RJV supports base-16 themes. Check out the list of supported themes in the demo.
18
+ * A custom "rjv-default" theme applies by default.
19
+ *
20
+ * Default: "rjv-default"
21
+ */
22
+ theme?: ThemeKeys | ThemeObject;
23
+ /**
24
+ * Style attributes for react-json-view container.
25
+ * Explicit style attributes will override attributes provided by a theme.
26
+ *
27
+ * Default: "rjv-default"
28
+ */
29
+ style?: React.CSSProperties;
30
+ /**
31
+ * Style of expand/collapse icons. Accepted values are "circle", triangle" or "square".
32
+ *
33
+ * Default: {}
34
+ */
35
+ iconStyle?: 'circle' | 'triangle' | 'square';
36
+ /**
37
+ * Set the indent-width for nested objects.
38
+ *
39
+ * Default: 4
40
+ */
41
+ indentWidth?: number;
42
+ /**
43
+ * When set to true, all nodes will be collapsed by default.
44
+ * Use an integer value to collapse at a particular depth.
45
+ *
46
+ * Default: false
47
+ */
48
+ collapsed?: boolean | number;
49
+ /**
50
+ * When an integer value is assigned, strings will be cut off at that length.
51
+ * Collapsed strings are followed by an ellipsis.
52
+ * String content can be expanded and collapsed by clicking on the string value.
53
+ *
54
+ * Default: false
55
+ */
56
+ collapseStringsAfterLength?: number | false;
57
+ /**
58
+ * Callback function to provide control over what objects and arrays should be collapsed by default.
59
+ * An object is passed to the callback containing name, src, type ("array" or "object") and namespace.
60
+ *
61
+ * Default: false
62
+ */
63
+ shouldCollapse?: false | ((field: CollapsedFieldProps) => boolean);
64
+ /**
65
+ * When an integer value is assigned, arrays will be displayed in groups by count of the value.
66
+ * Groups are displayed with brakcet notation and can be expanded and collapsed by clickong on the brackets.
67
+ *
68
+ * Default: 100
69
+ */
70
+ groupArraysAfterLength?: number;
71
+ /**
72
+ * When prop is not false, the user can copy objects and arrays to clipboard by clicking on the clipboard icon.
73
+ * Copy callbacks are supported.
74
+ *
75
+ * Default: true
76
+ */
77
+ enableClipboard?: boolean | ((copy: OnCopyProps) => void);
78
+ /**
79
+ * When set to true, objects and arrays are labeled with size.
80
+ *
81
+ * Default: true
82
+ */
83
+ displayObjectSize?: boolean;
84
+ /**
85
+ * When set to true, data type labels prefix values.
86
+ *
87
+ * Default: true
88
+ */
89
+ displayDataTypes?: boolean;
90
+ /**
91
+ * set to false to remove quotes from keys (eg. "name": vs. name:)
92
+ *
93
+ * Default: true
94
+ */
95
+ quotesOnKeys?: boolean;
96
+ /**
97
+ * When a callback function is passed in, edit functionality is enabled.
98
+ * The callback is invoked before edits are completed. Returning false
99
+ * from onEdit will prevent the change from being made. see: onEdit docs.
100
+ *
101
+ * Default: false
102
+ */
103
+ onEdit?: ((edit: InteractionProps) => false | any) | false;
104
+ /**
105
+ * When a callback function is passed in, add functionality is enabled.
106
+ * The callback is invoked before additions are completed.
107
+ * Returning false from onAdd will prevent the change from being made. see: onAdd docs
108
+ *
109
+ * Default: false
110
+ */
111
+ onAdd?: ((add: InteractionProps) => false | any) | false;
112
+ /**
113
+ * When a callback function is passed in, delete functionality is enabled.
114
+ * The callback is invoked before deletions are completed.
115
+ * Returning false from onDelete will prevent the change from being made. see: onDelete docs
116
+ *
117
+ * Default: false
118
+ */
119
+ onDelete?: ((del: InteractionProps) => false | any) | false;
120
+ /**
121
+ * When a function is passed in, clicking a value triggers the onSelect method to be called.
122
+ *
123
+ * Default: false
124
+ */
125
+ onSelect?: ((select: OnSelectProps) => void) | false;
126
+ /**
127
+ * Custom message for validation failures to onEdit, onAdd, or onDelete callbacks.
128
+ *
129
+ * Default: "Validation Error"
130
+ */
131
+ validationMessage?: string;
132
+ /**
133
+ * Set to true to sort object keys.
134
+ *
135
+ * Default: false
136
+ */
137
+ sortKeys?: boolean;
138
+ /**
139
+ * Set to a value to be used as defaultValue when adding new key to json
140
+ *
141
+ * Default: null
142
+ */
143
+ defaultValue?: TypeDefaultValue | TypeDefaultValue[] | null;
144
+ /**
145
+ * Whether to select the textarea contents on edit
146
+ *
147
+ * Default: false
148
+ */
149
+ selectOnFocus?: boolean;
150
+ /**
151
+ * The key modifier to be combined with a click on JSON values to edit them
152
+ *
153
+ * Default: (e) => e.metaKey || e.ctrlKey
154
+ */
155
+ keyModifier?: (event: Event, type: 'edit' | 'submit') => boolean;
156
+ }
157
+
158
+ export interface OnCopyProps {
159
+ /**
160
+ * The JSON tree source object
161
+ */
162
+ src: object;
163
+ /**
164
+ * List of keys.
165
+ */
166
+ namespace: Array<string | null>;
167
+ /**
168
+ * The last key in the namespace array.
169
+ */
170
+ name: string | null;
171
+ }
172
+
173
+ export interface CollapsedFieldProps {
174
+ /**
175
+ * The name of the entry.
176
+ */
177
+ name: string | null;
178
+ /**
179
+ * The corresponding JSON subtree.
180
+ */
181
+ src: object;
182
+ /**
183
+ * The type of src. Can only be "array" or "object".
184
+ */
185
+ type: 'array' | 'object';
186
+ /**
187
+ * The scopes above the current entry.
188
+ */
189
+ namespace: Array<string | null>;
190
+ }
191
+
192
+ export interface InteractionProps {
193
+ /**
194
+ * The updated subtree of the JSON tree.
195
+ */
196
+ updated_src: object;
197
+ /**
198
+ * The existing subtree of the JSON tree.
199
+ */
200
+ existing_src: object;
201
+ /**
202
+ * The key of the entry that is interacted with.
203
+ */
204
+ name: string | null;
205
+ /**
206
+ * List of keys.
207
+ */
208
+ namespace: Array<string | null>;
209
+ /**
210
+ * The original value of the entry that is interacted with.
211
+ */
212
+ existing_value: object | string | number | boolean | null;
213
+ /**
214
+ * The updated value of the entry that is interacted with.
215
+ */
216
+ new_value?: object | string | number | boolean | null;
217
+ }
218
+
219
+ export interface OnSelectProps {
220
+ /**
221
+ * The name of the currently selected entry.
222
+ */
223
+ name: string | null;
224
+ /**
225
+ * The value of the currently selected entry.
226
+ */
227
+ value: object | string | number | boolean | null;
228
+ /**
229
+ * The type of the value. For "number" type, it will be replaced with the more
230
+ * accurate types: "float", "integer", or "nan".
231
+ */
232
+ type: string;
233
+ /**
234
+ * List of keys representing the scopes above the selected entry.
235
+ */
236
+ namespace: Array<string | null>;
237
+
238
+ }
239
+
240
+ export type TypeDefaultValue = string | number | boolean | object;
241
+
242
+ export interface ThemeObject {
243
+ base00: string;
244
+ base01: string;
245
+ base02: string;
246
+ base03: string;
247
+ base04: string;
248
+ base05: string;
249
+ base06: string;
250
+ base07: string;
251
+ base08: string;
252
+ base09: string;
253
+ base0A: string;
254
+ base0B: string;
255
+ base0C: string;
256
+ base0D: string;
257
+ base0E: string;
258
+ base0F: string;
259
+ }
260
+
261
+ export type ThemeKeys =
262
+ | 'apathy'
263
+ | 'apathy:inverted'
264
+ | 'ashes'
265
+ | 'bespin'
266
+ | 'brewer'
267
+ | 'bright:inverted'
268
+ | 'bright'
269
+ | 'chalk'
270
+ | 'codeschool'
271
+ | 'colors'
272
+ | 'eighties'
273
+ | 'embers'
274
+ | 'flat'
275
+ | 'google'
276
+ | 'grayscale'
277
+ | 'grayscale:inverted'
278
+ | 'greenscreen'
279
+ | 'harmonic'
280
+ | 'hopscotch'
281
+ | 'isotope'
282
+ | 'marrakesh'
283
+ | 'mocha'
284
+ | 'monokai'
285
+ | 'ocean'
286
+ | 'paraiso'
287
+ | 'pop'
288
+ | 'railscasts'
289
+ | 'rjv-default'
290
+ | 'shapeshifter'
291
+ | 'shapeshifter:inverted'
292
+ | 'solarized'
293
+ | 'summerfruit'
294
+ | 'summerfruit:inverted'
295
+ | 'threezerotwofour'
296
+ | 'tomorrow'
297
+ | 'tube'
298
+ | 'twilight';
299
+
300
+ declare const ReactJson: React.ComponentType<ReactJsonViewProps>;
301
+ export default ReactJson;
package/package.json CHANGED
@@ -1,18 +1,160 @@
1
1
  {
2
2
  "name": "@microlink/react-json-view",
3
3
  "description": "Interactive react component for displaying javascript arrays and JSON objects.",
4
- "homepage": "https://github.com/mac-s-g/react-json-view",
5
- "version": "1.19.1",
4
+ "homepage": "https://github.com/microlinkhq/react-json-view",
5
+ "version": "1.22.2",
6
6
  "main": "dist/main.js",
7
7
  "author": {
8
8
  "name": "Mac Gainor"
9
9
  },
10
+ "contributors": [
11
+ {
12
+ "name": "mac",
13
+ "email": "mac.gainor@gmail.com"
14
+ },
15
+ {
16
+ "name": "Brad Adams",
17
+ "email": "hi@breadadams.com"
18
+ },
19
+ {
20
+ "name": "Kiko Beats",
21
+ "email": "josefrancisco.verdu@gmail.com"
22
+ },
23
+ {
24
+ "name": "Xuefei Li",
25
+ "email": "frankvsense@gmail.com"
26
+ },
27
+ {
28
+ "name": "Caina Leao",
29
+ "email": "caina.leao@endemolshine.com"
30
+ },
31
+ {
32
+ "name": "Tom McLaughlin",
33
+ "email": "tom@codedown.io"
34
+ },
35
+ {
36
+ "name": "Andy Baird",
37
+ "email": "andy@threadsculture.com"
38
+ },
39
+ {
40
+ "name": "Daniel Santos",
41
+ "email": "dsantosp12@gmail.com"
42
+ },
43
+ {
44
+ "name": "mac-s-g",
45
+ "email": "mac@conversica.com"
46
+ },
47
+ {
48
+ "name": "Pravdomil",
49
+ "email": "pravdomil.toman@gmail.com"
50
+ },
51
+ {
52
+ "name": "jorgejar",
53
+ "email": "jorge.jaramillo@docker.com"
54
+ },
55
+ {
56
+ "name": "superfaz",
57
+ "email": "16510828+superfaz@users.noreply.github.com"
58
+ },
59
+ {
60
+ "name": "Varad Chemburkar",
61
+ "email": "vhc1992@gmail.com"
62
+ },
63
+ {
64
+ "name": "Jason Etcovitch",
65
+ "email": "jasonetco@gmail.com"
66
+ },
67
+ {
68
+ "name": "John Arthur",
69
+ "email": "thorjarhun@users.noreply.github.com"
70
+ },
71
+ {
72
+ "name": "Jack",
73
+ "email": "jackdh@users.noreply.github.com"
74
+ },
75
+ {
76
+ "name": "Guillaume FORTAINE",
77
+ "email": "guillaume.fortaine@ingenico.com"
78
+ },
79
+ {
80
+ "name": "Michael Reynolds",
81
+ "email": "michael.reynolds@paybase.io"
82
+ },
83
+ {
84
+ "name": "Oleg Proskurin",
85
+ "email": "regx@usul.su"
86
+ },
87
+ {
88
+ "name": "EvertE",
89
+ "email": "evert.etienne@sitemark.com"
90
+ },
91
+ {
92
+ "name": "REDMOND\\xuefl",
93
+ "email": "xuefl@microsoft.com"
94
+ },
95
+ {
96
+ "name": "Rubens Mariuzzo",
97
+ "email": "rubens@mariuzzo.com"
98
+ },
99
+ {
100
+ "name": "Ryan Haywood",
101
+ "email": "ryan@ryanhaywood.com"
102
+ },
103
+ {
104
+ "name": "Taylor Birkeland",
105
+ "email": "tabirkeland@gmail.com"
106
+ },
107
+ {
108
+ "name": "Dheeraj Yennam",
109
+ "email": "dyennam@gmail.com"
110
+ },
111
+ {
112
+ "name": "Uzi Kilon",
113
+ "email": "uzikilon@users.noreply.github.com"
114
+ },
115
+ {
116
+ "name": "Aaron Cunnington",
117
+ "email": "azcn2503@gmail.com"
118
+ },
119
+ {
120
+ "name": "DELORD Vincent",
121
+ "email": "vincent.delord@renault.com"
122
+ },
123
+ {
124
+ "name": "casey langen",
125
+ "email": "clangen@nerdwallet.com"
126
+ },
127
+ {
128
+ "name": "Craig Kochis",
129
+ "email": "cjkochis@gmail.com"
130
+ },
131
+ {
132
+ "name": "Cai Leao",
133
+ "email": "cainaleaouk@users.noreply.github.com"
134
+ },
135
+ {
136
+ "name": "Bob Thomas",
137
+ "email": "BThomas@tripwire.com"
138
+ },
139
+ {
140
+ "name": "Ashwin Menkudle",
141
+ "email": "ashwinmenkudle@gmail.com"
142
+ },
143
+ {
144
+ "name": "shybyte",
145
+ "email": "ein@volloeko.de"
146
+ },
147
+ {
148
+ "name": "Jeremy Liberman",
149
+ "email": "mrleebo@msn.com"
150
+ }
151
+ ],
10
152
  "repository": {
11
153
  "type": "git",
12
- "url": "git+https://github.com/mac-s-g/react-json-view.git"
154
+ "url": "git+https://github.com/microlinkhq/react-json-view.git"
13
155
  },
14
156
  "bugs": {
15
- "url": "https://github.com/mac-s-g/react-json-view/issues"
157
+ "url": "https://github.com/microlinkhq/react-json-view/issues"
16
158
  },
17
159
  "keywords": [
18
160
  "array-viewer",
@@ -37,72 +179,72 @@
37
179
  "treeview"
38
180
  ],
39
181
  "dependencies": {
40
- "flux": "^3.1.3",
41
- "react-base16-styling": "^0.6.0",
42
- "react-lifecycles-compat": "^3.0.4",
43
- "react-textarea-autosize": "^6.1.0"
182
+ "flux": "~4.0.1",
183
+ "react-base16-styling": "~0.6.0",
184
+ "react-lifecycles-compat": "~3.0.4",
185
+ "react-textarea-autosize": "~8.3.2"
44
186
  },
45
187
  "devDependencies": {
46
- "babel-core": "^6.26.3",
47
- "babel-eslint": "^8.2.5",
48
- "babel-loader": "^7.1.4",
49
- "babel-plugin-react-html-attrs": "^2.0.0",
50
- "babel-plugin-transform-class-properties": "^6.24.1",
51
- "babel-plugin-transform-function-bind": "^6.22.0",
52
- "babel-plugin-transform-node-env-inline": "^0.2.0",
53
- "babel-preset-es2015": "^6.24.1",
54
- "babel-preset-react": "^6.24.1",
55
- "babel-preset-stage-0": "^6.24.1",
56
- "chai": "^4.1.2",
57
- "coveralls": "^3.0.1",
58
- "css-loader": "^0.28.11",
59
- "enzyme": "^3.2.0",
60
- "enzyme-adapter-react-16": "^1.1.1",
61
- "eslint": "^5.0.1",
62
- "eslint-plugin-babel": "^5.1.0",
63
- "eslint-plugin-react": "^7.10.0",
64
- "html-webpack-plugin": "2.30.1",
65
- "ignore-styles": "^5.0.1",
66
- "istanbul": "^0.4.5",
67
- "jsdom": "^11.11.0",
68
- "mocha": "^4.0.1",
69
- "moment": "^2.22.2",
70
- "node-sass": "^4.9.0",
71
- "nyc": "^11.9.0",
72
- "react": "^16.4.0",
73
- "react-dom": "^16.4.0",
74
- "react-github-button": "^0.1.11",
75
- "react-hot-loader": "^3.0.0-beta.6",
76
- "react-select": "^1.1.0",
77
- "react-test-renderer": "^16.4.0",
78
- "sass-loader": "^6.0.7",
79
- "sinon": "^4.5.0",
80
- "style-loader": "^0.18.2",
81
- "webpack": "^3.12.0",
82
- "webpack-bundle-size-analyzer": "^2.7.0",
83
- "webpack-dev-server": "^2.11.2"
188
+ "@babel/core": "^7.13.0",
189
+ "@babel/eslint-parser": "~7.12.1",
190
+ "@babel/plugin-syntax-class-properties": "~7.12.1",
191
+ "@babel/plugin-syntax-jsx": "~7.12.1",
192
+ "@babel/register": "7.12.10",
193
+ "babel-plugin-react-html-attrs": "~2.1.0",
194
+ "chai": "~4.2.0",
195
+ "css-loader": "~4.3.0",
196
+ "enzyme": "~3.2.0",
197
+ "enzyme-adapter-react-16": "~1.15.5",
198
+ "eslint": "~7.16.0",
199
+ "eslint-plugin-prettier": "~3.3.1",
200
+ "eslint-plugin-react": "~7.21.5",
201
+ "html-webpack-plugin": "^4.5.2",
202
+ "ignore-styles": "~5.0.1",
203
+ "jsdom": "~16.4.0",
204
+ "mocha": "~8.2.1",
205
+ "moment": "~2.29.1",
206
+ "nyc": "~15.1.0",
207
+ "prettier": "~2.2.1",
208
+ "react": "~16.14.0",
209
+ "react-dom": "~16.14.0",
210
+ "react-github-button": "~0.1.11",
211
+ "react-hot-loader": "~4.13.0",
212
+ "react-scripts": "4.0.3",
213
+ "react-select": "~1.1.0",
214
+ "react-test-renderer": "~16.14.0",
215
+ "sass": "~1.47.0",
216
+ "sass-loader": "~10.1.1",
217
+ "sinon": "~9.2.3",
218
+ "style-loader": "~1.3.0",
219
+ "typescript": "^4.5.4",
220
+ "webpack": "~4.46.0",
221
+ "webpack-bundle-analyzer": "~3.9.0",
222
+ "webpack-bundle-size-analyzer": "~3.1.0",
223
+ "webpack-cli": "~3.3.12",
224
+ "webpack-dev-server": "~3.11.2"
84
225
  },
85
226
  "files": [
86
- "dist"
227
+ "dist",
228
+ "index.d.ts"
87
229
  ],
230
+ "license": "MIT",
231
+ "peerDependencies": {
232
+ "react": ">= 15",
233
+ "react-dom": ">= 15"
234
+ },
88
235
  "scripts": {
89
- "build": "webpack --config webpack/webpack.config.js -p --display-error-details --progress --optimize-minimize",
90
- "build:demo": "webpack --config webpack/webpack.config-demo.js -p --display-error-details --progress --optimize-minimize",
91
- "dev": "webpack-dev-server --config webpack/webpack.config-dev.js --open",
92
- "lint": "./node_modules/.bin/eslint src",
93
- "lint-fixup": "./node_modules/.bin/eslint src --ext .js,.jsx --fix",
236
+ "build": "NODE_ENV=production webpack --config webpack/webpack.config.js -p --display-error-details --progress --optimize-minimize",
237
+ "build:demo": "NODE_ENV=production webpack --config webpack/webpack.config-demo.js -p --display-error-details --progress --optimize-minimize",
238
+ "dev": "NODE_ENV=development webpack-dev-server --config webpack/webpack.config-dev.js --open",
239
+ "lint": "NODE_ENV=test ./node_modules/.bin/eslint src",
240
+ "lint-fixup": "NODE_ENV=test ./node_modules/.bin/eslint src --ext .js,.jsx --fix",
94
241
  "modules:debug": "./docker/debug.sh",
95
242
  "modules:size-analyzer": "webpack --config webpack/webpack.config.js --json | webpack-bundle-size-analyzer",
96
243
  "modules:tree": "webpack --config webpack/webpack.config.js --json ",
97
- "prebuild": "npm run test:unit",
98
- "test": "npm run test:unit && npm run test:coverage",
99
- "test:coverage": "nyc report --reporter=text-lcov | coveralls",
100
- "test:unit": "nyc mocha test/**/*-test.js",
101
- "test:watch": "nyc mocha -w test/**/*-test.js"
102
- },
103
- "license": "MIT",
104
- "peerDependencies": {
105
- "react": "^17.0.0 || ^16.0.0 || ^15.5.4",
106
- "react-dom": "^17.0.0 || ^16.0.0 || ^15.5.4"
244
+ "prebuild": "NODE_ENV=test npm run test:unit",
245
+ "test": "npm run test:coverage",
246
+ "test:coverage": "NODE_ENV=test nyc --reporter=text-lcov mocha test/**/*-test.js",
247
+ "test:unit": "NODE_ENV=test nyc mocha test/**/*-test.js",
248
+ "test:watch": "NODE_ENV=test nyc mocha -w test/**/*-test.js"
107
249
  }
108
- }
250
+ }