@c-rex/components 0.3.0-build.31 → 0.3.0-build.32

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-rex/components",
3
- "version": "0.3.0-build.31",
3
+ "version": "0.3.0-build.32",
4
4
  "files": [
5
5
  "src"
6
6
  ],
@@ -76,6 +76,10 @@ const asLiteralArray = (value: unknown): LiteralModel[] => {
76
76
  return value.filter((item): item is LiteralModel => Boolean(item && typeof item === "object"));
77
77
  };
78
78
 
79
+ const resolveObjectRefClassLabel = (item: ObjectRefModel, uiLanguage: string): string | undefined => {
80
+ return resolveLiteralLabel(item.class?.labels || [], uiLanguage);
81
+ };
82
+
79
83
  const buildMetadataDisplayRows = (
80
84
  data: CommonItemsModel,
81
85
  uiLanguage: string,
@@ -177,6 +181,38 @@ const buildMetadataDisplayRows = (
177
181
  const refs = asObjectRefArray(value);
178
182
  if (refs.length === 0) continue;
179
183
 
184
+ if (config.metadataDisplay.sectionStrategy === "class") {
185
+ const groupedValues = new Map<string, Set<string>>();
186
+
187
+ refs.forEach((ref) => {
188
+ const sectionLabel = resolveObjectRefClassLabel(ref, uiLanguage);
189
+ const valueLabel = resolveObjectRefLabel(ref, uiLanguage);
190
+ if (!sectionLabel || !valueLabel) return;
191
+
192
+ const existing = groupedValues.get(sectionLabel) || new Set<string>();
193
+ existing.add(valueLabel);
194
+ groupedValues.set(sectionLabel, existing);
195
+ });
196
+
197
+ if (groupedValues.size > 0) {
198
+ Array.from(groupedValues.entries())
199
+ .sort(([left], [right]) => left.localeCompare(right))
200
+ .forEach(([sectionLabel, valueSet]) => {
201
+ const values = Array.from(valueSet).sort((a, b) => a.localeCompare(b));
202
+ if (values.length === 0) return;
203
+
204
+ rows.push({
205
+ key,
206
+ label: sectionLabel,
207
+ labelSource: "direct",
208
+ values,
209
+ valueType: "text",
210
+ });
211
+ });
212
+ continue;
213
+ }
214
+ }
215
+
180
216
  const values = Array.from(
181
217
  new Set(
182
218
  refs