@atolis-hq/corum 0.1.15 → 0.1.16
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/package.json +1 -1
- package/web/app.jsx +5 -1
- package/web/primitives.jsx +34 -5
- package/web/style.css +8 -0
package/package.json
CHANGED
package/web/app.jsx
CHANGED
|
@@ -451,7 +451,11 @@ function NodePage({ nodeId, templates, onNavigate, refreshToken, viewingRef, ove
|
|
|
451
451
|
<div className="card">
|
|
452
452
|
<div className="card-head">Properties</div>
|
|
453
453
|
<div className="card-body">
|
|
454
|
-
<PropertiesTable
|
|
454
|
+
<PropertiesTable
|
|
455
|
+
properties={root.properties}
|
|
456
|
+
onNavigate={handlePropertyNavigate}
|
|
457
|
+
propertyHints={template?.ui?.propertyDisplay ?? {}}
|
|
458
|
+
/>
|
|
455
459
|
</div>
|
|
456
460
|
</div>
|
|
457
461
|
)}
|
package/web/primitives.jsx
CHANGED
|
@@ -74,10 +74,28 @@ function PropertyValue({ value, onNavigate }) {
|
|
|
74
74
|
return <span>{String(value)}</span>;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
function
|
|
77
|
+
function InlineObjectValue({ value }) {
|
|
78
|
+
if (!value || typeof value !== 'object') return <PropertyValue value={value} />;
|
|
79
|
+
const parts = Object.entries(value).filter(([, v]) => v !== null && v !== undefined);
|
|
80
|
+
if (parts.length === 0) return <span className="prop-empty">-</span>;
|
|
81
|
+
return (
|
|
82
|
+
<span>
|
|
83
|
+
{parts.map(([k, v], i) => (
|
|
84
|
+
<React.Fragment key={k}>
|
|
85
|
+
{i > 0 && <span style={{ margin: '0 6px', opacity: 0.4 }}>|</span>}
|
|
86
|
+
<span className="prop-key-label prop-key-label--inline mono">{k}:</span>
|
|
87
|
+
{' '}{String(v)}
|
|
88
|
+
</React.Fragment>
|
|
89
|
+
))}
|
|
90
|
+
</span>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '', propertyHints = {}) {
|
|
78
95
|
return entries.flatMap(([key, value], index) => {
|
|
79
96
|
const rowPath = parentPath ? `${parentPath}.${key}` : key;
|
|
80
97
|
const rowKey = `${rowPath}:${index}`;
|
|
98
|
+
const hint = depth === 0 ? propertyHints[key] : null;
|
|
81
99
|
|
|
82
100
|
if (Array.isArray(value)) {
|
|
83
101
|
const rows = [{
|
|
@@ -96,7 +114,7 @@ function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '') {
|
|
|
96
114
|
depth: depth + 1,
|
|
97
115
|
value: <span className="prop-empty">-</span>,
|
|
98
116
|
});
|
|
99
|
-
rows.push(...buildPropertyRows(Object.entries(item), onNavigate, depth + 2, itemPath));
|
|
117
|
+
rows.push(...buildPropertyRows(Object.entries(item), onNavigate, depth + 2, itemPath, propertyHints));
|
|
100
118
|
} else {
|
|
101
119
|
rows.push({
|
|
102
120
|
key: `${itemPath}:value`,
|
|
@@ -111,6 +129,17 @@ function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '') {
|
|
|
111
129
|
}
|
|
112
130
|
|
|
113
131
|
if (value && typeof value === 'object' && !('display' in value)) {
|
|
132
|
+
if (hint?.as === 'inline') {
|
|
133
|
+
return [
|
|
134
|
+
{ key: rowKey, label: key, depth, value: <span className="prop-empty">-</span> },
|
|
135
|
+
...Object.entries(value).map(([childKey, childValue], childIndex) => ({
|
|
136
|
+
key: `${rowPath}.${childKey}:${childIndex}`,
|
|
137
|
+
label: childKey,
|
|
138
|
+
depth: depth + 1,
|
|
139
|
+
value: <InlineObjectValue value={childValue} />,
|
|
140
|
+
})),
|
|
141
|
+
];
|
|
142
|
+
}
|
|
114
143
|
return [
|
|
115
144
|
{
|
|
116
145
|
key: rowKey,
|
|
@@ -118,7 +147,7 @@ function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '') {
|
|
|
118
147
|
depth,
|
|
119
148
|
value: <span className="prop-empty">-</span>,
|
|
120
149
|
},
|
|
121
|
-
...buildPropertyRows(Object.entries(value), onNavigate, depth + 1, rowPath),
|
|
150
|
+
...buildPropertyRows(Object.entries(value), onNavigate, depth + 1, rowPath, propertyHints),
|
|
122
151
|
];
|
|
123
152
|
}
|
|
124
153
|
|
|
@@ -131,9 +160,9 @@ function buildPropertyRows(entries, onNavigate, depth = 0, parentPath = '') {
|
|
|
131
160
|
});
|
|
132
161
|
}
|
|
133
162
|
|
|
134
|
-
function PropertiesTable({ properties, onNavigate }) {
|
|
163
|
+
function PropertiesTable({ properties, onNavigate, propertyHints = {} }) {
|
|
135
164
|
const entries = Object.entries(properties ?? {});
|
|
136
|
-
const rows = buildPropertyRows(entries, onNavigate);
|
|
165
|
+
const rows = buildPropertyRows(entries, onNavigate, 0, '', propertyHints);
|
|
137
166
|
if (entries.length === 0) {
|
|
138
167
|
return <p className="label-sm" style={{ padding: '10px 14px' }}>No properties.</p>;
|
|
139
168
|
}
|
package/web/style.css
CHANGED
|
@@ -352,6 +352,14 @@ button {
|
|
|
352
352
|
padding-left: calc(var(--prop-depth, 0) * 24px);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
+
.prop-key-label--inline {
|
|
356
|
+
display: inline;
|
|
357
|
+
padding-left: 0;
|
|
358
|
+
color: var(--ink-3);
|
|
359
|
+
font-size: 11px;
|
|
360
|
+
font-weight: 600;
|
|
361
|
+
}
|
|
362
|
+
|
|
355
363
|
.node-ref-link {
|
|
356
364
|
cursor: pointer;
|
|
357
365
|
color: var(--accent);
|