@uipath/apollo-wind 2.67.0 → 2.68.0
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/dist/components/forms/metadata-form.cjs +40 -44
- package/dist/components/forms/metadata-form.js +40 -44
- package/dist/components/ui/index.cjs +72 -61
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/json-tree-view/JsonTree.types.d.ts +26 -0
- package/dist/components/ui/json-tree-view/JsonTreeRow.cjs +13 -10
- package/dist/components/ui/json-tree-view/JsonTreeRow.js +14 -11
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.cjs +22 -11
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.d.ts +6 -1
- package/dist/components/ui/json-tree-view/JsonTreeToolbar.js +22 -11
- package/dist/components/ui/json-tree-view/NodeKey.cjs +4 -0
- package/dist/components/ui/json-tree-view/NodeKey.js +4 -0
- package/dist/components/ui/json-tree-view/RowActions.cjs +23 -17
- package/dist/components/ui/json-tree-view/RowActions.d.ts +4 -1
- package/dist/components/ui/json-tree-view/RowActions.js +23 -17
- package/dist/components/ui/json-tree-view/buildJsonTree.cjs +99 -44
- package/dist/components/ui/json-tree-view/buildJsonTree.d.ts +15 -2
- package/dist/components/ui/json-tree-view/buildJsonTree.js +97 -45
- package/dist/components/ui/panel-tabs.cjs +99 -0
- package/dist/components/ui/panel-tabs.d.ts +34 -0
- package/dist/components/ui/panel-tabs.js +53 -0
- package/dist/components/ui/tree-view.cjs +19 -5
- package/dist/components/ui/tree-view.js +19 -5
- package/dist/index.cjs +29 -10
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -2
- package/dist/styles.css +33 -0
- package/package.json +1 -1
|
@@ -45,7 +45,7 @@ function JsonTreeToolbar({ strings, tooltipContentClassName, ...props }) {
|
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, controlsHidden = false, className }) {
|
|
48
|
+
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, trailing, controlsHidden = false, className }) {
|
|
49
49
|
const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
|
|
50
50
|
const [searchOpen, setSearchOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
51
51
|
const activeFilter = filters?.find((f)=>f.id === activeFilterId);
|
|
@@ -67,7 +67,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
67
67
|
className: "relative flex min-w-0 flex-1 items-center overflow-hidden",
|
|
68
68
|
children: [
|
|
69
69
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
|
|
70
|
-
size:
|
|
70
|
+
size: 12,
|
|
71
71
|
className: "pointer-events-none absolute left-2 text-foreground-subtle"
|
|
72
72
|
}),
|
|
73
73
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
|
|
@@ -78,7 +78,10 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
78
78
|
value: query,
|
|
79
79
|
onChange: (e)=>onQueryChange(e.target.value),
|
|
80
80
|
onKeyDown: (e)=>{
|
|
81
|
-
if ('Escape'
|
|
81
|
+
if ('Escape' !== e.key) return;
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
e.stopPropagation();
|
|
84
|
+
closeSearch();
|
|
82
85
|
},
|
|
83
86
|
"aria-label": resolvedSearchPlaceholder,
|
|
84
87
|
placeholder: resolvedSearchPlaceholder,
|
|
@@ -86,7 +89,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
86
89
|
paddingLeft: '1.75rem',
|
|
87
90
|
paddingRight: '1.5rem'
|
|
88
91
|
},
|
|
89
|
-
className: "h-
|
|
92
|
+
className: "h-5 w-full text-foreground placeholder:text-foreground-subtle focus-visible:ring-0"
|
|
90
93
|
}),
|
|
91
94
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
92
95
|
type: "button",
|
|
@@ -109,13 +112,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
109
112
|
delay: true,
|
|
110
113
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
111
114
|
variant: "ghost",
|
|
112
|
-
size: "
|
|
115
|
+
size: "4xs",
|
|
113
116
|
icon: true,
|
|
114
117
|
onClick: ()=>setSearchOpen(true),
|
|
115
118
|
"aria-label": searchActionLabel,
|
|
116
119
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
117
120
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Search, {
|
|
118
|
-
size:
|
|
121
|
+
size: 12
|
|
119
122
|
})
|
|
120
123
|
})
|
|
121
124
|
})
|
|
@@ -131,13 +134,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
131
134
|
asChild: true,
|
|
132
135
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
133
136
|
variant: "ghost",
|
|
134
|
-
size: "
|
|
137
|
+
size: "4xs",
|
|
135
138
|
icon: true,
|
|
136
139
|
"aria-label": filterLabel,
|
|
137
140
|
className: "relative rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
138
141
|
children: [
|
|
139
142
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Filter, {
|
|
140
|
-
size:
|
|
143
|
+
size: 12
|
|
141
144
|
}),
|
|
142
145
|
activeFilter && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
143
146
|
className: "absolute right-0.5 top-0.5 size-1.5 rounded-full bg-primary ring-1 ring-surface"
|
|
@@ -183,19 +186,27 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
183
186
|
delay: true,
|
|
184
187
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
185
188
|
variant: "ghost",
|
|
186
|
-
size: "
|
|
189
|
+
size: "4xs",
|
|
187
190
|
icon: true,
|
|
188
191
|
onClick: onToggleAll,
|
|
189
192
|
"aria-label": toggleAllLabel,
|
|
190
193
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
191
194
|
children: allCollapsed ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsUpDown, {
|
|
192
|
-
size:
|
|
195
|
+
size: 12
|
|
193
196
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ChevronsDownUp, {
|
|
194
|
-
size:
|
|
197
|
+
size: 12
|
|
195
198
|
})
|
|
196
199
|
})
|
|
197
200
|
})
|
|
198
201
|
]
|
|
202
|
+
}),
|
|
203
|
+
trailing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
204
|
+
children: [
|
|
205
|
+
controlsHidden && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
206
|
+
className: "flex-1"
|
|
207
|
+
}),
|
|
208
|
+
trailing
|
|
209
|
+
]
|
|
199
210
|
})
|
|
200
211
|
]
|
|
201
212
|
});
|
|
@@ -21,7 +21,12 @@ export interface JsonTreeToolbarProps {
|
|
|
21
21
|
*/
|
|
22
22
|
leading?: ReactNode;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Content rendered at the end of the row, after the tree controls (e.g. a
|
|
25
|
+
* node output mode select). Stays visible when `controlsHidden` is set.
|
|
26
|
+
*/
|
|
27
|
+
trailing?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Hides the search / filter / collapse controls, keeping only `leading` and `trailing`.
|
|
25
30
|
* Use when a non-tree tab is active and the controls would be inert.
|
|
26
31
|
*/
|
|
27
32
|
controlsHidden?: boolean;
|
|
@@ -17,7 +17,7 @@ function JsonTreeToolbar({ strings, tooltipContentClassName, ...props }) {
|
|
|
17
17
|
})
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, controlsHidden = false, className }) {
|
|
20
|
+
function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filters, activeFilterId = null, onFilterChange, allCollapsed = false, onToggleAll, leading, trailing, controlsHidden = false, className }) {
|
|
21
21
|
const strings = useJsonTreeViewStrings();
|
|
22
22
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
23
23
|
const activeFilter = filters?.find((f)=>f.id === activeFilterId);
|
|
@@ -39,7 +39,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
39
39
|
className: "relative flex min-w-0 flex-1 items-center overflow-hidden",
|
|
40
40
|
children: [
|
|
41
41
|
/*#__PURE__*/ jsx(Search, {
|
|
42
|
-
size:
|
|
42
|
+
size: 12,
|
|
43
43
|
className: "pointer-events-none absolute left-2 text-foreground-subtle"
|
|
44
44
|
}),
|
|
45
45
|
/*#__PURE__*/ jsx(Input, {
|
|
@@ -50,7 +50,10 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
50
50
|
value: query,
|
|
51
51
|
onChange: (e)=>onQueryChange(e.target.value),
|
|
52
52
|
onKeyDown: (e)=>{
|
|
53
|
-
if ('Escape'
|
|
53
|
+
if ('Escape' !== e.key) return;
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
closeSearch();
|
|
54
57
|
},
|
|
55
58
|
"aria-label": resolvedSearchPlaceholder,
|
|
56
59
|
placeholder: resolvedSearchPlaceholder,
|
|
@@ -58,7 +61,7 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
58
61
|
paddingLeft: '1.75rem',
|
|
59
62
|
paddingRight: '1.5rem'
|
|
60
63
|
},
|
|
61
|
-
className: "h-
|
|
64
|
+
className: "h-5 w-full text-foreground placeholder:text-foreground-subtle focus-visible:ring-0"
|
|
62
65
|
}),
|
|
63
66
|
/*#__PURE__*/ jsx("button", {
|
|
64
67
|
type: "button",
|
|
@@ -81,13 +84,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
81
84
|
delay: true,
|
|
82
85
|
children: /*#__PURE__*/ jsx(Button, {
|
|
83
86
|
variant: "ghost",
|
|
84
|
-
size: "
|
|
87
|
+
size: "4xs",
|
|
85
88
|
icon: true,
|
|
86
89
|
onClick: ()=>setSearchOpen(true),
|
|
87
90
|
"aria-label": searchActionLabel,
|
|
88
91
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
89
92
|
children: /*#__PURE__*/ jsx(Search, {
|
|
90
|
-
size:
|
|
93
|
+
size: 12
|
|
91
94
|
})
|
|
92
95
|
})
|
|
93
96
|
})
|
|
@@ -103,13 +106,13 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
103
106
|
asChild: true,
|
|
104
107
|
children: /*#__PURE__*/ jsxs(Button, {
|
|
105
108
|
variant: "ghost",
|
|
106
|
-
size: "
|
|
109
|
+
size: "4xs",
|
|
107
110
|
icon: true,
|
|
108
111
|
"aria-label": filterLabel,
|
|
109
112
|
className: "relative rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
110
113
|
children: [
|
|
111
114
|
/*#__PURE__*/ jsx(Filter, {
|
|
112
|
-
size:
|
|
115
|
+
size: 12
|
|
113
116
|
}),
|
|
114
117
|
activeFilter && /*#__PURE__*/ jsx("span", {
|
|
115
118
|
className: "absolute right-0.5 top-0.5 size-1.5 rounded-full bg-primary ring-1 ring-surface"
|
|
@@ -155,19 +158,27 @@ function JsonTreeToolbarContent({ query, onQueryChange, searchPlaceholder, filte
|
|
|
155
158
|
delay: true,
|
|
156
159
|
children: /*#__PURE__*/ jsx(Button, {
|
|
157
160
|
variant: "ghost",
|
|
158
|
-
size: "
|
|
161
|
+
size: "4xs",
|
|
159
162
|
icon: true,
|
|
160
163
|
onClick: onToggleAll,
|
|
161
164
|
"aria-label": toggleAllLabel,
|
|
162
165
|
className: "rounded text-foreground-subtle hover:bg-surface-overlay hover:text-foreground",
|
|
163
166
|
children: allCollapsed ? /*#__PURE__*/ jsx(ChevronsUpDown, {
|
|
164
|
-
size:
|
|
167
|
+
size: 12
|
|
165
168
|
}) : /*#__PURE__*/ jsx(ChevronsDownUp, {
|
|
166
|
-
size:
|
|
169
|
+
size: 12
|
|
167
170
|
})
|
|
168
171
|
})
|
|
169
172
|
})
|
|
170
173
|
]
|
|
174
|
+
}),
|
|
175
|
+
trailing && /*#__PURE__*/ jsxs(Fragment, {
|
|
176
|
+
children: [
|
|
177
|
+
controlsHidden && /*#__PURE__*/ jsx("div", {
|
|
178
|
+
className: "flex-1"
|
|
179
|
+
}),
|
|
180
|
+
trailing
|
|
181
|
+
]
|
|
171
182
|
})
|
|
172
183
|
]
|
|
173
184
|
});
|
|
@@ -45,6 +45,10 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
|
|
|
45
45
|
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
46
46
|
className: "flex max-w-60 flex-col gap-1",
|
|
47
47
|
children: [
|
|
48
|
+
null != label && label !== node.key && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
49
|
+
className: "text-xs font-semibold leading-4",
|
|
50
|
+
children: label
|
|
51
|
+
}),
|
|
48
52
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
49
53
|
className: "break-all font-mono text-xs font-semibold leading-4",
|
|
50
54
|
children: copyPathText
|
|
@@ -17,6 +17,10 @@ function NodeKey({ node, label, displayPath, onCopyPath, className }) {
|
|
|
17
17
|
content: /*#__PURE__*/ jsxs("div", {
|
|
18
18
|
className: "flex max-w-60 flex-col gap-1",
|
|
19
19
|
children: [
|
|
20
|
+
null != label && label !== node.key && /*#__PURE__*/ jsx("span", {
|
|
21
|
+
className: "text-xs font-semibold leading-4",
|
|
22
|
+
children: label
|
|
23
|
+
}),
|
|
20
24
|
/*#__PURE__*/ jsx("span", {
|
|
21
25
|
className: "break-all font-mono text-xs font-semibold leading-4",
|
|
22
26
|
children: copyPathText
|
|
@@ -41,32 +41,38 @@ const ACTION_TONE_CLASS = {
|
|
|
41
41
|
warning: 'text-warning hover:text-warning',
|
|
42
42
|
error: 'text-error hover:text-error'
|
|
43
43
|
};
|
|
44
|
-
function RowActions({ node, actions, maxInline }) {
|
|
44
|
+
function RowActions({ node, actions, maxInline, meta }) {
|
|
45
45
|
const strings = (0, external_strings_cjs_namespaceObject.useJsonTreeViewStrings)();
|
|
46
46
|
const [menuOpen, setMenuOpen] = (0, external_react_namespaceObject.useState)(false);
|
|
47
|
-
if (0 === actions.length) return null;
|
|
47
|
+
if (0 === actions.length && null == meta) return null;
|
|
48
48
|
const overflowing = actions.length > maxInline;
|
|
49
49
|
const inline = overflowing ? [] : actions;
|
|
50
50
|
const overflow = overflowing ? actions : [];
|
|
51
51
|
const moreLabel = strings.moreActions;
|
|
52
|
+
const renderInline = (action)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_JsonTreeTooltip_cjs_namespaceObject.JsonTreeTooltip, {
|
|
53
|
+
content: action.tooltip ?? action.label,
|
|
54
|
+
placement: "top",
|
|
55
|
+
delay: true,
|
|
56
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
57
|
+
variant: "ghost",
|
|
58
|
+
size: "4xs",
|
|
59
|
+
icon: true,
|
|
60
|
+
disabled: action.disabled,
|
|
61
|
+
onClick: ()=>action.onSelect(node),
|
|
62
|
+
"aria-label": action.label,
|
|
63
|
+
className: (0, index_cjs_namespaceObject.cn)(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.persistent && 'opacity-100', action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
64
|
+
children: action.icon
|
|
65
|
+
})
|
|
66
|
+
}, action.id);
|
|
52
67
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
53
68
|
className: "ml-auto flex shrink-0 items-center gap-0.5",
|
|
54
69
|
children: [
|
|
55
|
-
inline.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
size: "4xs",
|
|
62
|
-
icon: true,
|
|
63
|
-
disabled: action.disabled,
|
|
64
|
-
onClick: ()=>action.onSelect(node),
|
|
65
|
-
"aria-label": action.label,
|
|
66
|
-
className: (0, index_cjs_namespaceObject.cn)(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
67
|
-
children: action.icon
|
|
68
|
-
})
|
|
69
|
-
}, action.id)),
|
|
70
|
+
inline.filter((action)=>'start' === action.placement).map(renderInline),
|
|
71
|
+
null != meta && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
72
|
+
className: "mx-1.5 flex shrink-0 items-center",
|
|
73
|
+
children: meta
|
|
74
|
+
}),
|
|
75
|
+
inline.filter((action)=>'start' !== action.placement).map(renderInline),
|
|
70
76
|
overflow.length > 0 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_dropdown_menu_cjs_namespaceObject.DropdownMenu, {
|
|
71
77
|
open: menuOpen,
|
|
72
78
|
onOpenChange: setMenuOpen,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { JsonTreeNode, NodeAction } from './JsonTree.types';
|
|
2
3
|
export interface RowActionsProps {
|
|
3
4
|
node: JsonTreeNode;
|
|
@@ -5,6 +6,8 @@ export interface RowActionsProps {
|
|
|
5
6
|
actions: NodeAction[];
|
|
6
7
|
/** When the action count exceeds this cap, all actions collapse into one menu. */
|
|
7
8
|
maxInline: number;
|
|
9
|
+
/** Decoration `meta`, rendered between the `start` and `end` actions. */
|
|
10
|
+
meta?: ReactNode;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
13
|
* The trailing icon-button group for a row. Renders `actions` uniformly (icon,
|
|
@@ -12,4 +15,4 @@ export interface RowActionsProps {
|
|
|
12
15
|
* inline; when the count exceeds that cap, every action moves into one menu so
|
|
13
16
|
* the row has a single, predictable overflow state.
|
|
14
17
|
*/
|
|
15
|
-
export declare function RowActions({ node, actions, maxInline }: RowActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export declare function RowActions({ node, actions, maxInline, meta }: RowActionsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -13,32 +13,38 @@ const ACTION_TONE_CLASS = {
|
|
|
13
13
|
warning: 'text-warning hover:text-warning',
|
|
14
14
|
error: 'text-error hover:text-error'
|
|
15
15
|
};
|
|
16
|
-
function RowActions({ node, actions, maxInline }) {
|
|
16
|
+
function RowActions({ node, actions, maxInline, meta }) {
|
|
17
17
|
const strings = useJsonTreeViewStrings();
|
|
18
18
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
19
|
-
if (0 === actions.length) return null;
|
|
19
|
+
if (0 === actions.length && null == meta) return null;
|
|
20
20
|
const overflowing = actions.length > maxInline;
|
|
21
21
|
const inline = overflowing ? [] : actions;
|
|
22
22
|
const overflow = overflowing ? actions : [];
|
|
23
23
|
const moreLabel = strings.moreActions;
|
|
24
|
+
const renderInline = (action)=>/*#__PURE__*/ jsx(JsonTreeTooltip, {
|
|
25
|
+
content: action.tooltip ?? action.label,
|
|
26
|
+
placement: "top",
|
|
27
|
+
delay: true,
|
|
28
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
size: "4xs",
|
|
31
|
+
icon: true,
|
|
32
|
+
disabled: action.disabled,
|
|
33
|
+
onClick: ()=>action.onSelect(node),
|
|
34
|
+
"aria-label": action.label,
|
|
35
|
+
className: cn(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.persistent && 'opacity-100', action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
36
|
+
children: action.icon
|
|
37
|
+
})
|
|
38
|
+
}, action.id);
|
|
24
39
|
return /*#__PURE__*/ jsxs("span", {
|
|
25
40
|
className: "ml-auto flex shrink-0 items-center gap-0.5",
|
|
26
41
|
children: [
|
|
27
|
-
inline.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
size: "4xs",
|
|
34
|
-
icon: true,
|
|
35
|
-
disabled: action.disabled,
|
|
36
|
-
onClick: ()=>action.onSelect(node),
|
|
37
|
-
"aria-label": action.label,
|
|
38
|
-
className: cn(ACTION_BUTTON_CLASS, '[&_svg]:size-2.75', action.tone && ACTION_TONE_CLASS[action.tone], action.active && 'text-brand opacity-100 hover:text-brand'),
|
|
39
|
-
children: action.icon
|
|
40
|
-
})
|
|
41
|
-
}, action.id)),
|
|
42
|
+
inline.filter((action)=>'start' === action.placement).map(renderInline),
|
|
43
|
+
null != meta && /*#__PURE__*/ jsx("span", {
|
|
44
|
+
className: "mx-1.5 flex shrink-0 items-center",
|
|
45
|
+
children: meta
|
|
46
|
+
}),
|
|
47
|
+
inline.filter((action)=>'start' !== action.placement).map(renderInline),
|
|
42
48
|
overflow.length > 0 && /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
43
49
|
open: menuOpen,
|
|
44
50
|
onOpenChange: setMenuOpen,
|
|
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
inferValueType: ()=>inferValueType,
|
|
34
34
|
isArrayItemTemplateRoot: ()=>isArrayItemTemplateRoot,
|
|
35
35
|
isJsonObject: ()=>isJsonObject,
|
|
36
|
+
isPathCollapsed: ()=>isPathCollapsed,
|
|
36
37
|
removeValueAtPath: ()=>removeValueAtPath,
|
|
37
38
|
schemaDisplayType: ()=>schemaDisplayType,
|
|
38
39
|
setValueAtPath: ()=>setValueAtPath
|
|
@@ -41,6 +42,9 @@ const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
|
41
42
|
function hasOwn(object, key) {
|
|
42
43
|
return Object.prototype.hasOwnProperty.call(object, key);
|
|
43
44
|
}
|
|
45
|
+
function isPathCollapsed(collapsed, path) {
|
|
46
|
+
return hasOwn(collapsed, path) && !!collapsed[path];
|
|
47
|
+
}
|
|
44
48
|
function isJsonObject(value) {
|
|
45
49
|
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
46
50
|
}
|
|
@@ -79,7 +83,29 @@ function schemaDisplayType(schema) {
|
|
|
79
83
|
if (void 0 !== enumSample) return inferValueType(enumSample);
|
|
80
84
|
return 'null';
|
|
81
85
|
}
|
|
82
|
-
function
|
|
86
|
+
function buildNodes(inputs) {
|
|
87
|
+
const roots = [];
|
|
88
|
+
const stack = [];
|
|
89
|
+
for(let index = inputs.length - 1; index >= 0; index -= 1)stack.push({
|
|
90
|
+
input: inputs[index],
|
|
91
|
+
siblings: roots
|
|
92
|
+
});
|
|
93
|
+
while(stack.length > 0){
|
|
94
|
+
const { input, siblings } = stack.pop();
|
|
95
|
+
const node = createNode(input);
|
|
96
|
+
siblings.push(node);
|
|
97
|
+
const childInputs = 'object' === node.type ? objectChildInputs(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate) : 'array' === node.type ? arrayChildInputs(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate) : void 0;
|
|
98
|
+
if (!childInputs) continue;
|
|
99
|
+
const children = [];
|
|
100
|
+
node.children = children;
|
|
101
|
+
for(let index = childInputs.length - 1; index >= 0; index -= 1)stack.push({
|
|
102
|
+
input: childInputs[index],
|
|
103
|
+
siblings: children
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return roots;
|
|
107
|
+
}
|
|
108
|
+
function createNode(input) {
|
|
83
109
|
const type = input.hasValue ? inferValueType(input.value) : schemaDisplayType(input.schema);
|
|
84
110
|
const node = {
|
|
85
111
|
key: input.key,
|
|
@@ -91,13 +117,11 @@ function buildNode(input) {
|
|
|
91
117
|
};
|
|
92
118
|
if (input.hasValue) node.value = input.value;
|
|
93
119
|
if (input.isTemplate) node.isArrayItemTemplate = true;
|
|
94
|
-
if ('object' === type) node.children = buildObjectChildren(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate);
|
|
95
|
-
else if ('array' === type) node.children = buildArrayChildren(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate);
|
|
96
120
|
return node;
|
|
97
121
|
}
|
|
98
|
-
function
|
|
122
|
+
function arrayChildInputs(schema, value, hasValue, segments, path, isTemplate) {
|
|
99
123
|
const items = hasValue && Array.isArray(value) ? value : [];
|
|
100
|
-
if (items.length > 0) return items.map((item, index)=>
|
|
124
|
+
if (items.length > 0) return items.map((item, index)=>({
|
|
101
125
|
key: String(index),
|
|
102
126
|
segments: [
|
|
103
127
|
...segments,
|
|
@@ -110,7 +134,7 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
|
|
|
110
134
|
isTemplate
|
|
111
135
|
}));
|
|
112
136
|
if (schema?.items) return [
|
|
113
|
-
|
|
137
|
+
{
|
|
114
138
|
key: '0',
|
|
115
139
|
segments: [
|
|
116
140
|
...segments,
|
|
@@ -120,18 +144,18 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
|
|
|
120
144
|
schema: schema.items,
|
|
121
145
|
hasValue: false,
|
|
122
146
|
isTemplate: true
|
|
123
|
-
}
|
|
147
|
+
}
|
|
124
148
|
];
|
|
125
149
|
return [];
|
|
126
150
|
}
|
|
127
|
-
function
|
|
151
|
+
function objectChildInputs(value, schema, segments, path, isTemplate) {
|
|
128
152
|
const properties = schema?.properties ?? {};
|
|
129
153
|
const required = new Set(schema?.required ?? []);
|
|
130
154
|
const additional = 'object' == typeof schema?.additionalProperties ? schema.additionalProperties : void 0;
|
|
131
155
|
const children = [];
|
|
132
156
|
for (const [key, childSchema] of Object.entries(properties)){
|
|
133
157
|
const hasValue = void 0 !== value && hasOwn(value, key);
|
|
134
|
-
children.push(
|
|
158
|
+
children.push({
|
|
135
159
|
key,
|
|
136
160
|
segments: [
|
|
137
161
|
...segments,
|
|
@@ -143,10 +167,10 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
|
|
|
143
167
|
hasValue,
|
|
144
168
|
required: required.has(key),
|
|
145
169
|
isTemplate
|
|
146
|
-
})
|
|
170
|
+
});
|
|
147
171
|
}
|
|
148
172
|
if (void 0 !== value) {
|
|
149
|
-
for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push(
|
|
173
|
+
for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push({
|
|
150
174
|
key,
|
|
151
175
|
segments: [
|
|
152
176
|
...segments,
|
|
@@ -156,15 +180,15 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
|
|
|
156
180
|
schema: additional,
|
|
157
181
|
value: childValue,
|
|
158
182
|
hasValue: true
|
|
159
|
-
})
|
|
183
|
+
});
|
|
160
184
|
}
|
|
161
185
|
return children;
|
|
162
186
|
}
|
|
163
187
|
function buildJsonTree(options) {
|
|
164
188
|
const { schema, value, basePath = '' } = options;
|
|
165
189
|
const rootIsArray = void 0 !== value ? Array.isArray(value) : !!schema && 'array' === schemaDisplayType(schema);
|
|
166
|
-
if (rootIsArray) return
|
|
167
|
-
return
|
|
190
|
+
if (rootIsArray) return buildNodes(arrayChildInputs(schema, value, void 0 !== value, [], basePath));
|
|
191
|
+
return buildNodes(objectChildInputs(isJsonObject(value) ? value : void 0, schema, [], basePath));
|
|
168
192
|
}
|
|
169
193
|
function isArrayItemTemplateRoot(node) {
|
|
170
194
|
return !!node.isArrayItemTemplate && 'number' == typeof node.segments[node.segments.length - 1];
|
|
@@ -176,47 +200,76 @@ function nodeSelfMatchesQuery(node, query, displayTexts) {
|
|
|
176
200
|
if (display?.sublabel?.toLowerCase().includes(query)) return true;
|
|
177
201
|
return void 0 !== node.value && null !== node.value && 'object' != typeof node.value && String(node.value).toLowerCase().includes(query);
|
|
178
202
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
203
|
+
function indexMatches(nodes, test) {
|
|
204
|
+
const self = new Set();
|
|
205
|
+
const below = new Set();
|
|
206
|
+
const order = [];
|
|
207
|
+
const stack = [
|
|
208
|
+
...nodes
|
|
209
|
+
];
|
|
210
|
+
while(stack.length > 0){
|
|
211
|
+
const node = stack.pop();
|
|
212
|
+
order.push(node);
|
|
213
|
+
if (node.children) for (const child of node.children)stack.push(child);
|
|
214
|
+
}
|
|
215
|
+
for(let index = order.length - 1; index >= 0; index -= 1){
|
|
216
|
+
const node = order[index];
|
|
217
|
+
if (test(node)) self.add(node);
|
|
218
|
+
if (node.children?.some((child)=>self.has(child) || below.has(child))) below.add(node);
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
self,
|
|
222
|
+
below
|
|
223
|
+
};
|
|
186
224
|
}
|
|
187
225
|
function flattenJsonTree(nodes, options = {}, depth = 0) {
|
|
188
|
-
const { collapsed = {},
|
|
189
|
-
const query = options.query?.trim().toLowerCase() ?? '';
|
|
226
|
+
const { collapsed = {}, displayTexts } = options;
|
|
190
227
|
const rows = [];
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
228
|
+
const stack = [];
|
|
229
|
+
const pushChildren = (children, childDepth, query, filterPredicate)=>{
|
|
230
|
+
for(let index = children.length - 1; index >= 0; index -= 1)stack.push({
|
|
231
|
+
node: children[index],
|
|
232
|
+
depth: childDepth,
|
|
233
|
+
query,
|
|
234
|
+
filterPredicate
|
|
235
|
+
});
|
|
236
|
+
};
|
|
237
|
+
const rootQuery = options.query?.trim().toLowerCase() ?? '';
|
|
238
|
+
pushChildren(nodes, depth, rootQuery, options.filterPredicate);
|
|
239
|
+
const queryMatches = rootQuery ? indexMatches(nodes, (node)=>nodeSelfMatchesQuery(node, rootQuery, displayTexts)) : void 0;
|
|
240
|
+
const predicateMatches = options.filterPredicate ? indexMatches(nodes, options.filterPredicate) : void 0;
|
|
241
|
+
while(stack.length > 0){
|
|
242
|
+
const { node, depth: nodeDepth, query, filterPredicate } = stack.pop();
|
|
243
|
+
const selfQueryMatch = !!query && !!queryMatches?.self.has(node);
|
|
244
|
+
if (query && !selfQueryMatch && !queryMatches?.below.has(node)) continue;
|
|
245
|
+
const selfPredicateMatch = !!filterPredicate && !!predicateMatches?.self.has(node);
|
|
246
|
+
if (filterPredicate && !selfPredicateMatch && !predicateMatches?.below.has(node)) continue;
|
|
247
|
+
rows.push({
|
|
248
|
+
node,
|
|
249
|
+
depth: nodeDepth
|
|
250
|
+
});
|
|
251
|
+
if (node.children && !isPathCollapsed(collapsed, node.path)) pushChildren(node.children, nodeDepth + 1, selfQueryMatch ? '' : query, selfPredicateMatch ? void 0 : filterPredicate);
|
|
209
252
|
}
|
|
210
253
|
return rows;
|
|
211
254
|
}
|
|
212
255
|
function collectContainerPaths(nodes, depth = 0) {
|
|
213
256
|
const paths = [];
|
|
214
|
-
|
|
257
|
+
const stack = [];
|
|
258
|
+
for(let index = nodes.length - 1; index >= 0; index -= 1)stack.push({
|
|
259
|
+
node: nodes[index],
|
|
260
|
+
depth
|
|
261
|
+
});
|
|
262
|
+
while(stack.length > 0){
|
|
263
|
+
const { node, depth: nodeDepth } = stack.pop();
|
|
264
|
+
if (!node.children) continue;
|
|
215
265
|
paths.push({
|
|
216
266
|
path: node.path,
|
|
217
|
-
depth
|
|
267
|
+
depth: nodeDepth
|
|
268
|
+
});
|
|
269
|
+
for(let index = node.children.length - 1; index >= 0; index -= 1)stack.push({
|
|
270
|
+
node: node.children[index],
|
|
271
|
+
depth: nodeDepth + 1
|
|
218
272
|
});
|
|
219
|
-
for (const child of collectContainerPaths(node.children, depth + 1))paths.push(child);
|
|
220
273
|
}
|
|
221
274
|
return paths;
|
|
222
275
|
}
|
|
@@ -302,6 +355,7 @@ exports.getValueAtPath = __webpack_exports__.getValueAtPath;
|
|
|
302
355
|
exports.inferValueType = __webpack_exports__.inferValueType;
|
|
303
356
|
exports.isArrayItemTemplateRoot = __webpack_exports__.isArrayItemTemplateRoot;
|
|
304
357
|
exports.isJsonObject = __webpack_exports__.isJsonObject;
|
|
358
|
+
exports.isPathCollapsed = __webpack_exports__.isPathCollapsed;
|
|
305
359
|
exports.removeValueAtPath = __webpack_exports__.removeValueAtPath;
|
|
306
360
|
exports.schemaDisplayType = __webpack_exports__.schemaDisplayType;
|
|
307
361
|
exports.setValueAtPath = __webpack_exports__.setValueAtPath;
|
|
@@ -315,6 +369,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
315
369
|
"inferValueType",
|
|
316
370
|
"isArrayItemTemplateRoot",
|
|
317
371
|
"isJsonObject",
|
|
372
|
+
"isPathCollapsed",
|
|
318
373
|
"removeValueAtPath",
|
|
319
374
|
"schemaDisplayType",
|
|
320
375
|
"setValueAtPath"
|