@africanies/angular-web-sdk 0.1.8 → 0.1.10
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/.angular/cache/22.0.9/playground/.tsbuildinfo +1 -1
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/README.md +46 -0
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +243 -0
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/package.json +35 -0
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/tailwind-preset.cjs +330 -0
- package/.nx/cache/1149535958171016935/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +178 -0
- package/.nx/cache/17289624717336768573/dist/libs/africanies-core/README.md +85 -0
- package/.nx/cache/17289624717336768573/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4639 -0
- package/.nx/cache/17289624717336768573/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/17289624717336768573/dist/libs/africanies-core/package.json +31 -0
- package/.nx/cache/17289624717336768573/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2748 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/README.md +68 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +19998 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/package.json +35 -0
- package/.nx/cache/3735952477975556635/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5616 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/README.md +68 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +19500 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/package.json +35 -0
- package/.nx/cache/3953970051755345887/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5521 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/README.md +46 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +243 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/package.json +35 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/tailwind-preset.cjs +330 -0
- package/.nx/cache/4225324930345532464/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +176 -0
- package/.nx/cache/run.json +26 -26
- package/.nx/cache/terminalOutputs/1149535958171016935 +21 -0
- package/.nx/cache/terminalOutputs/12565224028063674529 +37 -0
- package/.nx/cache/terminalOutputs/13478445034325959094 +176 -0
- package/.nx/cache/terminalOutputs/15835338512221847842 +184 -182
- package/.nx/cache/terminalOutputs/17289624717336768573 +21 -0
- package/.nx/cache/terminalOutputs/17571479482482478257 +35 -0
- package/.nx/cache/terminalOutputs/3088264223473143358 +8 -0
- package/.nx/cache/terminalOutputs/3735952477975556635 +21 -0
- package/.nx/cache/terminalOutputs/3953970051755345887 +21 -0
- package/.nx/cache/terminalOutputs/4225324930345532464 +21 -0
- package/.nx/cache/terminalOutputs/4363587767476846758 +176 -0
- package/.nx/cache/terminalOutputs/8193462679279018087 +39 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +5890 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +3610 -3620
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -2
- package/apps/playground/src/app/pages/chip-page.ts +11 -1
- package/apps/playground/src/app/pages/tokens-page.ts +2 -2
- package/apps/playground/src/app/snippets/chip.snippets.ts +5 -0
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +6 -1
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +6 -1
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +8 -8
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-theme/tailwind-preset.cjs +3 -3
- package/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +5 -3
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +848 -375
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +123 -30
- package/libs/africanies-core/src/index.ts +1 -1
- package/libs/africanies-core/src/lib/notification/notification-link.ts +6 -1
- package/libs/africanies-theme/src/lib/mode-color.safelist.ts +2 -2
- package/libs/africanies-theme/src/lib/mode-color.service.spec.ts +9 -7
- package/libs/africanies-theme/src/lib/mode-color.service.ts +9 -7
- package/libs/africanies-theme/tailwind-preset.cjs +3 -3
- package/libs/africanies-ui/src/lib/avatar/avatar-menu.component.ts +25 -21
- package/libs/africanies-ui/src/lib/button/button.component.spec.ts +13 -8
- package/libs/africanies-ui/src/lib/chip/chip.component.ts +74 -6
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +39 -16
- package/libs/africanies-ui/src/lib/layout/header-greeting.util.ts +1 -1
- package/libs/africanies-ui/src/lib/layout/header-weather.spec.ts +87 -5
- package/libs/africanies-ui/src/lib/layout/header-weather.ts +35 -15
- package/libs/africanies-ui/src/lib/navigation/segment/segment.component.ts +98 -22
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +193 -65
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.html +4 -2
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +3 -1
- package/libs/africanies-ui/src/lib/table/table.component.spec.ts +3 -0
- package/libs/africanies-ui/src/lib/table/table.component.ts +197 -57
- package/package.json +1 -1
- package/tools/build-icon-sprite.mjs +1 -1
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
import { NgTemplateOutlet } from '@angular/common';
|
|
2
2
|
import {
|
|
3
|
+
afterNextRender,
|
|
3
4
|
booleanAttribute,
|
|
4
5
|
ChangeDetectionStrategy,
|
|
5
6
|
Component,
|
|
6
7
|
computed,
|
|
7
8
|
contentChildren,
|
|
9
|
+
DestroyRef,
|
|
10
|
+
effect,
|
|
11
|
+
ElementRef,
|
|
8
12
|
inject,
|
|
9
13
|
input,
|
|
10
14
|
numberAttribute,
|
|
11
15
|
output,
|
|
12
16
|
signal,
|
|
13
17
|
TemplateRef,
|
|
18
|
+
viewChild,
|
|
14
19
|
} from '@angular/core';
|
|
15
20
|
|
|
21
|
+
import { ShippingModeService } from '@africanies/africanies-core';
|
|
16
22
|
import { AfricaniesIconComponent } from '@africanies/africanies-icons';
|
|
17
|
-
import type {
|
|
18
|
-
|
|
23
|
+
import type {
|
|
24
|
+
PaginationMetaModel,
|
|
25
|
+
ShippingMode,
|
|
26
|
+
} from '@africanies/africanies-models';
|
|
19
27
|
|
|
20
28
|
import { ButtonComponent } from '../button/button.component';
|
|
21
29
|
import { EmptyStateComponent } from '../feedback/empty-state.component';
|
|
22
30
|
import { ErrorIndicatorComponent } from '../feedback/error-indicator.component';
|
|
23
31
|
import { ErrorStateComponent } from '../feedback/error-state.component';
|
|
24
32
|
import { LoadingStateComponent } from '../feedback/loading-state.component';
|
|
33
|
+
import type { AfricaniesNavItem } from '../navigation/nav-item';
|
|
34
|
+
import { SegmentComponent } from '../navigation/segment/segment.component';
|
|
25
35
|
import { PaginationComponent } from '../pagination/pagination.component';
|
|
26
36
|
import { CellDefDirective } from './cell-def.directive';
|
|
27
37
|
import { HeaderCellDefDirective } from './header-cell-def.directive';
|
|
@@ -35,8 +45,10 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
35
45
|
* `<ng-template africaniesCellDef="key">` templates. Columns without a matching
|
|
36
46
|
* template fall back to rendering `row[key]` as plain text.
|
|
37
47
|
*
|
|
38
|
-
* Optional toolbar: top-left **
|
|
39
|
-
*
|
|
48
|
+
* Optional toolbar: top-left **shipping mode** segment (on by default;
|
|
49
|
+
* `[showShippingMode]="false"` to hide) and **Refresh** (`showRefresh` →
|
|
50
|
+
* {@link refreshClick}). Refresh is hidden while
|
|
51
|
+
* the body shows empty or error — those states expose Retry instead.
|
|
40
52
|
* While {@link refreshing} is true the rows stay on screen — the refresh icon
|
|
41
53
|
* spins (do not swap to a blocking loader). Use {@link loading} when the page
|
|
42
54
|
* of data is changing (pagination / size): rows stay on screen, a keep-rows
|
|
@@ -65,8 +77,9 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
65
77
|
* and never reorder local rows.
|
|
66
78
|
*
|
|
67
79
|
* **Expandable rows:** project `<ng-template africaniesRowDetail="Label" let-row>`
|
|
68
|
-
* templates. A leading chevron column appears; the expanded panel
|
|
69
|
-
*
|
|
80
|
+
* templates. A leading chevron column appears; the expanded panel sticks to the
|
|
81
|
+
* scrollport width (so it does not scroll horizontally with the columns) and
|
|
82
|
+
* lays out label/value pairs in a wrapping auto-fill grid.
|
|
70
83
|
*
|
|
71
84
|
* @typeParam T - Row record shape.
|
|
72
85
|
*
|
|
@@ -121,6 +134,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
121
134
|
ErrorStateComponent,
|
|
122
135
|
LoadingStateComponent,
|
|
123
136
|
PaginationComponent,
|
|
137
|
+
SegmentComponent,
|
|
124
138
|
],
|
|
125
139
|
host: {
|
|
126
140
|
class: 'block w-full min-w-0',
|
|
@@ -134,15 +148,46 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
134
148
|
:host-context(.dark) tr.africanies-table-row:hover > td {
|
|
135
149
|
background-color: #272729;
|
|
136
150
|
}
|
|
151
|
+
|
|
152
|
+
/* Expand panel sticks to the scrollport (not the wide table). Width is
|
|
153
|
+
also set from measured clientWidth so it stays viewport-bound even
|
|
154
|
+
when container query units are flaky inside tables. */
|
|
155
|
+
:host .africanies-table-scrollport {
|
|
156
|
+
container-type: inline-size;
|
|
157
|
+
container-name: africanies-table;
|
|
158
|
+
}
|
|
159
|
+
:host .africanies-table-expand-panel {
|
|
160
|
+
position: sticky;
|
|
161
|
+
left: 0;
|
|
162
|
+
z-index: 1;
|
|
163
|
+
box-sizing: border-box;
|
|
164
|
+
width: 100cqi;
|
|
165
|
+
max-width: 100cqi;
|
|
166
|
+
overflow-x: hidden;
|
|
167
|
+
}
|
|
137
168
|
`,
|
|
138
169
|
template: `
|
|
139
170
|
<div
|
|
140
171
|
class="flex w-full min-w-0 flex-col gap-3"
|
|
141
172
|
[attr.aria-busy]="loading() || refreshing() || null"
|
|
142
173
|
>
|
|
143
|
-
@if (
|
|
144
|
-
|
|
145
|
-
|
|
174
|
+
@if (
|
|
175
|
+
showShippingMode() ||
|
|
176
|
+
showRefresh() ||
|
|
177
|
+
showFilter() ||
|
|
178
|
+
showExport()
|
|
179
|
+
) {
|
|
180
|
+
<div class="flex flex-wrap items-center justify-between gap-2">
|
|
181
|
+
<div class="flex min-w-0 flex-wrap items-center gap-2">
|
|
182
|
+
@if (showShippingMode()) {
|
|
183
|
+
<africanies-segment
|
|
184
|
+
class="min-w-0"
|
|
185
|
+
[items]="shippingModeItems"
|
|
186
|
+
[activeId]="shippingModeActiveId()"
|
|
187
|
+
ariaLabel="Shipping mode"
|
|
188
|
+
(activeIdChange)="onShippingModeChange($event)"
|
|
189
|
+
/>
|
|
190
|
+
}
|
|
146
191
|
@if (showToolbarRefresh()) {
|
|
147
192
|
<button
|
|
148
193
|
africanies-button
|
|
@@ -211,13 +256,18 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
211
256
|
}
|
|
212
257
|
|
|
213
258
|
<div
|
|
214
|
-
class="relative min-w-0 w-full overflow-
|
|
215
|
-
[class.lg:max-h-[min(70dvh,calc(100dvh-12rem))]]="stickyHeader()"
|
|
216
|
-
[class.lg:overflow-auto]="stickyHeader()"
|
|
259
|
+
class="relative min-w-0 w-full overflow-hidden rounded-panel border border-border bg-surface dark:border-white/10 dark:bg-ink-surface"
|
|
217
260
|
>
|
|
218
|
-
<
|
|
219
|
-
|
|
261
|
+
<div
|
|
262
|
+
#scrollport
|
|
263
|
+
class="africanies-table-scrollport min-w-0 w-full overflow-x-auto"
|
|
264
|
+
[class.lg:max-h-[min(70dvh,calc(100dvh-12rem))]]="stickyHeader()"
|
|
265
|
+
[class.lg:overflow-auto]="stickyHeader() && !paginationLoading()"
|
|
266
|
+
[class.pointer-events-none]="paginationLoading()"
|
|
220
267
|
>
|
|
268
|
+
<table
|
|
269
|
+
class="w-max min-w-full table-auto border-separate border-spacing-0 bg-inherit text-left text-body text-ink dark:text-white"
|
|
270
|
+
>
|
|
221
271
|
<thead [class]="headerRowClass()">
|
|
222
272
|
<tr>
|
|
223
273
|
@if (isExpandable()) {
|
|
@@ -228,7 +278,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
228
278
|
@if (someRowsExpanded()) {
|
|
229
279
|
<button
|
|
230
280
|
type="button"
|
|
231
|
-
class="inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-neutral-
|
|
281
|
+
class="inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus dark:text-neutral-400 dark:hover:bg-white/10 dark:hover:text-white"
|
|
232
282
|
aria-label="Collapse all"
|
|
233
283
|
(click)="collapseAllRows()"
|
|
234
284
|
>
|
|
@@ -237,7 +287,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
237
287
|
} @else {
|
|
238
288
|
<button
|
|
239
289
|
type="button"
|
|
240
|
-
class="inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-neutral-
|
|
290
|
+
class="inline-flex size-8 cursor-pointer items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus disabled:cursor-not-allowed disabled:opacity-40 dark:text-neutral-400 dark:hover:bg-white/10 dark:hover:text-white"
|
|
241
291
|
aria-label="Expand all"
|
|
242
292
|
[disabled]="rowList().length === 0"
|
|
243
293
|
(click)="expandAllRows()"
|
|
@@ -261,7 +311,7 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
261
311
|
} @else if (col.sortable) {
|
|
262
312
|
<button
|
|
263
313
|
type="button"
|
|
264
|
-
class="inline-flex cursor-pointer items-center gap-1 rounded-sm font-medium text-neutral-
|
|
314
|
+
class="inline-flex cursor-pointer items-center gap-1 rounded-sm font-medium text-neutral-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus dark:text-neutral-400 dark:hover:text-white"
|
|
265
315
|
(click)="onSortHeaderClick(col.key)"
|
|
266
316
|
>
|
|
267
317
|
<span>{{ col.header }}</span>
|
|
@@ -357,41 +407,52 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
357
407
|
[class.border-border]="isRowExpanded(row, i)"
|
|
358
408
|
[class.dark:border-white/10]="isRowExpanded(row, i)"
|
|
359
409
|
>
|
|
360
|
-
<td class="p-0 align-top" [attr.colspan]="
|
|
410
|
+
<td class="p-0 align-top" [attr.colspan]="colSpan()">
|
|
411
|
+
<!-- Sticky must sit outside overflow-hidden or it pins
|
|
412
|
+
to the full table width and scrolls with the row. -->
|
|
361
413
|
<div
|
|
362
|
-
class="
|
|
363
|
-
[style.
|
|
364
|
-
|
|
365
|
-
"
|
|
366
|
-
[attr.aria-hidden]="!isRowExpanded(row, i)"
|
|
367
|
-
[class.pointer-events-none]="!isRowExpanded(row, i)"
|
|
414
|
+
class="africanies-table-expand-panel bg-surface-sunken dark:bg-white/[0.05]"
|
|
415
|
+
[style.width.px]="scrollportWidthPx() || null"
|
|
416
|
+
[style.maxWidth.px]="scrollportWidthPx() || null"
|
|
368
417
|
>
|
|
369
418
|
<div
|
|
370
|
-
class="
|
|
419
|
+
class="grid transition-[grid-template-rows] duration-200 ease-out motion-reduce:transition-none"
|
|
420
|
+
[style.grid-template-rows]="
|
|
421
|
+
isRowExpanded(row, i) ? '1fr' : '0fr'
|
|
422
|
+
"
|
|
423
|
+
[attr.aria-hidden]="!isRowExpanded(row, i)"
|
|
424
|
+
[class.pointer-events-none]="!isRowExpanded(row, i)"
|
|
371
425
|
>
|
|
372
|
-
<
|
|
373
|
-
class="
|
|
374
|
-
[class.opacity-0]="!isRowExpanded(row, i)"
|
|
375
|
-
[class.opacity-100]="isRowExpanded(row, i)"
|
|
426
|
+
<div
|
|
427
|
+
class="min-h-0 overflow-x-hidden overflow-y-hidden border-t border-border-strong dark:border-white/10"
|
|
376
428
|
>
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
>
|
|
387
|
-
<
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
429
|
+
<dl
|
|
430
|
+
class="m-0 grid grid-cols-[repeat(auto-fill,minmax(11rem,1fr))] gap-x-6 gap-y-3 overflow-x-hidden px-[1.125rem] py-4 transition-opacity duration-200 ease-out motion-reduce:transition-none"
|
|
431
|
+
[class.opacity-0]="!isRowExpanded(row, i)"
|
|
432
|
+
[class.opacity-100]="isRowExpanded(row, i)"
|
|
433
|
+
>
|
|
434
|
+
@for (
|
|
435
|
+
detail of rowDetailDefs();
|
|
436
|
+
track detail.label()
|
|
437
|
+
) {
|
|
438
|
+
<div class="min-w-0">
|
|
439
|
+
<dt
|
|
440
|
+
class="m-0 text-caption font-medium text-neutral-600 dark:text-neutral-400"
|
|
441
|
+
>
|
|
442
|
+
{{ detail.label() }}
|
|
443
|
+
</dt>
|
|
444
|
+
<dd
|
|
445
|
+
class="m-0 mt-0.5 break-words text-body-sm text-ink dark:text-white"
|
|
446
|
+
>
|
|
447
|
+
<ng-container
|
|
448
|
+
[ngTemplateOutlet]="detail.template"
|
|
449
|
+
[ngTemplateOutletContext]="cellContext(row)"
|
|
450
|
+
/>
|
|
451
|
+
</dd>
|
|
452
|
+
</div>
|
|
453
|
+
}
|
|
454
|
+
</dl>
|
|
455
|
+
</div>
|
|
395
456
|
</div>
|
|
396
457
|
</div>
|
|
397
458
|
</td>
|
|
@@ -402,16 +463,21 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
402
463
|
}
|
|
403
464
|
</tbody>
|
|
404
465
|
</table>
|
|
466
|
+
</div>
|
|
405
467
|
@if (paginationLoading()) {
|
|
406
468
|
<div
|
|
407
|
-
class="
|
|
469
|
+
class="absolute inset-0 z-[5] bg-surface/70 dark:bg-ink-950/70"
|
|
408
470
|
data-testid="africanies-table-keep-rows-loading"
|
|
409
471
|
aria-hidden="true"
|
|
410
472
|
>
|
|
411
|
-
<
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
473
|
+
<div
|
|
474
|
+
class="sticky top-0 flex h-[min(70dvh,100%)] items-center justify-center px-4"
|
|
475
|
+
>
|
|
476
|
+
<africanies-loading-state
|
|
477
|
+
mode="inline"
|
|
478
|
+
[message]="loadingLabel()"
|
|
479
|
+
/>
|
|
480
|
+
</div>
|
|
415
481
|
</div>
|
|
416
482
|
}
|
|
417
483
|
</div>
|
|
@@ -429,7 +495,51 @@ import { TableColumn, TableSortChange } from './table-column';
|
|
|
429
495
|
`,
|
|
430
496
|
})
|
|
431
497
|
export class TableComponent<T = unknown> {
|
|
432
|
-
|
|
498
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
499
|
+
protected readonly shipping = inject(ShippingModeService);
|
|
500
|
+
|
|
501
|
+
/** Local STN / SFN segment options for {@link showShippingMode}. */
|
|
502
|
+
protected readonly shippingModeItems: AfricaniesNavItem[] = [
|
|
503
|
+
{ id: 'stn', label: 'Shipping to Nigeria' },
|
|
504
|
+
{ id: 'sfn', label: 'Shipping from Nigeria' },
|
|
505
|
+
];
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Segment selection mirror of {@link ShippingModeService.mode}. Kept local
|
|
509
|
+
* so a denied {@link ShippingModeService.requestModeChange} can snap the
|
|
510
|
+
* pills back when the service mode did not change.
|
|
511
|
+
*/
|
|
512
|
+
protected readonly shippingModeActiveId = signal<string>('sfn');
|
|
513
|
+
|
|
514
|
+
/** Scrollport that owns horizontal overflow for the main grid. */
|
|
515
|
+
private readonly scrollport =
|
|
516
|
+
viewChild<ElementRef<HTMLElement>>('scrollport');
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Visible width of {@link scrollport}. Applied to the expand panel so
|
|
520
|
+
* details stay within the viewport and do not scroll with the columns.
|
|
521
|
+
*/
|
|
522
|
+
protected readonly scrollportWidthPx = signal(0);
|
|
523
|
+
|
|
524
|
+
constructor() {
|
|
525
|
+
effect(() => {
|
|
526
|
+
this.shippingModeActiveId.set(this.shipping.mode());
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
afterNextRender(() => {
|
|
530
|
+
const el = this.scrollport()?.nativeElement;
|
|
531
|
+
if (!el) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
const sync = (): void => {
|
|
535
|
+
this.scrollportWidthPx.set(el.clientWidth);
|
|
536
|
+
};
|
|
537
|
+
sync();
|
|
538
|
+
const observer = new ResizeObserver(sync);
|
|
539
|
+
observer.observe(el);
|
|
540
|
+
this.destroyRef.onDestroy(() => observer.disconnect());
|
|
541
|
+
});
|
|
542
|
+
}
|
|
433
543
|
|
|
434
544
|
/**
|
|
435
545
|
* When false, hides row expansion even if {@link RowDetailDefDirective}
|
|
@@ -470,6 +580,14 @@ export class TableComponent<T = unknown> {
|
|
|
470
580
|
*/
|
|
471
581
|
readonly sort = input<TableSortChange | null>(null);
|
|
472
582
|
|
|
583
|
+
/**
|
|
584
|
+
* Show the Shipping to / from Nigeria segment above the table (top-left).
|
|
585
|
+
* On by default; set `[showShippingMode]="false"` to hide (e.g. modals).
|
|
586
|
+
* Writes through {@link ShippingModeService.requestModeChange} so feature
|
|
587
|
+
* guards still run.
|
|
588
|
+
*/
|
|
589
|
+
readonly showShippingMode = input(true, { transform: booleanAttribute });
|
|
590
|
+
|
|
473
591
|
/**
|
|
474
592
|
* Show a Refresh button above the table (top-left) once rows are on screen.
|
|
475
593
|
* Hidden during in-grid empty/error — those use Retry in the body. Host refetches
|
|
@@ -626,6 +744,27 @@ export class TableComponent<T = unknown> {
|
|
|
626
744
|
() => this.showRefresh() && this.bodyKind() === 'rows',
|
|
627
745
|
);
|
|
628
746
|
|
|
747
|
+
/**
|
|
748
|
+
* Applies a shipping-mode segment selection through
|
|
749
|
+
* {@link ShippingModeService.requestModeChange}.
|
|
750
|
+
*
|
|
751
|
+
* @param id - Segment id (`stn` / `sfn`) or null.
|
|
752
|
+
*/
|
|
753
|
+
protected onShippingModeChange(id: string | null): void {
|
|
754
|
+
if (id !== 'stn' && id !== 'sfn') {
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
this.shippingModeActiveId.set(id);
|
|
758
|
+
if (id === this.shipping.mode()) {
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
this.shipping.requestModeChange(id as ShippingMode).subscribe((ok) => {
|
|
762
|
+
if (!ok) {
|
|
763
|
+
this.shippingModeActiveId.set(this.shipping.mode());
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
|
|
629
768
|
protected readonly visibleRowIds = computed(() =>
|
|
630
769
|
this.rowList().map((row, index) => this.rowId(row, index)),
|
|
631
770
|
);
|
|
@@ -691,11 +830,12 @@ export class TableComponent<T = unknown> {
|
|
|
691
830
|
}
|
|
692
831
|
|
|
693
832
|
/**
|
|
694
|
-
* Opaque
|
|
695
|
-
*
|
|
833
|
+
* Opaque header fill (sticky-safe). Neutral chrome — not mode-accented.
|
|
834
|
+
* Light `#f0f2f5` / dark elevated ink surface.
|
|
835
|
+
* @returns Background utility classes.
|
|
696
836
|
*/
|
|
697
837
|
protected headerSoftClass(): string {
|
|
698
|
-
return
|
|
838
|
+
return 'bg-[#f0f2f5] dark:bg-[#2a2c31]';
|
|
699
839
|
}
|
|
700
840
|
|
|
701
841
|
/**
|
|
@@ -777,7 +917,7 @@ export class TableComponent<T = unknown> {
|
|
|
777
917
|
: 'border-b ';
|
|
778
918
|
return (
|
|
779
919
|
border +
|
|
780
|
-
'border-border whitespace-normal wrap-break-word px-[1.125rem] py-4 font-medium text-neutral-
|
|
920
|
+
'border-border whitespace-normal wrap-break-word px-[1.125rem] py-4 font-medium text-neutral-500 dark:border-white/10 dark:text-neutral-400 ' +
|
|
781
921
|
this.headerSoftClass() +
|
|
782
922
|
' ' +
|
|
783
923
|
this.stickySurfaceClass(col, 'head') +
|
package/package.json
CHANGED