@micha.bigler/ui-core-micha 4.10.0 → 4.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.11.0 - UCM-BILL-7
4
+
5
+ An entry of `AccountPage`'s `extraTabs` accepts an optional `group` naming one of the kit's navigation groups:
6
+ `my-account` (Profil, Sicherheit), `management` (Benutzer, Einladen) or `help` (Support). With it the tab appears in
7
+ that group after the kit's own tabs (in the order of `extraTabs`), in the desktop sidebar and in the phone navigation;
8
+ without `group`, or with `more` or an unknown value, it stays in "Weitere" as before. The kit's own tabs, their order
9
+ and labels are unchanged.
10
+
3
11
  ## 4.10.0 - UCM-BILL-6
4
12
 
5
13
  The account section matches the Maana prototype in three places, against `django-core-micha` >= 3.13.0 (DCM-BILL-6).
package/README.md CHANGED
@@ -16,6 +16,13 @@ Spread `uiCoreTranslations` into the default i18n namespace as the supported agg
16
16
  offer privacy/cookie statement text endpoints; this hides their panels and prevents their requests.
17
17
  The privacy and cookie consent controls and their submitted values remain available.
18
18
 
19
+ ## Account page: extra tabs in a navigation group
20
+
21
+ An entry of `AccountPage`'s `extraTabs` (`{ value, label, content, visible? }`) may carry an optional `group` naming one of
22
+ the kit's navigation groups: `my-account` (Profile, Security), `management` (Users, Invite) or `help` (Support). The tab
23
+ then appears in that group after the kit's own tabs, in the order of `extraTabs`, in the desktop sidebar and in the
24
+ phone navigation. Without `group`, or with `more` or an unknown value, it stays in "More" as before.
25
+
19
26
  ## Consumer integration check
20
27
 
21
28
  ```js
@@ -116,10 +116,9 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
116
116
  return;
117
117
  const isVisible = typeof tab.visible === 'function' ? tab.visible(extensionContext) : true;
118
118
  if (isVisible && !list.some((entry) => entry.value === tab.value)) {
119
- list.push({
120
- value: tab.value,
121
- label: typeof tab.label === 'function' ? tab.label(extensionContext) : tab.label,
122
- });
119
+ // Extra tabs may join my-account, management, or help.
120
+ const group = ['my-account', 'management', 'help'].includes(tab.group) ? tab.group : undefined;
121
+ list.push(Object.assign({ value: tab.value, label: typeof tab.label === 'function' ? tab.label(extensionContext) : tab.label }, (group ? { group } : {})));
123
122
  }
124
123
  });
125
124
  return list;
@@ -142,12 +141,15 @@ export function AccountPage({ userListExtraColumns = [], userListExtraRowActions
142
141
  values: new Set(['support']),
143
142
  },
144
143
  ];
145
- const assignedValues = new Set(groupDefinitions.flatMap((group) => [...group.values]));
144
+ const assignedValues = new Set(groupDefinitions.flatMap((group) => [
145
+ ...group.values,
146
+ ...tabs.filter((tab) => tab.group === group.key).map((tab) => tab.value),
147
+ ]));
146
148
  const mappedGroups = groupDefinitions.map((group) => ({
147
149
  key: group.key,
148
150
  label: group.label,
149
151
  items: tabs
150
- .filter((tab) => group.values.has(tab.value))
152
+ .filter((tab) => group.values.has(tab.value) || tab.group === group.key)
151
153
  .map((tab) => ({ key: tab.value, label: tab.label })),
152
154
  }));
153
155
  const extraItems = tabs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micha.bigler/ui-core-micha",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "exports": {