@uipath/apollo-react 6.72.0 → 6.74.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/canvas/components/JsonTree/JsonTree.cjs +256 -214
- package/dist/canvas/components/JsonTree/JsonTree.d.ts +31 -25
- package/dist/canvas/components/JsonTree/JsonTree.d.ts.map +1 -1
- package/dist/canvas/components/JsonTree/JsonTree.js +238 -217
- package/dist/canvas/components/JsonTree/index.cjs +67 -58
- package/dist/canvas/components/JsonTree/index.d.ts +2 -8
- package/dist/canvas/components/JsonTree/index.d.ts.map +1 -1
- package/dist/canvas/components/JsonTree/index.js +2 -8
- package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts +1 -1
- package/dist/canvas/components/NodeIOView/NodeIOView.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts +1 -1
- package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.cjs +15 -6
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.js +15 -6
- package/dist/canvas/stories/templates/LayoutPreviewsPage.cjs +1257 -0
- package/dist/canvas/stories/templates/LayoutPreviewsPage.d.ts +2 -0
- package/dist/canvas/stories/templates/LayoutPreviewsPage.d.ts.map +1 -0
- package/dist/canvas/stories/templates/LayoutPreviewsPage.js +1223 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +2 -2
- package/dist/canvas/components/JsonTree/DecorationChip.cjs +0 -81
- package/dist/canvas/components/JsonTree/DecorationChip.d.ts +0 -5
- package/dist/canvas/components/JsonTree/DecorationChip.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/DecorationChip.js +0 -47
- package/dist/canvas/components/JsonTree/EditorChrome.cjs +0 -93
- package/dist/canvas/components/JsonTree/EditorChrome.d.ts +0 -18
- package/dist/canvas/components/JsonTree/EditorChrome.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/EditorChrome.js +0 -56
- package/dist/canvas/components/JsonTree/JsonContainerEditor.cjs +0 -103
- package/dist/canvas/components/JsonTree/JsonContainerEditor.d.ts +0 -10
- package/dist/canvas/components/JsonTree/JsonContainerEditor.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonContainerEditor.js +0 -69
- package/dist/canvas/components/JsonTree/JsonLeafValueEditor.cjs +0 -98
- package/dist/canvas/components/JsonTree/JsonLeafValueEditor.d.ts +0 -9
- package/dist/canvas/components/JsonTree/JsonLeafValueEditor.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonLeafValueEditor.js +0 -64
- package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.cjs +0 -86
- package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.d.ts +0 -9
- package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonMultilineLeafEditor.js +0 -52
- package/dist/canvas/components/JsonTree/JsonTree.types.cjs +0 -18
- package/dist/canvas/components/JsonTree/JsonTree.types.d.ts +0 -110
- package/dist/canvas/components/JsonTree/JsonTree.types.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonTree.types.js +0 -0
- package/dist/canvas/components/JsonTree/JsonTreeRow.cjs +0 -358
- package/dist/canvas/components/JsonTree/JsonTreeRow.d.ts +0 -36
- package/dist/canvas/components/JsonTree/JsonTreeRow.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonTreeRow.js +0 -318
- package/dist/canvas/components/JsonTree/JsonTreeToolbar.cjs +0 -224
- package/dist/canvas/components/JsonTree/JsonTreeToolbar.d.ts +0 -17
- package/dist/canvas/components/JsonTree/JsonTreeToolbar.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonTreeToolbar.js +0 -190
- package/dist/canvas/components/JsonTree/JsonTypeBadge.cjs +0 -70
- package/dist/canvas/components/JsonTree/JsonTypeBadge.d.ts +0 -10
- package/dist/canvas/components/JsonTree/JsonTypeBadge.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/JsonTypeBadge.js +0 -36
- package/dist/canvas/components/JsonTree/NodeKey.cjs +0 -86
- package/dist/canvas/components/JsonTree/NodeKey.d.ts +0 -10
- package/dist/canvas/components/JsonTree/NodeKey.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/NodeKey.js +0 -52
- package/dist/canvas/components/JsonTree/RowActions.cjs +0 -121
- package/dist/canvas/components/JsonTree/RowActions.d.ts +0 -8
- package/dist/canvas/components/JsonTree/RowActions.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/RowActions.js +0 -87
- package/dist/canvas/components/JsonTree/ScalarValueCell.cjs +0 -132
- package/dist/canvas/components/JsonTree/ScalarValueCell.d.ts +0 -12
- package/dist/canvas/components/JsonTree/ScalarValueCell.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/ScalarValueCell.js +0 -95
- package/dist/canvas/components/JsonTree/buildJsonTree.cjs +0 -321
- package/dist/canvas/components/JsonTree/buildJsonTree.d.ts +0 -39
- package/dist/canvas/components/JsonTree/buildJsonTree.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/buildJsonTree.js +0 -254
- package/dist/canvas/components/JsonTree/clipboard.cjs +0 -63
- package/dist/canvas/components/JsonTree/clipboard.d.ts +0 -2
- package/dist/canvas/components/JsonTree/clipboard.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/clipboard.js +0 -29
- package/dist/canvas/components/JsonTree/leafEditTypes.cjs +0 -74
- package/dist/canvas/components/JsonTree/leafEditTypes.d.ts +0 -6
- package/dist/canvas/components/JsonTree/leafEditTypes.d.ts.map +0 -1
- package/dist/canvas/components/JsonTree/leafEditTypes.js +0 -34
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { JsonContainer, JsonObject, JsonSchema, JsonTreeNode, JsonTreeNodeType, JsonValue, PathSegment } from './JsonTree.types';
|
|
2
|
-
export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
|
|
3
|
-
export declare function appendPathSegment(path: string, segment: PathSegment): string;
|
|
4
|
-
export declare function inferValueType(value: JsonValue): JsonTreeNodeType;
|
|
5
|
-
export declare function schemaDisplayType(schema: JsonSchema | undefined): JsonTreeNodeType;
|
|
6
|
-
export interface BuildJsonTreeOptions {
|
|
7
|
-
schema?: JsonSchema;
|
|
8
|
-
value?: JsonContainer;
|
|
9
|
-
basePath?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function buildJsonTree(options: BuildJsonTreeOptions): JsonTreeNode[];
|
|
12
|
-
export declare function isArrayItemTemplateRoot(node: JsonTreeNode): boolean;
|
|
13
|
-
export interface FlatJsonTreeRow {
|
|
14
|
-
node: JsonTreeNode;
|
|
15
|
-
depth: number;
|
|
16
|
-
}
|
|
17
|
-
export type NodeDisplayTexts = (node: JsonTreeNode) => {
|
|
18
|
-
label?: string;
|
|
19
|
-
sublabel?: string;
|
|
20
|
-
} | undefined;
|
|
21
|
-
export interface FlattenOptions {
|
|
22
|
-
collapsed?: Record<string, boolean>;
|
|
23
|
-
query?: string;
|
|
24
|
-
filterPredicate?: (node: JsonTreeNode) => boolean;
|
|
25
|
-
displayTexts?: NodeDisplayTexts;
|
|
26
|
-
}
|
|
27
|
-
export declare function flattenJsonTree(nodes: JsonTreeNode[], options?: FlattenOptions, depth?: number): FlatJsonTreeRow[];
|
|
28
|
-
export interface ContainerPath {
|
|
29
|
-
path: string;
|
|
30
|
-
depth: number;
|
|
31
|
-
}
|
|
32
|
-
export declare function collectContainerPaths(nodes: JsonTreeNode[], depth?: number): ContainerPath[];
|
|
33
|
-
export declare function getValueAtPath(root: JsonValue | undefined, segments: PathSegment[]): JsonValue | undefined;
|
|
34
|
-
export declare function setValueAtPath(root: JsonValue | undefined, segments: PathSegment[], value: JsonValue): JsonValue;
|
|
35
|
-
export declare function removeValueAtPath(root: JsonValue | undefined, segments: PathSegment[]): JsonValue | undefined;
|
|
36
|
-
export declare function formatLeafValue(type: JsonTreeNodeType, value: JsonValue | undefined, options?: {
|
|
37
|
-
preserveStringWhitespace?: boolean;
|
|
38
|
-
}): string;
|
|
39
|
-
//# sourceMappingURL=buildJsonTree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildJsonTree.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/JsonTree/buildJsonTree.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,UAAU,EAEV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAI1B,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,KAAK,IAAI,UAAU,CAE9E;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,MAAM,CAI5E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,gBAAgB,CAajE;AAQD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,gBAAgB,CASlF;AAuJD,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB,KAAK,CAAC,EAAE,aAAa,CAAC;IAEtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AASD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,YAAY,EAAE,CAc3E;AASD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAEnE;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,MAAM,gBAAgB,GAAG,CAC7B,IAAI,EAAE,YAAY,KACf;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAAC;AAoCvD,MAAM,WAAW,cAAc;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IAKf,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;IAElD,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAGD,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EAAE,EACrB,OAAO,GAAE,cAAmB,EAC5B,KAAK,SAAI,GACR,eAAe,EAAE,CA2CnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,KAAK,SAAI,GAAG,aAAa,EAAE,CAYvF;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,QAAQ,EAAE,WAAW,EAAE,GACtB,SAAS,GAAG,SAAS,CAcvB;AAOD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,SAAS,GACf,SAAS,CAoBX;AAOD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,QAAQ,EAAE,WAAW,EAAE,GACtB,SAAS,GAAG,SAAS,CAyBvB;AAGD,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE;IAAE,wBAAwB,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/C,MAAM,CAMR"}
|
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
2
|
-
function isJsonObject(value) {
|
|
3
|
-
return 'object' == typeof value && null !== value && !Array.isArray(value);
|
|
4
|
-
}
|
|
5
|
-
function appendPathSegment(path, segment) {
|
|
6
|
-
if ('number' == typeof segment) return `${path}[${segment}]`;
|
|
7
|
-
if (IDENTIFIER_RE.test(segment)) return path ? `${path}.${segment}` : segment;
|
|
8
|
-
return `${path}[${JSON.stringify(segment)}]`;
|
|
9
|
-
}
|
|
10
|
-
function inferValueType(value) {
|
|
11
|
-
if (null === value) return 'null';
|
|
12
|
-
if (Array.isArray(value)) return 'array';
|
|
13
|
-
switch(typeof value){
|
|
14
|
-
case 'string':
|
|
15
|
-
return 'string';
|
|
16
|
-
case 'number':
|
|
17
|
-
return 'number';
|
|
18
|
-
case 'boolean':
|
|
19
|
-
return 'boolean';
|
|
20
|
-
default:
|
|
21
|
-
return 'object';
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function declaredTypes(schema) {
|
|
25
|
-
if (!schema?.type) return;
|
|
26
|
-
return Array.isArray(schema.type) ? schema.type : [
|
|
27
|
-
schema.type
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
function schemaDisplayType(schema) {
|
|
31
|
-
const types = declaredTypes(schema);
|
|
32
|
-
const first = types?.find((t)=>'null' !== t) ?? types?.[0];
|
|
33
|
-
if (first) return 'integer' === first ? 'number' : first;
|
|
34
|
-
if (schema?.properties) return 'object';
|
|
35
|
-
if (schema?.items) return 'array';
|
|
36
|
-
const enumSample = schema?.enum?.find((v)=>null !== v);
|
|
37
|
-
if (void 0 !== enumSample) return inferValueType(enumSample);
|
|
38
|
-
return 'null';
|
|
39
|
-
}
|
|
40
|
-
function buildNode(input) {
|
|
41
|
-
const type = input.hasValue ? inferValueType(input.value) : schemaDisplayType(input.schema);
|
|
42
|
-
const node = {
|
|
43
|
-
key: input.key,
|
|
44
|
-
path: input.path,
|
|
45
|
-
segments: input.segments,
|
|
46
|
-
type,
|
|
47
|
-
required: input.required,
|
|
48
|
-
schema: input.schema
|
|
49
|
-
};
|
|
50
|
-
if (input.hasValue) node.value = input.value;
|
|
51
|
-
if (input.isTemplate) node.isArrayItemTemplate = true;
|
|
52
|
-
if ('object' === type) node.children = buildObjectChildren(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate);
|
|
53
|
-
else if ('array' === type) node.children = buildArrayChildren(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate);
|
|
54
|
-
return node;
|
|
55
|
-
}
|
|
56
|
-
function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate) {
|
|
57
|
-
const items = hasValue && Array.isArray(value) ? value : [];
|
|
58
|
-
if (items.length > 0) return items.map((item, index)=>buildNode({
|
|
59
|
-
key: String(index),
|
|
60
|
-
segments: [
|
|
61
|
-
...segments,
|
|
62
|
-
index
|
|
63
|
-
],
|
|
64
|
-
path: appendPathSegment(path, index),
|
|
65
|
-
schema: schema?.items,
|
|
66
|
-
value: item,
|
|
67
|
-
hasValue: true,
|
|
68
|
-
isTemplate
|
|
69
|
-
}));
|
|
70
|
-
if (schema?.items) return [
|
|
71
|
-
buildNode({
|
|
72
|
-
key: '0',
|
|
73
|
-
segments: [
|
|
74
|
-
...segments,
|
|
75
|
-
0
|
|
76
|
-
],
|
|
77
|
-
path: appendPathSegment(path, 0),
|
|
78
|
-
schema: schema.items,
|
|
79
|
-
hasValue: false,
|
|
80
|
-
isTemplate: true
|
|
81
|
-
})
|
|
82
|
-
];
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
function buildObjectChildren(value, schema, segments, path, isTemplate) {
|
|
86
|
-
const properties = schema?.properties ?? {};
|
|
87
|
-
const required = new Set(schema?.required ?? []);
|
|
88
|
-
const additional = 'object' == typeof schema?.additionalProperties ? schema.additionalProperties : void 0;
|
|
89
|
-
const children = [];
|
|
90
|
-
for (const [key, childSchema] of Object.entries(properties)){
|
|
91
|
-
const hasValue = void 0 !== value && Object.hasOwn(value, key);
|
|
92
|
-
children.push(buildNode({
|
|
93
|
-
key,
|
|
94
|
-
segments: [
|
|
95
|
-
...segments,
|
|
96
|
-
key
|
|
97
|
-
],
|
|
98
|
-
path: appendPathSegment(path, key),
|
|
99
|
-
schema: childSchema,
|
|
100
|
-
value: hasValue ? value?.[key] : void 0,
|
|
101
|
-
hasValue,
|
|
102
|
-
required: required.has(key),
|
|
103
|
-
isTemplate
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
if (void 0 !== value) {
|
|
107
|
-
for (const [key, childValue] of Object.entries(value))if (!Object.hasOwn(properties, key)) children.push(buildNode({
|
|
108
|
-
key,
|
|
109
|
-
segments: [
|
|
110
|
-
...segments,
|
|
111
|
-
key
|
|
112
|
-
],
|
|
113
|
-
path: appendPathSegment(path, key),
|
|
114
|
-
schema: additional,
|
|
115
|
-
value: childValue,
|
|
116
|
-
hasValue: true
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
119
|
-
return children;
|
|
120
|
-
}
|
|
121
|
-
function buildJsonTree(options) {
|
|
122
|
-
const { schema, value, basePath = '' } = options;
|
|
123
|
-
const rootIsArray = void 0 !== value ? Array.isArray(value) : !!schema && 'array' === schemaDisplayType(schema);
|
|
124
|
-
if (rootIsArray) return buildArrayChildren(schema, value, void 0 !== value, [], basePath);
|
|
125
|
-
return buildObjectChildren(isJsonObject(value) ? value : void 0, schema, [], basePath);
|
|
126
|
-
}
|
|
127
|
-
function isArrayItemTemplateRoot(node) {
|
|
128
|
-
return !!node.isArrayItemTemplate && 'number' == typeof node.segments[node.segments.length - 1];
|
|
129
|
-
}
|
|
130
|
-
function nodeSelfMatchesQuery(node, query, displayTexts) {
|
|
131
|
-
if (node.key.toLowerCase().includes(query)) return true;
|
|
132
|
-
const display = displayTexts?.(node);
|
|
133
|
-
if (display?.label?.toLowerCase().includes(query)) return true;
|
|
134
|
-
if (display?.sublabel?.toLowerCase().includes(query)) return true;
|
|
135
|
-
return void 0 !== node.value && null !== node.value && 'object' != typeof node.value && String(node.value).toLowerCase().includes(query);
|
|
136
|
-
}
|
|
137
|
-
function nodeMatchesQuery(node, query, displayTexts) {
|
|
138
|
-
if (nodeSelfMatchesQuery(node, query, displayTexts)) return true;
|
|
139
|
-
return node.children?.some((c)=>nodeMatchesQuery(c, query, displayTexts)) ?? false;
|
|
140
|
-
}
|
|
141
|
-
function nodeOrDescendantMatches(node, predicate) {
|
|
142
|
-
if (predicate(node)) return true;
|
|
143
|
-
return node.children?.some((c)=>nodeOrDescendantMatches(c, predicate)) ?? false;
|
|
144
|
-
}
|
|
145
|
-
function flattenJsonTree(nodes, options = {}, depth = 0) {
|
|
146
|
-
const { collapsed = {}, filterPredicate } = options;
|
|
147
|
-
const query = options.query?.trim().toLowerCase() ?? '';
|
|
148
|
-
const rows = [];
|
|
149
|
-
for (const node of nodes){
|
|
150
|
-
const selfQueryMatch = !!query && nodeSelfMatchesQuery(node, query, options.displayTexts);
|
|
151
|
-
if (query && !selfQueryMatch && !(node.children?.some((c)=>nodeMatchesQuery(c, query, options.displayTexts)) ?? false)) continue;
|
|
152
|
-
const selfPredicateMatch = !!filterPredicate && filterPredicate(node);
|
|
153
|
-
if (!filterPredicate || selfPredicateMatch || (node.children?.some((c)=>nodeOrDescendantMatches(c, filterPredicate)) ?? false)) {
|
|
154
|
-
rows.push({
|
|
155
|
-
node,
|
|
156
|
-
depth
|
|
157
|
-
});
|
|
158
|
-
if (node.children && !collapsed[node.path]) {
|
|
159
|
-
const childOptions = selfQueryMatch || selfPredicateMatch ? {
|
|
160
|
-
...options,
|
|
161
|
-
query: selfQueryMatch ? '' : options.query,
|
|
162
|
-
filterPredicate: selfPredicateMatch ? void 0 : filterPredicate
|
|
163
|
-
} : options;
|
|
164
|
-
for (const row of flattenJsonTree(node.children, childOptions, depth + 1))rows.push(row);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return rows;
|
|
169
|
-
}
|
|
170
|
-
function collectContainerPaths(nodes, depth = 0) {
|
|
171
|
-
const paths = [];
|
|
172
|
-
for (const node of nodes)if (node.children) {
|
|
173
|
-
paths.push({
|
|
174
|
-
path: node.path,
|
|
175
|
-
depth
|
|
176
|
-
});
|
|
177
|
-
for (const child of collectContainerPaths(node.children, depth + 1))paths.push(child);
|
|
178
|
-
}
|
|
179
|
-
return paths;
|
|
180
|
-
}
|
|
181
|
-
function getValueAtPath(root, segments) {
|
|
182
|
-
let current = root;
|
|
183
|
-
for (const segment of segments)if ('number' == typeof segment) {
|
|
184
|
-
if (!Array.isArray(current)) return;
|
|
185
|
-
current = current[segment];
|
|
186
|
-
} else {
|
|
187
|
-
if (!isJsonObject(current) || !Object.hasOwn(current, segment)) return;
|
|
188
|
-
current = current[segment];
|
|
189
|
-
}
|
|
190
|
-
return current;
|
|
191
|
-
}
|
|
192
|
-
function setValueAtPath(root, segments, value) {
|
|
193
|
-
const [head, ...rest] = segments;
|
|
194
|
-
if (void 0 === head) return value;
|
|
195
|
-
if ('number' == typeof head) {
|
|
196
|
-
const array = Array.isArray(root) ? [
|
|
197
|
-
...root
|
|
198
|
-
] : [];
|
|
199
|
-
array[head] = setValueAtPath(array[head], rest, value);
|
|
200
|
-
return array;
|
|
201
|
-
}
|
|
202
|
-
const object = isJsonObject(root) ? {
|
|
203
|
-
...root
|
|
204
|
-
} : {};
|
|
205
|
-
const previous = Object.hasOwn(object, head) ? object[head] : void 0;
|
|
206
|
-
Object.defineProperty(object, head, {
|
|
207
|
-
value: setValueAtPath(previous, rest, value),
|
|
208
|
-
enumerable: true,
|
|
209
|
-
configurable: true,
|
|
210
|
-
writable: true
|
|
211
|
-
});
|
|
212
|
-
return object;
|
|
213
|
-
}
|
|
214
|
-
function removeValueAtPath(root, segments) {
|
|
215
|
-
const [head, ...rest] = segments;
|
|
216
|
-
if (void 0 === head) return;
|
|
217
|
-
if ('number' == typeof head) {
|
|
218
|
-
if (!Array.isArray(root) || head >= root.length) return root;
|
|
219
|
-
if (0 === rest.length) {
|
|
220
|
-
const array = [
|
|
221
|
-
...root
|
|
222
|
-
];
|
|
223
|
-
array.splice(head, 1);
|
|
224
|
-
return array;
|
|
225
|
-
}
|
|
226
|
-
const child = removeValueAtPath(root[head], rest);
|
|
227
|
-
if (child === root[head]) return root;
|
|
228
|
-
const array = [
|
|
229
|
-
...root
|
|
230
|
-
];
|
|
231
|
-
array[head] = child;
|
|
232
|
-
return array;
|
|
233
|
-
}
|
|
234
|
-
if (!isJsonObject(root) || !Object.hasOwn(root, head)) return root;
|
|
235
|
-
if (0 === rest.length) {
|
|
236
|
-
const object = {
|
|
237
|
-
...root
|
|
238
|
-
};
|
|
239
|
-
delete object[head];
|
|
240
|
-
return object;
|
|
241
|
-
}
|
|
242
|
-
const child = removeValueAtPath(root[head], rest);
|
|
243
|
-
if (child === root[head]) return root;
|
|
244
|
-
return {
|
|
245
|
-
...root,
|
|
246
|
-
[head]: child
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
function formatLeafValue(type, value, options) {
|
|
250
|
-
if (null == value) return 'null';
|
|
251
|
-
if ('string' === type) return options?.preserveStringWhitespace ? `"${value}"` : JSON.stringify(value);
|
|
252
|
-
return String(value);
|
|
253
|
-
}
|
|
254
|
-
export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, removeValueAtPath, schemaDisplayType, setValueAtPath };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
copyTextToClipboard: ()=>copyTextToClipboard
|
|
28
|
-
});
|
|
29
|
-
async function copyTextToClipboard(text) {
|
|
30
|
-
if ("u" > typeof navigator && navigator.clipboard) try {
|
|
31
|
-
await navigator.clipboard.writeText(text);
|
|
32
|
-
return true;
|
|
33
|
-
} catch {}
|
|
34
|
-
if ("u" < typeof document) return false;
|
|
35
|
-
const textarea = document.createElement('textarea');
|
|
36
|
-
textarea.value = text;
|
|
37
|
-
textarea.setAttribute('readonly', '');
|
|
38
|
-
textarea.style.position = 'fixed';
|
|
39
|
-
textarea.style.opacity = '0';
|
|
40
|
-
document.body.appendChild(textarea);
|
|
41
|
-
const selection = document.getSelection();
|
|
42
|
-
const previousRange = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
|
|
43
|
-
textarea.select();
|
|
44
|
-
let copied = false;
|
|
45
|
-
try {
|
|
46
|
-
copied = document.execCommand('copy');
|
|
47
|
-
} catch {
|
|
48
|
-
copied = false;
|
|
49
|
-
}
|
|
50
|
-
textarea.remove();
|
|
51
|
-
if (previousRange && selection) {
|
|
52
|
-
selection.removeAllRanges();
|
|
53
|
-
selection.addRange(previousRange);
|
|
54
|
-
}
|
|
55
|
-
return copied;
|
|
56
|
-
}
|
|
57
|
-
exports.copyTextToClipboard = __webpack_exports__.copyTextToClipboard;
|
|
58
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
59
|
-
"copyTextToClipboard"
|
|
60
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
61
|
-
Object.defineProperty(exports, '__esModule', {
|
|
62
|
-
value: true
|
|
63
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/JsonTree/clipboard.ts"],"names":[],"mappings":"AAKA,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CA+BxE"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
async function copyTextToClipboard(text) {
|
|
2
|
-
if ("u" > typeof navigator && navigator.clipboard) try {
|
|
3
|
-
await navigator.clipboard.writeText(text);
|
|
4
|
-
return true;
|
|
5
|
-
} catch {}
|
|
6
|
-
if ("u" < typeof document) return false;
|
|
7
|
-
const textarea = document.createElement('textarea');
|
|
8
|
-
textarea.value = text;
|
|
9
|
-
textarea.setAttribute('readonly', '');
|
|
10
|
-
textarea.style.position = 'fixed';
|
|
11
|
-
textarea.style.opacity = '0';
|
|
12
|
-
document.body.appendChild(textarea);
|
|
13
|
-
const selection = document.getSelection();
|
|
14
|
-
const previousRange = selection && selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
|
|
15
|
-
textarea.select();
|
|
16
|
-
let copied = false;
|
|
17
|
-
try {
|
|
18
|
-
copied = document.execCommand('copy');
|
|
19
|
-
} catch {
|
|
20
|
-
copied = false;
|
|
21
|
-
}
|
|
22
|
-
textarea.remove();
|
|
23
|
-
if (previousRange && selection) {
|
|
24
|
-
selection.removeAllRanges();
|
|
25
|
-
selection.addRange(previousRange);
|
|
26
|
-
}
|
|
27
|
-
return copied;
|
|
28
|
-
}
|
|
29
|
-
export { copyTextToClipboard };
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
isNumericEdit: ()=>isNumericEdit,
|
|
28
|
-
parseLeafValue: ()=>parseLeafValue,
|
|
29
|
-
resolveLeafEditType: ()=>resolveLeafEditType
|
|
30
|
-
});
|
|
31
|
-
function isNumericEdit(editType) {
|
|
32
|
-
return 'number' === editType || 'integer' === editType;
|
|
33
|
-
}
|
|
34
|
-
function resolveLeafEditType(type, schema) {
|
|
35
|
-
const declared = schema?.type === void 0 ? [] : [
|
|
36
|
-
schema.type
|
|
37
|
-
].flat();
|
|
38
|
-
const scalars = declared.filter((t)=>'string' === t || 'number' === t || 'integer' === t);
|
|
39
|
-
if (1 === scalars.length) {
|
|
40
|
-
const only = scalars[0];
|
|
41
|
-
return 'string' === only ? 'string' : 'integer' === only ? 'integer' : 'number';
|
|
42
|
-
}
|
|
43
|
-
if ('string' === type) return 'string';
|
|
44
|
-
if ('number' === type) return 'number';
|
|
45
|
-
return 'auto';
|
|
46
|
-
}
|
|
47
|
-
function parseLeafValue(raw, editType) {
|
|
48
|
-
if ('string' === editType) return raw;
|
|
49
|
-
if (isNumericEdit(editType)) {
|
|
50
|
-
if ('' === raw.trim()) return;
|
|
51
|
-
const parsed = Number(raw);
|
|
52
|
-
if (!Number.isFinite(parsed)) return;
|
|
53
|
-
if ('integer' === editType && !Number.isInteger(parsed)) return;
|
|
54
|
-
return parsed;
|
|
55
|
-
}
|
|
56
|
-
const trimmed = raw.trim();
|
|
57
|
-
if ('' === trimmed) return null;
|
|
58
|
-
try {
|
|
59
|
-
return JSON.parse(trimmed);
|
|
60
|
-
} catch {
|
|
61
|
-
return raw;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
exports.isNumericEdit = __webpack_exports__.isNumericEdit;
|
|
65
|
-
exports.parseLeafValue = __webpack_exports__.parseLeafValue;
|
|
66
|
-
exports.resolveLeafEditType = __webpack_exports__.resolveLeafEditType;
|
|
67
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
68
|
-
"isNumericEdit",
|
|
69
|
-
"parseLeafValue",
|
|
70
|
-
"resolveLeafEditType"
|
|
71
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
72
|
-
Object.defineProperty(exports, '__esModule', {
|
|
73
|
-
value: true
|
|
74
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { JsonSchema, JsonTreeNodeType, JsonValue } from './JsonTree.types';
|
|
2
|
-
export type LeafEditType = 'string' | 'number' | 'integer' | 'auto';
|
|
3
|
-
export declare function isNumericEdit(editType: LeafEditType): boolean;
|
|
4
|
-
export declare function resolveLeafEditType(type: JsonTreeNodeType, schema: JsonSchema | undefined): LeafEditType;
|
|
5
|
-
export declare function parseLeafValue(raw: string, editType: LeafEditType): JsonValue | undefined;
|
|
6
|
-
//# sourceMappingURL=leafEditTypes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leafEditTypes.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/JsonTree/leafEditTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhF,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AAGpE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAE7D;AAQD,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,UAAU,GAAG,SAAS,GAC7B,YAAY,CAUd;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAmBzF"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
function isNumericEdit(editType) {
|
|
2
|
-
return 'number' === editType || 'integer' === editType;
|
|
3
|
-
}
|
|
4
|
-
function resolveLeafEditType(type, schema) {
|
|
5
|
-
const declared = schema?.type === void 0 ? [] : [
|
|
6
|
-
schema.type
|
|
7
|
-
].flat();
|
|
8
|
-
const scalars = declared.filter((t)=>'string' === t || 'number' === t || 'integer' === t);
|
|
9
|
-
if (1 === scalars.length) {
|
|
10
|
-
const only = scalars[0];
|
|
11
|
-
return 'string' === only ? 'string' : 'integer' === only ? 'integer' : 'number';
|
|
12
|
-
}
|
|
13
|
-
if ('string' === type) return 'string';
|
|
14
|
-
if ('number' === type) return 'number';
|
|
15
|
-
return 'auto';
|
|
16
|
-
}
|
|
17
|
-
function parseLeafValue(raw, editType) {
|
|
18
|
-
if ('string' === editType) return raw;
|
|
19
|
-
if (isNumericEdit(editType)) {
|
|
20
|
-
if ('' === raw.trim()) return;
|
|
21
|
-
const parsed = Number(raw);
|
|
22
|
-
if (!Number.isFinite(parsed)) return;
|
|
23
|
-
if ('integer' === editType && !Number.isInteger(parsed)) return;
|
|
24
|
-
return parsed;
|
|
25
|
-
}
|
|
26
|
-
const trimmed = raw.trim();
|
|
27
|
-
if ('' === trimmed) return null;
|
|
28
|
-
try {
|
|
29
|
-
return JSON.parse(trimmed);
|
|
30
|
-
} catch {
|
|
31
|
-
return raw;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export { isNumericEdit, parseLeafValue, resolveLeafEditType };
|