@uiw/react-json-view 2.0.0-alpha.4 → 2.0.0-alpha.41
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/README.md +280 -39
- package/basic.d.ts +4 -0
- package/cjs/Container.d.ts +2 -0
- package/cjs/Container.js +15 -6
- package/cjs/arrow/TriangleArrow.js +1 -1
- package/cjs/comps/Copied.d.ts +3 -4
- package/cjs/comps/Copied.js +61 -18
- package/cjs/comps/KeyValues.d.ts +2 -4
- package/cjs/comps/KeyValues.js +73 -28
- package/cjs/comps/NestedClose.d.ts +2 -2
- package/cjs/comps/NestedClose.js +42 -12
- package/cjs/comps/NestedOpen.d.ts +2 -3
- package/cjs/comps/NestedOpen.js +42 -20
- package/cjs/comps/Value.d.ts +2 -2
- package/cjs/comps/Value.js +5 -7
- package/cjs/comps/useIdCompat.d.ts +1 -0
- package/cjs/comps/useIdCompat.js +14 -0
- package/cjs/editor/KeyName.d.ts +2 -0
- package/cjs/editor/KeyName.js +82 -0
- package/cjs/editor/index.d.ts +18 -0
- package/cjs/editor/index.js +44 -0
- package/cjs/editor/store.d.ts +27 -0
- package/cjs/editor/store.js +23 -0
- package/cjs/index.d.ts +26 -4
- package/cjs/index.js +17 -7
- package/cjs/section/Copied.d.ts +4 -1
- package/cjs/section/Copied.js +1 -2
- package/cjs/section/CountInfo.d.ts +1 -2
- package/cjs/section/CountInfo.js +3 -5
- package/cjs/section/CountInfoExtra.d.ts +1 -2
- package/cjs/section/CountInfoExtra.js +2 -4
- package/cjs/section/Ellipsis.d.ts +0 -1
- package/cjs/section/Ellipsis.js +4 -5
- package/cjs/section/KeyName.d.ts +7 -6
- package/cjs/section/KeyName.js +8 -6
- package/cjs/section/Row.d.ts +13 -0
- package/cjs/section/Row.js +51 -0
- package/cjs/store/Expands.js +2 -4
- package/cjs/store/Section.d.ts +12 -6
- package/cjs/store/Section.js +6 -4
- package/cjs/store/ShowTools.js +2 -4
- package/cjs/store/Symbols.d.ts +10 -3
- package/cjs/store/Symbols.js +2 -4
- package/cjs/store/Types.d.ts +30 -25
- package/cjs/store/Types.js +8 -8
- package/cjs/store.d.ts +12 -6
- package/cjs/store.js +5 -10
- package/cjs/symbol/Arrow.d.ts +1 -1
- package/cjs/symbol/Arrow.js +1 -2
- package/cjs/symbol/BraceLeft.d.ts +1 -1
- package/cjs/symbol/BraceLeft.js +1 -2
- package/cjs/symbol/BraceRight.d.ts +1 -1
- package/cjs/symbol/BraceRight.js +1 -2
- package/cjs/symbol/BracketsLeft.d.ts +1 -1
- package/cjs/symbol/BracketsLeft.js +1 -2
- package/cjs/symbol/BracketsRight.d.ts +1 -1
- package/cjs/symbol/BracketsRight.js +1 -2
- package/cjs/symbol/Colon.d.ts +1 -1
- package/cjs/symbol/Colon.js +1 -2
- package/cjs/symbol/Quote.d.ts +1 -1
- package/cjs/symbol/Quote.js +1 -2
- package/cjs/symbol/ValueQuote.d.ts +1 -1
- package/cjs/symbol/ValueQuote.js +1 -2
- package/cjs/symbol/index.d.ts +12 -17
- package/cjs/symbol/index.js +82 -30
- package/cjs/theme/basic.d.ts +2 -2
- package/cjs/theme/basic.js +4 -3
- package/cjs/theme/dark.d.ts +2 -2
- package/cjs/theme/dark.js +2 -3
- package/cjs/theme/github.dark.d.ts +2 -2
- package/cjs/theme/github.dark.js +2 -3
- package/cjs/theme/github.light.d.ts +2 -2
- package/cjs/theme/github.light.js +2 -3
- package/cjs/theme/gruvbox.d.ts +2 -2
- package/cjs/theme/gruvbox.js +2 -3
- package/cjs/theme/light.d.ts +2 -2
- package/cjs/theme/light.js +2 -3
- package/cjs/theme/monokai.d.ts +2 -2
- package/cjs/theme/monokai.js +2 -3
- package/cjs/theme/nord.d.ts +2 -2
- package/cjs/theme/nord.js +2 -3
- package/cjs/theme/vscode.d.ts +2 -2
- package/cjs/theme/vscode.js +2 -3
- package/cjs/types/Bigint.d.ts +1 -1
- package/cjs/types/Bigint.js +1 -2
- package/cjs/types/Date.d.ts +1 -1
- package/cjs/types/Date.js +1 -2
- package/cjs/types/False.d.ts +1 -1
- package/cjs/types/False.js +1 -2
- package/cjs/types/Float.d.ts +1 -1
- package/cjs/types/Float.js +1 -2
- package/cjs/types/Int.d.ts +1 -1
- package/cjs/types/Int.js +1 -2
- package/cjs/types/Map.d.ts +1 -1
- package/cjs/types/Map.js +1 -2
- package/cjs/types/Nan.d.ts +1 -1
- package/cjs/types/Nan.js +1 -2
- package/cjs/types/Null.d.ts +1 -1
- package/cjs/types/Null.js +1 -2
- package/cjs/types/Set.d.ts +1 -1
- package/cjs/types/Set.js +1 -2
- package/cjs/types/String.d.ts +1 -1
- package/cjs/types/String.js +1 -2
- package/cjs/types/True.d.ts +1 -1
- package/cjs/types/True.js +1 -2
- package/cjs/types/Undefined.d.ts +1 -1
- package/cjs/types/Undefined.js +1 -2
- package/cjs/types/Url.d.ts +1 -1
- package/cjs/types/Url.js +1 -2
- package/cjs/types/index.d.ts +5 -2
- package/cjs/types/index.js +174 -166
- package/cjs/utils/useHighlight.d.ts +0 -1
- package/cjs/utils/useRender.d.ts +1 -1
- package/dark.d.ts +2 -1
- package/editor.d.ts +22 -20
- package/esm/Container.d.ts +2 -0
- package/esm/Container.js +21 -11
- package/esm/arrow/TriangleArrow.js +1 -1
- package/esm/comps/Copied.d.ts +3 -4
- package/esm/comps/Copied.js +61 -19
- package/esm/comps/KeyValues.d.ts +2 -4
- package/esm/comps/KeyValues.js +71 -27
- package/esm/comps/NestedClose.d.ts +2 -2
- package/esm/comps/NestedClose.js +40 -11
- package/esm/comps/NestedOpen.d.ts +2 -3
- package/esm/comps/NestedOpen.js +47 -26
- package/esm/comps/Value.d.ts +2 -2
- package/esm/comps/Value.js +3 -3
- package/esm/comps/useIdCompat.d.ts +1 -0
- package/esm/comps/useIdCompat.js +8 -0
- package/esm/editor/KeyName.d.ts +2 -0
- package/esm/editor/KeyName.js +77 -0
- package/esm/editor/index.d.ts +18 -0
- package/esm/editor/index.js +33 -0
- package/esm/editor/store.d.ts +27 -0
- package/esm/editor/store.js +13 -0
- package/esm/index.d.ts +26 -4
- package/esm/index.js +50 -41
- package/esm/section/Copied.d.ts +4 -1
- package/esm/section/Copied.js +2 -2
- package/esm/section/CountInfo.d.ts +1 -2
- package/esm/section/CountInfo.js +4 -4
- package/esm/section/CountInfoExtra.d.ts +1 -2
- package/esm/section/CountInfoExtra.js +2 -2
- package/esm/section/Ellipsis.d.ts +0 -1
- package/esm/section/Ellipsis.js +3 -3
- package/esm/section/KeyName.d.ts +7 -6
- package/esm/section/KeyName.js +8 -4
- package/esm/section/Row.d.ts +13 -0
- package/esm/section/Row.js +47 -0
- package/esm/store/Section.d.ts +12 -6
- package/esm/store/Section.js +4 -0
- package/esm/store/Symbols.d.ts +10 -3
- package/esm/store/Symbols.js +1 -1
- package/esm/store/Types.d.ts +30 -25
- package/esm/store/Types.js +6 -4
- package/esm/store.d.ts +12 -6
- package/esm/store.js +5 -5
- package/esm/symbol/Arrow.d.ts +1 -1
- package/esm/symbol/Arrow.js +2 -2
- package/esm/symbol/BraceLeft.d.ts +1 -1
- package/esm/symbol/BraceLeft.js +2 -2
- package/esm/symbol/BraceRight.d.ts +1 -1
- package/esm/symbol/BraceRight.js +2 -2
- package/esm/symbol/BracketsLeft.d.ts +1 -1
- package/esm/symbol/BracketsLeft.js +2 -2
- package/esm/symbol/BracketsRight.d.ts +1 -1
- package/esm/symbol/BracketsRight.js +2 -2
- package/esm/symbol/Colon.d.ts +1 -1
- package/esm/symbol/Colon.js +2 -2
- package/esm/symbol/Quote.d.ts +1 -1
- package/esm/symbol/Quote.js +2 -2
- package/esm/symbol/ValueQuote.d.ts +1 -1
- package/esm/symbol/ValueQuote.js +2 -2
- package/esm/symbol/index.d.ts +12 -17
- package/esm/symbol/index.js +85 -25
- package/esm/theme/basic.d.ts +2 -2
- package/esm/theme/basic.js +2 -0
- package/esm/theme/dark.d.ts +2 -2
- package/esm/theme/github.dark.d.ts +2 -2
- package/esm/theme/github.light.d.ts +2 -2
- package/esm/theme/gruvbox.d.ts +2 -2
- package/esm/theme/light.d.ts +2 -2
- package/esm/theme/monokai.d.ts +2 -2
- package/esm/theme/nord.d.ts +2 -2
- package/esm/theme/vscode.d.ts +2 -2
- package/esm/types/Bigint.d.ts +1 -1
- package/esm/types/Bigint.js +2 -2
- package/esm/types/Date.d.ts +1 -1
- package/esm/types/Date.js +2 -2
- package/esm/types/False.d.ts +1 -1
- package/esm/types/False.js +2 -2
- package/esm/types/Float.d.ts +1 -1
- package/esm/types/Float.js +2 -2
- package/esm/types/Int.d.ts +1 -1
- package/esm/types/Int.js +2 -2
- package/esm/types/Map.d.ts +1 -1
- package/esm/types/Map.js +2 -2
- package/esm/types/Nan.d.ts +1 -1
- package/esm/types/Nan.js +2 -2
- package/esm/types/Null.d.ts +1 -1
- package/esm/types/Null.js +2 -2
- package/esm/types/Set.d.ts +1 -1
- package/esm/types/Set.js +2 -2
- package/esm/types/String.d.ts +1 -1
- package/esm/types/String.js +2 -2
- package/esm/types/True.d.ts +1 -1
- package/esm/types/True.js +2 -2
- package/esm/types/Undefined.d.ts +1 -1
- package/esm/types/Undefined.js +2 -2
- package/esm/types/Url.d.ts +1 -1
- package/esm/types/Url.js +2 -2
- package/esm/types/index.d.ts +5 -2
- package/esm/types/index.js +148 -131
- package/esm/utils/useHighlight.d.ts +0 -1
- package/esm/utils/useRender.d.ts +1 -1
- package/esm/utils/useRender.js +3 -3
- package/githubDark.d.ts +4 -0
- package/githubLight.d.ts +4 -0
- package/gruvbox.d.ts +4 -0
- package/light.d.ts +2 -1
- package/monokai.d.ts +4 -0
- package/nord.d.ts +4 -0
- package/package.json +12 -6
- package/triangle-arrow.d.ts +2 -2
- package/triangle-solid-arrow.d.ts +2 -2
- package/vscode.d.ts +4 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.KeyNameRender = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _store = require("./store");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
var _excluded = ["children"],
|
|
15
|
+
_excluded2 = ["value", "parentValue", "keyName"];
|
|
16
|
+
var KeyNameRender = exports.KeyNameRender = function KeyNameRender(_ref, _ref2) {
|
|
17
|
+
var children = _ref.children,
|
|
18
|
+
reset = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
19
|
+
var value = _ref2.value,
|
|
20
|
+
parentValue = _ref2.parentValue,
|
|
21
|
+
keyName = _ref2.keyName;
|
|
22
|
+
if (typeof children === 'number') {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
24
|
+
children: children
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Child, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
28
|
+
value: value,
|
|
29
|
+
parentValue: parentValue,
|
|
30
|
+
keyName: keyName,
|
|
31
|
+
children: children
|
|
32
|
+
}));
|
|
33
|
+
};
|
|
34
|
+
var Child = function Child(props) {
|
|
35
|
+
var value = props.value,
|
|
36
|
+
parentValue = props.parentValue,
|
|
37
|
+
keyName = props.keyName,
|
|
38
|
+
reset = (0, _objectWithoutProperties2["default"])(props, _excluded2);
|
|
39
|
+
var $dom = (0, _react.useRef)(null);
|
|
40
|
+
var _useState = (0, _react.useState)(props.children),
|
|
41
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
42
|
+
currentValue = _useState2[0],
|
|
43
|
+
setCurrentValue = _useState2[1];
|
|
44
|
+
var _useStore = (0, _store.useStore)(),
|
|
45
|
+
onEdit = _useStore.onEdit;
|
|
46
|
+
var onKeyDown = function onKeyDown(evn) {
|
|
47
|
+
if (evn.key === 'Enter') {
|
|
48
|
+
var _$dom$current;
|
|
49
|
+
(_$dom$current = $dom.current) === null || _$dom$current === void 0 || _$dom$current.setAttribute('contentEditable', 'false');
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var onClick = function onClick(evn) {
|
|
53
|
+
var _$dom$current2, _$dom$current3;
|
|
54
|
+
evn.stopPropagation();
|
|
55
|
+
(_$dom$current2 = $dom.current) === null || _$dom$current2 === void 0 || _$dom$current2.setAttribute('contentEditable', 'true');
|
|
56
|
+
(_$dom$current3 = $dom.current) === null || _$dom$current3 === void 0 || _$dom$current3.focus();
|
|
57
|
+
};
|
|
58
|
+
var onBlur = function onBlur(evn) {
|
|
59
|
+
var _$dom$current4;
|
|
60
|
+
(_$dom$current4 = $dom.current) === null || _$dom$current4 === void 0 || _$dom$current4.setAttribute('contentEditable', 'false');
|
|
61
|
+
var callback = onEdit && onEdit({
|
|
62
|
+
value: evn.target.textContent,
|
|
63
|
+
oldValue: value,
|
|
64
|
+
keyName: keyName
|
|
65
|
+
});
|
|
66
|
+
if (callback) {
|
|
67
|
+
setCurrentValue(evn.target.textContent);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var spanProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
71
|
+
onKeyDown: onKeyDown,
|
|
72
|
+
onClick: onClick,
|
|
73
|
+
onBlur: onBlur,
|
|
74
|
+
spellCheck: false,
|
|
75
|
+
contentEditable: 'false',
|
|
76
|
+
suppressContentEditableWarning: true,
|
|
77
|
+
children: currentValue
|
|
78
|
+
});
|
|
79
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, spanProps), {}, {
|
|
80
|
+
ref: $dom
|
|
81
|
+
}));
|
|
82
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type JsonViewProps } from '../';
|
|
2
|
+
export interface JsonViewEditorProps<T extends object> extends Omit<JsonViewProps<T>, 'shortenTextAfterLength'> {
|
|
3
|
+
/**
|
|
4
|
+
* When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
|
|
5
|
+
* @returns {boolean} Returning false from onEdit will prevent the change from being made.
|
|
6
|
+
*/
|
|
7
|
+
onEdit?: (option: {
|
|
8
|
+
value: unknown;
|
|
9
|
+
oldValue: unknown;
|
|
10
|
+
keyName?: string | number;
|
|
11
|
+
parentName?: string | number;
|
|
12
|
+
type?: 'value' | 'key';
|
|
13
|
+
}) => boolean;
|
|
14
|
+
/** Whether enable edit feature. @default true */
|
|
15
|
+
editable?: boolean;
|
|
16
|
+
}
|
|
17
|
+
declare const JsonViewEditor: import("react").ForwardRefExoticComponent<Omit<JsonViewEditorProps<object>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export default JsonViewEditor;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _ = _interopRequireDefault(require("../"));
|
|
13
|
+
var _KeyName = require("./KeyName");
|
|
14
|
+
var _store = require("./store");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _excluded = ["children", "onEdit", "editable"];
|
|
17
|
+
var JsonViewEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
18
|
+
var children = props.children,
|
|
19
|
+
onEdit = props.onEdit,
|
|
20
|
+
_props$editable = props.editable,
|
|
21
|
+
editable = _props$editable === void 0 ? true : _props$editable,
|
|
22
|
+
reset = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
23
|
+
var _useStoreReducer = (0, _store.useStoreReducer)({
|
|
24
|
+
onEdit: onEdit
|
|
25
|
+
}),
|
|
26
|
+
_useStoreReducer2 = (0, _slicedToArray2["default"])(_useStoreReducer, 2),
|
|
27
|
+
state = _useStoreReducer2[0],
|
|
28
|
+
dispatch = _useStoreReducer2[1];
|
|
29
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_store.Context.Provider, {
|
|
30
|
+
value: state,
|
|
31
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_store.Dispatch.Provider, {
|
|
32
|
+
value: dispatch,
|
|
33
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_["default"], (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
34
|
+
shortenTextAfterLength: 0,
|
|
35
|
+
ref: ref,
|
|
36
|
+
children: [editable && /*#__PURE__*/(0, _jsxRuntime.jsx)(_["default"].KeyName, {
|
|
37
|
+
render: _KeyName.KeyNameRender
|
|
38
|
+
}), children]
|
|
39
|
+
}))
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
var _default = exports["default"] = JsonViewEditor;
|
|
44
|
+
module.exports = exports.default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type InitialState = {
|
|
2
|
+
/**
|
|
3
|
+
* When a callback function is passed in, edit functionality is enabled. The callback is invoked before edits are completed.
|
|
4
|
+
* @returns {boolean} Returning false from onEdit will prevent the change from being made.
|
|
5
|
+
*/
|
|
6
|
+
onEdit?: (option: {
|
|
7
|
+
value: unknown;
|
|
8
|
+
oldValue: unknown;
|
|
9
|
+
keyName?: string | number;
|
|
10
|
+
parentName?: string | number;
|
|
11
|
+
type?: 'value' | 'key';
|
|
12
|
+
}) => boolean;
|
|
13
|
+
};
|
|
14
|
+
type Dispatch = React.Dispatch<InitialState>;
|
|
15
|
+
export declare const Context: import("react").Context<InitialState>;
|
|
16
|
+
export declare const Dispatch: import("react").Context<Dispatch>;
|
|
17
|
+
export declare const useStore: () => InitialState;
|
|
18
|
+
export declare function useStoreReducer(initialState: InitialState): [{
|
|
19
|
+
onEdit?: (option: {
|
|
20
|
+
value: unknown;
|
|
21
|
+
oldValue: unknown;
|
|
22
|
+
keyName?: string | number;
|
|
23
|
+
parentName?: string | number;
|
|
24
|
+
type?: "value" | "key";
|
|
25
|
+
}) => boolean;
|
|
26
|
+
}, import("react").Dispatch<InitialState>];
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useStore = exports.Dispatch = exports.Context = void 0;
|
|
8
|
+
exports.useStoreReducer = useStoreReducer;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var initialState = {};
|
|
12
|
+
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(initialState);
|
|
13
|
+
var reducer = function reducer(state, action) {
|
|
14
|
+
return (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, state), action);
|
|
15
|
+
};
|
|
16
|
+
var Dispatch = exports.Dispatch = /*#__PURE__*/(0, _react.createContext)(function () {});
|
|
17
|
+
Dispatch.displayName = 'JVR.Editor.Dispatch';
|
|
18
|
+
var useStore = exports.useStore = function useStore() {
|
|
19
|
+
return (0, _react.useContext)(Context);
|
|
20
|
+
};
|
|
21
|
+
function useStoreReducer(initialState) {
|
|
22
|
+
return (0, _react.useReducer)(reducer, initialState);
|
|
23
|
+
}
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BraceLeft } from './symbol/BraceLeft';
|
|
3
2
|
import { BraceRight } from './symbol/BraceRight';
|
|
4
3
|
import { BracketsLeft } from './symbol/BracketsLeft';
|
|
@@ -25,12 +24,20 @@ import { CountInfo } from './section/CountInfo';
|
|
|
25
24
|
import { CountInfoExtra } from './section/CountInfoExtra';
|
|
26
25
|
import { Ellipsis } from './section/Ellipsis';
|
|
27
26
|
import { KeyName } from './section/KeyName';
|
|
27
|
+
import { Row } from './section/Row';
|
|
28
28
|
export * from './store';
|
|
29
29
|
export * from './store/Expands';
|
|
30
30
|
export * from './store/ShowTools';
|
|
31
31
|
export * from './store/Symbols';
|
|
32
32
|
export * from './store/Types';
|
|
33
|
-
export * from './symbol';
|
|
33
|
+
export * from './symbol/';
|
|
34
|
+
export type ShouldExpandNodeInitially<T extends object> = (isExpanded: boolean, props: {
|
|
35
|
+
keyName?: string | number;
|
|
36
|
+
value?: T;
|
|
37
|
+
parentValue?: T;
|
|
38
|
+
keys: (number | string)[];
|
|
39
|
+
level: number;
|
|
40
|
+
}) => boolean;
|
|
34
41
|
export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
35
42
|
/** This property contains your input JSON */
|
|
36
43
|
value?: T;
|
|
@@ -46,12 +53,24 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
|
|
|
46
53
|
displayDataTypes?: boolean;
|
|
47
54
|
/** The user can copy objects and arrays to clipboard by clicking on the clipboard icon. @default true */
|
|
48
55
|
enableClipboard?: boolean;
|
|
49
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* When set to true, all nodes will be collapsed by default. Use an integer value to collapse at a specific depth. @default false
|
|
58
|
+
* collapsed takes precedence over shouldExpandNodeInitially.
|
|
59
|
+
* @see {@link shouldExpandNodeInitially} for more details on how the initial expansion works.
|
|
60
|
+
*/
|
|
50
61
|
collapsed?: boolean | number;
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether the node should be expanded on the first render, or you can use collapsed to control the level of expansion (by default, the root is expanded).
|
|
64
|
+
* If both collapsed and shouldExpandNodeInitially are set, the value of collapsed takes precedence.
|
|
65
|
+
* @see {@link collapsed} for more details on how this works.
|
|
66
|
+
*/
|
|
67
|
+
shouldExpandNodeInitially?: ShouldExpandNodeInitially<T>;
|
|
51
68
|
/** Whether to highlight updates. @default true */
|
|
52
69
|
highlightUpdates?: boolean;
|
|
53
|
-
/** Shorten long JSON strings, Set to `0` to disable this feature @default
|
|
70
|
+
/** Shorten long JSON strings, Set to `0` to disable this feature @default 30 */
|
|
54
71
|
shortenTextAfterLength?: number;
|
|
72
|
+
/** When the text exceeds the length, `...` will be displayed. Currently, this `...` can be customized. @default "..." */
|
|
73
|
+
stringEllipsis?: number;
|
|
55
74
|
/** Callback function for when a treeNode is expanded or collapsed */
|
|
56
75
|
onExpand?: (props: {
|
|
57
76
|
expand: boolean;
|
|
@@ -61,6 +80,8 @@ export interface JsonViewProps<T extends object> extends React.DetailedHTMLProps
|
|
|
61
80
|
}) => void;
|
|
62
81
|
/** Fires event when you copy */
|
|
63
82
|
onCopied?: (text: string, value?: T) => void;
|
|
83
|
+
/** Transform the text before copying to clipboard */
|
|
84
|
+
beforeCopy?: (copyText: string, keyName?: string | number, value?: T, parentValue?: T, expandKey?: string, keys?: (number | string)[]) => string;
|
|
64
85
|
}
|
|
65
86
|
type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
|
|
66
87
|
Bigint: typeof Bigint;
|
|
@@ -89,6 +110,7 @@ type JsonViewComponent = React.FC<React.PropsWithRef<JsonViewProps<object>>> & {
|
|
|
89
110
|
CountInfo: typeof CountInfo;
|
|
90
111
|
CountInfoExtra: typeof CountInfoExtra;
|
|
91
112
|
KeyName: typeof KeyName;
|
|
113
|
+
Row: typeof Row;
|
|
92
114
|
};
|
|
93
115
|
declare const JsonView: JsonViewComponent;
|
|
94
116
|
export default JsonView;
|
package/cjs/index.js
CHANGED
|
@@ -48,6 +48,7 @@ var _CountInfo = require("./section/CountInfo");
|
|
|
48
48
|
var _CountInfoExtra = require("./section/CountInfoExtra");
|
|
49
49
|
var _Ellipsis = require("./section/Ellipsis");
|
|
50
50
|
var _KeyName = require("./section/KeyName");
|
|
51
|
+
var _Row = require("./section/Row");
|
|
51
52
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
52
53
|
var _Expands = require("./store/Expands");
|
|
53
54
|
Object.keys(_Expands).forEach(function (key) {
|
|
@@ -97,7 +98,7 @@ Object.keys(_Types).forEach(function (key) {
|
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
});
|
|
100
|
-
var _symbol = require("./symbol");
|
|
101
|
+
var _symbol = require("./symbol/");
|
|
101
102
|
Object.keys(_symbol).forEach(function (key) {
|
|
102
103
|
if (key === "default" || key === "__esModule") return;
|
|
103
104
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -109,20 +110,23 @@ Object.keys(_symbol).forEach(function (key) {
|
|
|
109
110
|
}
|
|
110
111
|
});
|
|
111
112
|
});
|
|
112
|
-
var _excluded = ["className", "style", "value", "children", "collapsed", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand"];
|
|
113
|
+
var _excluded = ["className", "style", "value", "children", "collapsed", "shouldExpandNodeInitially", "indentWidth", "displayObjectSize", "shortenTextAfterLength", "stringEllipsis", "highlightUpdates", "enableClipboard", "displayDataTypes", "objectSortKeys", "onExpand", "onCopied", "beforeCopy"];
|
|
113
114
|
var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
114
115
|
var _props$className = props.className,
|
|
115
116
|
className = _props$className === void 0 ? '' : _props$className,
|
|
116
117
|
style = props.style,
|
|
117
118
|
value = props.value,
|
|
118
119
|
children = props.children,
|
|
119
|
-
collapsed = props.collapsed,
|
|
120
|
+
_props$collapsed = props.collapsed,
|
|
121
|
+
collapsed = _props$collapsed === void 0 ? false : _props$collapsed,
|
|
122
|
+
shouldExpandNodeInitially = props.shouldExpandNodeInitially,
|
|
120
123
|
_props$indentWidth = props.indentWidth,
|
|
121
124
|
indentWidth = _props$indentWidth === void 0 ? 15 : _props$indentWidth,
|
|
122
125
|
_props$displayObjectS = props.displayObjectSize,
|
|
123
126
|
displayObjectSize = _props$displayObjectS === void 0 ? true : _props$displayObjectS,
|
|
124
127
|
_props$shortenTextAft = props.shortenTextAfterLength,
|
|
125
|
-
shortenTextAfterLength = _props$shortenTextAft === void 0 ?
|
|
128
|
+
shortenTextAfterLength = _props$shortenTextAft === void 0 ? 30 : _props$shortenTextAft,
|
|
129
|
+
stringEllipsis = props.stringEllipsis,
|
|
126
130
|
_props$highlightUpdat = props.highlightUpdates,
|
|
127
131
|
highlightUpdates = _props$highlightUpdat === void 0 ? true : _props$highlightUpdat,
|
|
128
132
|
_props$enableClipboar = props.enableClipboard,
|
|
@@ -132,6 +136,8 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
132
136
|
_props$objectSortKeys = props.objectSortKeys,
|
|
133
137
|
objectSortKeys = _props$objectSortKeys === void 0 ? false : _props$objectSortKeys,
|
|
134
138
|
onExpand = props.onExpand,
|
|
139
|
+
onCopied = props.onCopied,
|
|
140
|
+
beforeCopy = props.beforeCopy,
|
|
135
141
|
elmProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
136
142
|
var defaultStyle = (0, _objectSpread2["default"])({
|
|
137
143
|
lineHeight: 1.4,
|
|
@@ -146,12 +152,16 @@ var JsonView = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
|
146
152
|
value: value,
|
|
147
153
|
objectSortKeys: objectSortKeys,
|
|
148
154
|
indentWidth: indentWidth,
|
|
155
|
+
shouldExpandNodeInitially: collapsed === false ? shouldExpandNodeInitially : undefined,
|
|
149
156
|
displayObjectSize: displayObjectSize,
|
|
150
157
|
collapsed: collapsed,
|
|
151
158
|
enableClipboard: enableClipboard,
|
|
152
159
|
shortenTextAfterLength: shortenTextAfterLength,
|
|
160
|
+
stringEllipsis: stringEllipsis,
|
|
153
161
|
highlightUpdates: highlightUpdates,
|
|
154
|
-
|
|
162
|
+
onCopied: onCopied,
|
|
163
|
+
onExpand: onExpand,
|
|
164
|
+
beforeCopy: beforeCopy
|
|
155
165
|
},
|
|
156
166
|
initialTypes: {
|
|
157
167
|
displayDataTypes: displayDataTypes
|
|
@@ -191,6 +201,6 @@ JsonView.Copied = _Copied.Copied;
|
|
|
191
201
|
JsonView.CountInfo = _CountInfo.CountInfo;
|
|
192
202
|
JsonView.CountInfoExtra = _CountInfoExtra.CountInfoExtra;
|
|
193
203
|
JsonView.KeyName = _KeyName.KeyName;
|
|
204
|
+
JsonView.Row = _Row.Row;
|
|
194
205
|
JsonView.displayName = 'JVR.JsonView';
|
|
195
|
-
var _default = JsonView;
|
|
196
|
-
exports["default"] = _default;
|
|
206
|
+
var _default = exports["default"] = JsonView;
|
package/cjs/section/Copied.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { type TagType } from '../store/Types';
|
|
2
2
|
import { type SectionElement } from '../store/Section';
|
|
3
|
+
export type CopiedSectionElement<T extends TagType = 'svg'> = SectionElement<T> & {
|
|
4
|
+
beforeCopy?: (copyText: string, keyName?: string | number, value?: object, parentValue?: object, expandKey?: string, keys?: (number | string)[]) => string;
|
|
5
|
+
};
|
|
3
6
|
export declare const Copied: {
|
|
4
|
-
(props:
|
|
7
|
+
<K extends TagType = "svg">(props: CopiedSectionElement<K>): null;
|
|
5
8
|
displayName: string;
|
|
6
9
|
};
|
package/cjs/section/Copied.js
CHANGED
|
@@ -6,12 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Copied = void 0;
|
|
7
7
|
var _Section = require("../store/Section");
|
|
8
8
|
var _useRender = require("../utils/useRender");
|
|
9
|
-
var Copied = function Copied(props) {
|
|
9
|
+
var Copied = exports.Copied = function Copied(props) {
|
|
10
10
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
11
11
|
_useSectionStore$Copi = _useSectionStore.Copied,
|
|
12
12
|
Comp = _useSectionStore$Copi === void 0 ? {} : _useSectionStore$Copi;
|
|
13
13
|
(0, _useRender.useSectionRender)(Comp, props, 'Copied');
|
|
14
14
|
return null;
|
|
15
15
|
};
|
|
16
|
-
exports.Copied = Copied;
|
|
17
16
|
Copied.displayName = 'JVR.Copied';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type TagType } from '../store/Types';
|
|
3
2
|
import { type SectionElement, type SectionElementProps } from '../store/Section';
|
|
4
3
|
export declare const CountInfo: {
|
|
@@ -10,6 +9,6 @@ export interface CountInfoCompProps<T extends object> {
|
|
|
10
9
|
keyName: string | number;
|
|
11
10
|
}
|
|
12
11
|
export declare const CountInfoComp: {
|
|
13
|
-
<T extends object>(props: SectionElementProps<
|
|
12
|
+
<K extends TagType, T extends object>(props: SectionElementProps<K> & CountInfoCompProps<T> & React.HTMLAttributes<HTMLElement>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
14
13
|
displayName: string;
|
|
15
14
|
};
|
package/cjs/section/CountInfo.js
CHANGED
|
@@ -13,16 +13,15 @@ var _store = require("../store");
|
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
var _excluded = ["value", "keyName"],
|
|
15
15
|
_excluded2 = ["as", "render"];
|
|
16
|
-
var CountInfo = function CountInfo(props) {
|
|
16
|
+
var CountInfo = exports.CountInfo = function CountInfo(props) {
|
|
17
17
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
18
18
|
_useSectionStore$Coun = _useSectionStore.CountInfo,
|
|
19
19
|
Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
|
|
20
20
|
(0, _useRender.useSectionRender)(Comp, props, 'CountInfo');
|
|
21
21
|
return null;
|
|
22
22
|
};
|
|
23
|
-
exports.CountInfo = CountInfo;
|
|
24
23
|
CountInfo.displayName = 'JVR.CountInfo';
|
|
25
|
-
var CountInfoComp = function CountInfoComp(props) {
|
|
24
|
+
var CountInfoComp = exports.CountInfoComp = function CountInfoComp(props) {
|
|
26
25
|
var _props$value = props.value,
|
|
27
26
|
value = _props$value === void 0 ? {} : _props$value,
|
|
28
27
|
keyName = props.keyName,
|
|
@@ -40,7 +39,7 @@ var CountInfoComp = function CountInfoComp(props) {
|
|
|
40
39
|
reset.style = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset.style), props.style);
|
|
41
40
|
var len = Object.keys(value).length;
|
|
42
41
|
if (!reset.children) {
|
|
43
|
-
reset.children = "".concat(len, "
|
|
42
|
+
reset.children = "".concat(len, " item").concat(len === 1 ? '' : 's');
|
|
44
43
|
}
|
|
45
44
|
var elmProps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), other);
|
|
46
45
|
var isRender = render && typeof render === 'function';
|
|
@@ -53,5 +52,4 @@ var CountInfoComp = function CountInfoComp(props) {
|
|
|
53
52
|
if (child) return child;
|
|
54
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
|
|
55
54
|
};
|
|
56
|
-
exports.CountInfoComp = CountInfoComp;
|
|
57
55
|
CountInfoComp.displayName = 'JVR.CountInfoComp';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { type TagType } from '../store/Types';
|
|
3
2
|
import { type SectionElement, type SectionElementProps } from '../store/Section';
|
|
4
3
|
export declare const CountInfoExtra: {
|
|
@@ -10,6 +9,6 @@ export interface CountInfoExtraCompsProps<T extends object> {
|
|
|
10
9
|
keyName: string | number;
|
|
11
10
|
}
|
|
12
11
|
export declare const CountInfoExtraComps: {
|
|
13
|
-
<T extends object>(props: SectionElementProps<
|
|
12
|
+
<T extends object, K extends TagType>(props: SectionElementProps<K> & CountInfoExtraCompsProps<T>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
14
13
|
displayName: string;
|
|
15
14
|
};
|
|
@@ -12,16 +12,15 @@ var _useRender = require("../utils/useRender");
|
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["value", "keyName"],
|
|
14
14
|
_excluded2 = ["as", "render"];
|
|
15
|
-
var CountInfoExtra = function CountInfoExtra(props) {
|
|
15
|
+
var CountInfoExtra = exports.CountInfoExtra = function CountInfoExtra(props) {
|
|
16
16
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
17
17
|
_useSectionStore$Coun = _useSectionStore.CountInfoExtra,
|
|
18
18
|
Comp = _useSectionStore$Coun === void 0 ? {} : _useSectionStore$Coun;
|
|
19
19
|
(0, _useRender.useSectionRender)(Comp, props, 'CountInfoExtra');
|
|
20
20
|
return null;
|
|
21
21
|
};
|
|
22
|
-
exports.CountInfoExtra = CountInfoExtra;
|
|
23
22
|
CountInfoExtra.displayName = 'JVR.CountInfoExtra';
|
|
24
|
-
var CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
23
|
+
var CountInfoExtraComps = exports.CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
25
24
|
var _props$value = props.value,
|
|
26
25
|
value = _props$value === void 0 ? {} : _props$value,
|
|
27
26
|
keyName = props.keyName,
|
|
@@ -43,5 +42,4 @@ var CountInfoExtraComps = function CountInfoExtraComps(props) {
|
|
|
43
42
|
if (child) return child;
|
|
44
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, elmProps));
|
|
45
44
|
};
|
|
46
|
-
exports.CountInfoExtraComps = CountInfoExtraComps;
|
|
47
45
|
CountInfoExtraComps.displayName = 'JVR.CountInfoExtraComps';
|
package/cjs/section/Ellipsis.js
CHANGED
|
@@ -5,22 +5,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.EllipsisComp = exports.Ellipsis = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
8
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
11
|
var _Section = require("../store/Section");
|
|
11
12
|
var _useRender = require("../utils/useRender");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
var _excluded = ["as", "render"];
|
|
14
|
-
var Ellipsis = function Ellipsis(props) {
|
|
15
|
+
var Ellipsis = exports.Ellipsis = function Ellipsis(props) {
|
|
15
16
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
16
17
|
_useSectionStore$Elli = _useSectionStore.Ellipsis,
|
|
17
18
|
Comp = _useSectionStore$Elli === void 0 ? {} : _useSectionStore$Elli;
|
|
18
19
|
(0, _useRender.useSectionRender)(Comp, props, 'Ellipsis');
|
|
19
20
|
return null;
|
|
20
21
|
};
|
|
21
|
-
exports.Ellipsis = Ellipsis;
|
|
22
22
|
Ellipsis.displayName = 'JVR.Ellipsis';
|
|
23
|
-
var EllipsisComp = function EllipsisComp(_ref) {
|
|
23
|
+
var EllipsisComp = exports.EllipsisComp = function EllipsisComp(_ref) {
|
|
24
24
|
var isExpanded = _ref.isExpanded,
|
|
25
25
|
value = _ref.value,
|
|
26
26
|
keyName = _ref.keyName;
|
|
@@ -38,8 +38,7 @@ var EllipsisComp = function EllipsisComp(_ref) {
|
|
|
38
38
|
keyName: keyName
|
|
39
39
|
});
|
|
40
40
|
if (child) return child;
|
|
41
|
-
if (!isExpanded) return null;
|
|
41
|
+
if (!isExpanded || (0, _typeof2["default"])(value) === 'object' && Object.keys(value).length == 0) return null;
|
|
42
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])({}, reset));
|
|
43
43
|
};
|
|
44
|
-
exports.EllipsisComp = EllipsisComp;
|
|
45
44
|
EllipsisComp.displayName = 'JVR.EllipsisComp';
|
package/cjs/section/KeyName.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
2
|
import { type TagType } from '../store/Types';
|
|
3
3
|
import { type SectionElement } from '../store/Section';
|
|
4
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
5
|
export declare const KeyName: {
|
|
5
6
|
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export interface KeyNameCompProps<T extends object> extends React.HTMLAttributes<HTMLSpanElement>, SectionElementResult<T> {
|
|
10
|
+
}
|
|
11
|
+
export declare const KeyNameComp: {
|
|
12
|
+
<T extends object>(props: PropsWithChildren<KeyNameCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
displayName: string;
|
|
11
14
|
};
|
|
12
|
-
export declare const KeyNameComp: FC<PropsWithChildren<KeyNameCompProps>>;
|
|
13
|
-
export {};
|
package/cjs/section/KeyName.js
CHANGED
|
@@ -11,19 +11,20 @@ var _Section = require("../store/Section");
|
|
|
11
11
|
var _useRender = require("../utils/useRender");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["as", "render"];
|
|
14
|
-
var KeyName = function KeyName(props) {
|
|
14
|
+
var KeyName = exports.KeyName = function KeyName(props) {
|
|
15
15
|
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
16
16
|
_useSectionStore$KeyN = _useSectionStore.KeyName,
|
|
17
17
|
Comp = _useSectionStore$KeyN === void 0 ? {} : _useSectionStore$KeyN;
|
|
18
18
|
(0, _useRender.useSectionRender)(Comp, props, 'KeyName');
|
|
19
19
|
return null;
|
|
20
20
|
};
|
|
21
|
-
exports.KeyName = KeyName;
|
|
22
21
|
KeyName.displayName = 'JVR.KeyName';
|
|
23
|
-
var KeyNameComp = function KeyNameComp(props) {
|
|
22
|
+
var KeyNameComp = exports.KeyNameComp = function KeyNameComp(props) {
|
|
24
23
|
var children = props.children,
|
|
25
24
|
value = props.value,
|
|
26
|
-
|
|
25
|
+
parentValue = props.parentValue,
|
|
26
|
+
keyName = props.keyName,
|
|
27
|
+
keys = props.keys;
|
|
27
28
|
var isNumber = typeof children === 'number';
|
|
28
29
|
var style = {
|
|
29
30
|
color: isNumber ? 'var(--w-rjv-key-number, #268bd2)' : 'var(--w-rjv-key-string, #002b36)'
|
|
@@ -40,12 +41,13 @@ var KeyNameComp = function KeyNameComp(props) {
|
|
|
40
41
|
children: children
|
|
41
42
|
}), {
|
|
42
43
|
value: value,
|
|
43
|
-
|
|
44
|
+
parentValue: parentValue,
|
|
45
|
+
keyName: keyName,
|
|
46
|
+
keys: keys || (keyName ? [keyName] : [])
|
|
44
47
|
});
|
|
45
48
|
if (child) return child;
|
|
46
49
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, reset), {}, {
|
|
47
50
|
children: children
|
|
48
51
|
}));
|
|
49
52
|
};
|
|
50
|
-
exports.KeyNameComp = KeyNameComp;
|
|
51
53
|
KeyNameComp.displayName = 'JVR.KeyNameComp';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TagType } from '../store/Types';
|
|
2
|
+
import { type SectionElement } from '../store/Section';
|
|
3
|
+
import { type SectionElementResult } from '../store/Section';
|
|
4
|
+
export declare const Row: {
|
|
5
|
+
<K extends TagType>(props: SectionElement<K>): null;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
export interface RowCompProps<T extends object> extends React.HTMLAttributes<HTMLDivElement>, SectionElementResult<T> {
|
|
9
|
+
}
|
|
10
|
+
export declare const RowComp: {
|
|
11
|
+
<T extends object>(props: React.PropsWithChildren<RowCompProps<T>>): string | number | true | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.RowComp = exports.Row = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _Section = require("../store/Section");
|
|
11
|
+
var _useRender = require("../utils/useRender");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
var _excluded = ["children", "value", "parentValue", "keyName", "keys"],
|
|
14
|
+
_excluded2 = ["as", "render", "children"];
|
|
15
|
+
var Row = exports.Row = function Row(props) {
|
|
16
|
+
var _useSectionStore = (0, _Section.useSectionStore)(),
|
|
17
|
+
_useSectionStore$Row = _useSectionStore.Row,
|
|
18
|
+
Comp = _useSectionStore$Row === void 0 ? {} : _useSectionStore$Row;
|
|
19
|
+
(0, _useRender.useSectionRender)(Comp, props, 'Row');
|
|
20
|
+
return null;
|
|
21
|
+
};
|
|
22
|
+
Row.displayName = 'JVR.Row';
|
|
23
|
+
var RowComp = exports.RowComp = function RowComp(props) {
|
|
24
|
+
var children = props.children,
|
|
25
|
+
value = props.value,
|
|
26
|
+
parentValue = props.parentValue,
|
|
27
|
+
keyName = props.keyName,
|
|
28
|
+
keys = props.keys,
|
|
29
|
+
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
30
|
+
var _useSectionStore2 = (0, _Section.useSectionStore)(),
|
|
31
|
+
_useSectionStore2$Row = _useSectionStore2.Row,
|
|
32
|
+
Comp = _useSectionStore2$Row === void 0 ? {} : _useSectionStore2$Row;
|
|
33
|
+
var as = Comp.as,
|
|
34
|
+
render = Comp.render,
|
|
35
|
+
_ = Comp.children,
|
|
36
|
+
reset = (0, _objectWithoutProperties2["default"])(Comp, _excluded2);
|
|
37
|
+
var Elm = as || 'div';
|
|
38
|
+
var child = render && typeof render === 'function' && render((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), reset), {}, {
|
|
39
|
+
children: children
|
|
40
|
+
}), {
|
|
41
|
+
value: value,
|
|
42
|
+
keyName: keyName,
|
|
43
|
+
parentValue: parentValue,
|
|
44
|
+
keys: keys
|
|
45
|
+
});
|
|
46
|
+
if (child) return child;
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Elm, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, other), reset), {}, {
|
|
48
|
+
children: children
|
|
49
|
+
}));
|
|
50
|
+
};
|
|
51
|
+
RowComp.displayName = 'JVR.RowComp';
|