scb-wc-test 0.1.97 → 0.1.99
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/all.js +0 -72
- package/blazor/ScbBlazorInteropBase.cs +1362 -0
- package/blazor/scb-blazor-bridge.js +1922 -0
- package/package.json +307 -327
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Bas-klass för Razor-komponenter som vill läsa state från SCB web components.
|
|
3
|
+
JS-bryggan (scb-blazor-bridge.js) samlar state från DOM:en och levererar det som ett ScbStateDto. Den här klassen mappar DTO:t till starkt typade C#-klasser
|
|
4
|
+
som kan användas direkt i Razor-vyer */
|
|
5
|
+
|
|
6
|
+
using System;
|
|
7
|
+
using System.Threading.Tasks;
|
|
8
|
+
using Microsoft.AspNetCore.Components;
|
|
9
|
+
using Microsoft.JSInterop;
|
|
10
|
+
|
|
11
|
+
namespace ScbBlazorDemo
|
|
12
|
+
{
|
|
13
|
+
public abstract class ScbBlazorInteropBase : ComponentBase, IAsyncDisposable
|
|
14
|
+
{
|
|
15
|
+
// JSRuntime används för att anropa SCBBlazor-objektet i scb-blazor-bridge.js
|
|
16
|
+
[Inject] protected IJSRuntime JS { get; set; } = default!;
|
|
17
|
+
|
|
18
|
+
// Håller en .NET-referens som JS kan använda för att ropa tillbaka på OnScbEvent
|
|
19
|
+
private DotNetObjectReference<ScbBlazorInteropBase>? _dotNetRef;
|
|
20
|
+
|
|
21
|
+
// Header (scb-header): aktiv flik, drawerstatus och eventuell söktext
|
|
22
|
+
protected HeaderState Header { get; private set; } = new();
|
|
23
|
+
|
|
24
|
+
// Drawer (scb-drawer): öppet/stängt och texter
|
|
25
|
+
protected DrawerState Drawer { get; private set; } = new();
|
|
26
|
+
|
|
27
|
+
// Meny (scb-menu): övergripande öppet/stängt-läge
|
|
28
|
+
protected MenuState Menu { get; private set; } = new();
|
|
29
|
+
|
|
30
|
+
// Alla submenyer (scb-sub-menu) på sidan
|
|
31
|
+
protected SubMenuState[] SubMenus { get; private set; } = Array.Empty<SubMenuState>();
|
|
32
|
+
|
|
33
|
+
// Breadcrumb (scb-breadcrumb): övergripande state
|
|
34
|
+
protected BreadcrumbState Breadcrumb { get; private set; } = new();
|
|
35
|
+
|
|
36
|
+
// Alla breadcrumb-länkar (scb-breadcrumb-item)
|
|
37
|
+
protected BreadcrumbItemState[] BreadcrumbItems { get; private set; } = Array.Empty<BreadcrumbItemState>();
|
|
38
|
+
|
|
39
|
+
// Alla accordions på sidan (scb-accordion) med sina items
|
|
40
|
+
protected AccordionListState[] Accordions { get; private set; } = Array.Empty<AccordionListState>();
|
|
41
|
+
|
|
42
|
+
// Bool-array som speglar checkboxarnas valda läge
|
|
43
|
+
protected bool[] Checkboxes { get; private set; } = Array.Empty<bool>();
|
|
44
|
+
|
|
45
|
+
// Bool-array som speglar switcharnas på/av-läge
|
|
46
|
+
protected bool[] Switches { get; private set; } = Array.Empty<bool>();
|
|
47
|
+
|
|
48
|
+
// App-bar (scb-app-bar)
|
|
49
|
+
protected AppBarState AppBar { get; private set; } = new();
|
|
50
|
+
|
|
51
|
+
// Segmented button (scb-segmented-button)
|
|
52
|
+
protected SegmentedState Segmented { get; private set; } = new();
|
|
53
|
+
|
|
54
|
+
// Alla tabbar (scb-tabs) på sidan
|
|
55
|
+
protected TabsState[] Tabs { get; private set; } = Array.Empty<TabsState>();
|
|
56
|
+
|
|
57
|
+
// Stepper (scb-stepper)
|
|
58
|
+
protected StepperState Stepper { get; private set; } = new();
|
|
59
|
+
|
|
60
|
+
// Cards (scb-card) om man vill läsa av state
|
|
61
|
+
protected CardState[] Cards { get; private set; } = Array.Empty<CardState>();
|
|
62
|
+
|
|
63
|
+
// Nyckeltalskort (scb-keyfigure-card)
|
|
64
|
+
protected KeyfigureState[] Keyfigures { get; private set; } = Array.Empty<KeyfigureState>();
|
|
65
|
+
|
|
66
|
+
// Enskild kalender (scb-calendar-card) för scenarier där man bara bryr sig om en
|
|
67
|
+
protected CalendarState Calendar { get; private set; } = new();
|
|
68
|
+
|
|
69
|
+
// Alla kalenderkort på sidan
|
|
70
|
+
protected CalendarState[] Calendars { get; private set; } = Array.Empty<CalendarState>();
|
|
71
|
+
|
|
72
|
+
// Dialog (scb-dialog)
|
|
73
|
+
protected DialogState Dialog { get; private set; } = new();
|
|
74
|
+
|
|
75
|
+
// Alla notification-kort (scb-notification-card) på sidan
|
|
76
|
+
protected NotificationState[] Notifications { get; private set; } = Array.Empty<NotificationState>();
|
|
77
|
+
|
|
78
|
+
// Alla snackbars (scb-snackbar) på sidan
|
|
79
|
+
protected SnackbarState[] Snackbars { get; private set; } = Array.Empty<SnackbarState>();
|
|
80
|
+
|
|
81
|
+
// Alla statuspiller (scb-status-pill) på sidan
|
|
82
|
+
protected StatusPillState[] StatusPills { get; private set; } = Array.Empty<StatusPillState>();
|
|
83
|
+
|
|
84
|
+
// Alla tooltips (scb-tooltip) på sidan
|
|
85
|
+
protected TooltipState[] Tooltips { get; private set; } = Array.Empty<TooltipState>();
|
|
86
|
+
|
|
87
|
+
// Alla pagination-komponenter (scb-pagination) på sidan
|
|
88
|
+
protected PaginationState[] Paginations { get; private set; } = Array.Empty<PaginationState>();
|
|
89
|
+
|
|
90
|
+
// Alla radio-grupper (scb-radio-group) på sidan
|
|
91
|
+
protected RadioGroupState[] RadioGroups { get; private set; } = Array.Empty<RadioGroupState>();
|
|
92
|
+
|
|
93
|
+
// Alla textfält (scb-textfield) på sidan
|
|
94
|
+
protected TextfieldState[] Textfields { get; private set; } = Array.Empty<TextfieldState>();
|
|
95
|
+
|
|
96
|
+
// Alla sökfält (fristående scb-search) på sidan
|
|
97
|
+
protected SearchState[] Searches { get; private set; } = Array.Empty<SearchState>();
|
|
98
|
+
|
|
99
|
+
// Alla listor (scb-list) med sina list-items (scb-list-item)
|
|
100
|
+
protected ListState[] Lists { get; private set; } = Array.Empty<ListState>();
|
|
101
|
+
|
|
102
|
+
// Alla länkar (scb-link) på sidan
|
|
103
|
+
protected LinkState[] Links { get; private set; } = Array.Empty<LinkState>();
|
|
104
|
+
|
|
105
|
+
// Alla innehållsförteckningar (scb-toc) på sidan
|
|
106
|
+
protected TocState[] Tocs { get; private set; } = Array.Empty<TocState>();
|
|
107
|
+
|
|
108
|
+
// Alla viz-komponenter (scb-viz) på sidan
|
|
109
|
+
protected VizState[] Viz { get; private set; } = Array.Empty<VizState>();
|
|
110
|
+
|
|
111
|
+
// Registrerar JS-interop vid första render och hämtar initialt state
|
|
112
|
+
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
113
|
+
{
|
|
114
|
+
if (firstRender)
|
|
115
|
+
{
|
|
116
|
+
// Skapar en .NET-referens så att JS kan anropa OnScbEvent på rätt instans
|
|
117
|
+
_dotNetRef = DotNetObjectReference.Create(this);
|
|
118
|
+
|
|
119
|
+
// Registrerar eventhanterare i JS (i scb-blazor-bridge.js)
|
|
120
|
+
await JS.InvokeVoidAsync("SCBBlazor.registerScbEventHandlers", _dotNetRef);
|
|
121
|
+
|
|
122
|
+
// Hämtar första snapshoten av state
|
|
123
|
+
await RefreshScbStateAsync();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Läser in hela state-strukturen från JS och mappar till C#-klasserna ovan
|
|
128
|
+
public async Task RefreshScbStateAsync()
|
|
129
|
+
{
|
|
130
|
+
// Hämtar DTO från globala SCBBlazor.getState
|
|
131
|
+
var state = await JS.InvokeAsync<ScbStateDto>("SCBBlazor.getState");
|
|
132
|
+
|
|
133
|
+
// Header
|
|
134
|
+
Header.ActiveTab = state.Header.ActiveTab;
|
|
135
|
+
Header.DrawerOpen = state.Header.DrawerOpen;
|
|
136
|
+
Header.SearchText = state.Header.SearchText ?? string.Empty;
|
|
137
|
+
|
|
138
|
+
// Drawer
|
|
139
|
+
if (state.Drawer is not null)
|
|
140
|
+
{
|
|
141
|
+
Drawer.Open = state.Drawer.Open;
|
|
142
|
+
Drawer.Label = state.Drawer.Label ?? string.Empty;
|
|
143
|
+
Drawer.SubLabel = state.Drawer.SubLabel ?? string.Empty;
|
|
144
|
+
}
|
|
145
|
+
else
|
|
146
|
+
{
|
|
147
|
+
Drawer.Open = false;
|
|
148
|
+
Drawer.Label = string.Empty;
|
|
149
|
+
Drawer.SubLabel = string.Empty;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Meny
|
|
153
|
+
if (state.Menu is not null)
|
|
154
|
+
{
|
|
155
|
+
Menu.Open = state.Menu.Open;
|
|
156
|
+
}
|
|
157
|
+
else
|
|
158
|
+
{
|
|
159
|
+
Menu.Open = false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Sub-menyer
|
|
163
|
+
if (state.SubMenus is not null && state.SubMenus.Length > 0)
|
|
164
|
+
{
|
|
165
|
+
var subMenus = new SubMenuState[state.SubMenus.Length];
|
|
166
|
+
for (var i = 0; i < state.SubMenus.Length; i++)
|
|
167
|
+
{
|
|
168
|
+
var dto = state.SubMenus[i];
|
|
169
|
+
subMenus[i] = new SubMenuState
|
|
170
|
+
{
|
|
171
|
+
Open = dto.Open,
|
|
172
|
+
OpenLeft = dto.OpenLeft
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
SubMenus = subMenus;
|
|
177
|
+
}
|
|
178
|
+
else
|
|
179
|
+
{
|
|
180
|
+
SubMenus = Array.Empty<SubMenuState>();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Breadcrumb
|
|
184
|
+
if (state.Breadcrumb is not null)
|
|
185
|
+
{
|
|
186
|
+
Breadcrumb.ShowAll = state.Breadcrumb.ShowAll;
|
|
187
|
+
}
|
|
188
|
+
else
|
|
189
|
+
{
|
|
190
|
+
Breadcrumb.ShowAll = false;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Breadcrumb-items
|
|
194
|
+
if (state.BreadcrumbItems is not null && state.BreadcrumbItems.Length > 0)
|
|
195
|
+
{
|
|
196
|
+
var items = new BreadcrumbItemState[state.BreadcrumbItems.Length];
|
|
197
|
+
for (var i = 0; i < state.BreadcrumbItems.Length; i++)
|
|
198
|
+
{
|
|
199
|
+
var dto = state.BreadcrumbItems[i];
|
|
200
|
+
items[i] = new BreadcrumbItemState
|
|
201
|
+
{
|
|
202
|
+
Label = dto.Label ?? string.Empty,
|
|
203
|
+
IsCurrent = dto.IsCurrent,
|
|
204
|
+
Href = dto.Href ?? string.Empty,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
BreadcrumbItems = items;
|
|
209
|
+
}
|
|
210
|
+
else
|
|
211
|
+
{
|
|
212
|
+
BreadcrumbItems = Array.Empty<BreadcrumbItemState>();
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Accordions
|
|
216
|
+
if (state.Accordions is not null && state.Accordions.Length > 0)
|
|
217
|
+
{
|
|
218
|
+
var accordions = new AccordionListState[state.Accordions.Length];
|
|
219
|
+
for (var i = 0; i < state.Accordions.Length; i++)
|
|
220
|
+
{
|
|
221
|
+
var dto = state.Accordions[i];
|
|
222
|
+
var items = dto.Items ?? Array.Empty<AccordionItemDto>();
|
|
223
|
+
var itemStates = new AccordionItemState[items.Length];
|
|
224
|
+
|
|
225
|
+
for (var j = 0; j < items.Length; j++)
|
|
226
|
+
{
|
|
227
|
+
var itemDto = items[j];
|
|
228
|
+
itemStates[j] = new AccordionItemState
|
|
229
|
+
{
|
|
230
|
+
Open = itemDto.Open,
|
|
231
|
+
Title = itemDto.Title ?? string.Empty,
|
|
232
|
+
Overline = itemDto.Overline ?? string.Empty,
|
|
233
|
+
SupportingText = itemDto.SupportingText ?? string.Empty
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
accordions[i] = new AccordionListState
|
|
238
|
+
{
|
|
239
|
+
Detached = dto.Detached,
|
|
240
|
+
Items = itemStates
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
Accordions = accordions;
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
{
|
|
248
|
+
Accordions = Array.Empty<AccordionListState>();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Checkboxar och switchar
|
|
252
|
+
Checkboxes = state.Checkboxes ?? Array.Empty<bool>();
|
|
253
|
+
Switches = state.Switches ?? Array.Empty<bool>();
|
|
254
|
+
|
|
255
|
+
// App-bar
|
|
256
|
+
AppBar.Title = state.AppBar.Title ?? string.Empty;
|
|
257
|
+
AppBar.Type = string.IsNullOrWhiteSpace(state.AppBar.Type) ? "default" : state.AppBar.Type!;
|
|
258
|
+
AppBar.Position = string.IsNullOrWhiteSpace(state.AppBar.Position) ? "default" : state.AppBar.Position!;
|
|
259
|
+
AppBar.SearchSupportingText = state.AppBar.SearchSupportingText ?? string.Empty;
|
|
260
|
+
|
|
261
|
+
// Segmented button
|
|
262
|
+
if (state.Segmented is not null)
|
|
263
|
+
{
|
|
264
|
+
Segmented.Value = state.Segmented.Value ?? string.Empty;
|
|
265
|
+
Segmented.Values = state.Segmented.Values ?? Array.Empty<string>();
|
|
266
|
+
}
|
|
267
|
+
else
|
|
268
|
+
{
|
|
269
|
+
Segmented.Value = string.Empty;
|
|
270
|
+
Segmented.Values = Array.Empty<string>();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Tabs
|
|
274
|
+
if (state.Tabs is not null && state.Tabs.Length > 0)
|
|
275
|
+
{
|
|
276
|
+
var tabs = new TabsState[state.Tabs.Length];
|
|
277
|
+
for (var i = 0; i < state.Tabs.Length; i++)
|
|
278
|
+
{
|
|
279
|
+
var dto = state.Tabs[i];
|
|
280
|
+
tabs[i] = new TabsState
|
|
281
|
+
{
|
|
282
|
+
ActiveIndex = dto.ActiveIndex
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
Tabs = tabs;
|
|
286
|
+
}
|
|
287
|
+
else
|
|
288
|
+
{
|
|
289
|
+
Tabs = Array.Empty<TabsState>();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Stepper
|
|
293
|
+
if (state.Stepper is not null)
|
|
294
|
+
{
|
|
295
|
+
Stepper.ActiveIndex = state.Stepper.ActiveIndex;
|
|
296
|
+
Stepper.TotalSteps = state.Stepper.TotalSteps;
|
|
297
|
+
}
|
|
298
|
+
else
|
|
299
|
+
{
|
|
300
|
+
Stepper.ActiveIndex = 0;
|
|
301
|
+
Stepper.TotalSteps = 0;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Cards
|
|
305
|
+
if (state.Cards is not null && state.Cards.Length > 0)
|
|
306
|
+
{
|
|
307
|
+
var cards = new CardState[state.Cards.Length];
|
|
308
|
+
for (var i = 0; i < state.Cards.Length; i++)
|
|
309
|
+
{
|
|
310
|
+
var dto = state.Cards[i];
|
|
311
|
+
cards[i] = new CardState
|
|
312
|
+
{
|
|
313
|
+
Type = dto.Type ?? string.Empty,
|
|
314
|
+
Variant = dto.Variant ?? string.Empty,
|
|
315
|
+
Direction = dto.Direction ?? string.Empty,
|
|
316
|
+
Title = dto.Title ?? string.Empty,
|
|
317
|
+
Subtitle = dto.Subtitle ?? string.Empty,
|
|
318
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
319
|
+
CardHref = dto.CardHref ?? string.Empty
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
Cards = cards;
|
|
323
|
+
}
|
|
324
|
+
else
|
|
325
|
+
{
|
|
326
|
+
Cards = Array.Empty<CardState>();
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Keyfigure cards
|
|
330
|
+
if (state.Keyfigures is not null && state.Keyfigures.Length > 0)
|
|
331
|
+
{
|
|
332
|
+
var keyfigs = new KeyfigureState[state.Keyfigures.Length];
|
|
333
|
+
for (var i = 0; i < state.Keyfigures.Length; i++)
|
|
334
|
+
{
|
|
335
|
+
var dto = state.Keyfigures[i];
|
|
336
|
+
keyfigs[i] = new KeyfigureState
|
|
337
|
+
{
|
|
338
|
+
Keyfigure = dto.Keyfigure ?? string.Empty,
|
|
339
|
+
Subtitle = dto.Subtitle ?? string.Empty,
|
|
340
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
341
|
+
CardHref = dto.CardHref ?? string.Empty,
|
|
342
|
+
Icon = dto.Icon ?? string.Empty,
|
|
343
|
+
Size = dto.Size ?? string.Empty,
|
|
344
|
+
Unit = dto.Unit ?? string.Empty
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
Keyfigures = keyfigs;
|
|
348
|
+
}
|
|
349
|
+
else
|
|
350
|
+
{
|
|
351
|
+
Keyfigures = Array.Empty<KeyfigureState>();
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// Enskild kalender: baseras på första kalendern om en lista finns, annars på state.Calendar
|
|
355
|
+
if (state.Calendars is not null && state.Calendars.Length > 0)
|
|
356
|
+
{
|
|
357
|
+
var dto = state.Calendars[0];
|
|
358
|
+
Calendar.Title = dto.Title ?? string.Empty;
|
|
359
|
+
Calendar.Subtitle = dto.Subtitle ?? string.Empty;
|
|
360
|
+
Calendar.SupportingText = dto.SupportingText ?? string.Empty;
|
|
361
|
+
Calendar.Variant = string.IsNullOrWhiteSpace(dto.Variant)
|
|
362
|
+
? "default"
|
|
363
|
+
: dto.Variant!;
|
|
364
|
+
Calendar.ShowMedia = dto.ShowMedia;
|
|
365
|
+
}
|
|
366
|
+
else if (state.Calendar is not null)
|
|
367
|
+
{
|
|
368
|
+
Calendar.Title = state.Calendar.Title ?? string.Empty;
|
|
369
|
+
Calendar.Subtitle = state.Calendar.Subtitle ?? string.Empty;
|
|
370
|
+
Calendar.SupportingText = state.Calendar.SupportingText ?? string.Empty;
|
|
371
|
+
Calendar.Variant = string.IsNullOrWhiteSpace(state.Calendar.Variant)
|
|
372
|
+
? "default"
|
|
373
|
+
: state.Calendar.Variant!;
|
|
374
|
+
Calendar.ShowMedia = state.Calendar.ShowMedia;
|
|
375
|
+
}
|
|
376
|
+
else
|
|
377
|
+
{
|
|
378
|
+
Calendar.Title = string.Empty;
|
|
379
|
+
Calendar.Subtitle = string.Empty;
|
|
380
|
+
Calendar.SupportingText = string.Empty;
|
|
381
|
+
Calendar.Variant = "default";
|
|
382
|
+
Calendar.ShowMedia = false;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// Lista med alla calendar cards
|
|
386
|
+
if (state.Calendars is not null && state.Calendars.Length > 0)
|
|
387
|
+
{
|
|
388
|
+
var calendars = new CalendarState[state.Calendars.Length];
|
|
389
|
+
for (var i = 0; i < state.Calendars.Length; i++)
|
|
390
|
+
{
|
|
391
|
+
var dto = state.Calendars[i];
|
|
392
|
+
calendars[i] = new CalendarState
|
|
393
|
+
{
|
|
394
|
+
Title = dto.Title ?? string.Empty,
|
|
395
|
+
Subtitle = dto.Subtitle ?? string.Empty,
|
|
396
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
397
|
+
Variant = string.IsNullOrWhiteSpace(dto.Variant)
|
|
398
|
+
? "default"
|
|
399
|
+
: dto.Variant!,
|
|
400
|
+
ShowMedia = dto.ShowMedia
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
Calendars = calendars;
|
|
405
|
+
}
|
|
406
|
+
else
|
|
407
|
+
{
|
|
408
|
+
Calendars = Array.Empty<CalendarState>();
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Dialog
|
|
412
|
+
if (state.Dialog is not null)
|
|
413
|
+
{
|
|
414
|
+
Dialog.Open = state.Dialog.Open;
|
|
415
|
+
Dialog.Variant = state.Dialog.Variant ?? string.Empty;
|
|
416
|
+
Dialog.Label = state.Dialog.Label ?? string.Empty;
|
|
417
|
+
}
|
|
418
|
+
else
|
|
419
|
+
{
|
|
420
|
+
Dialog.Open = false;
|
|
421
|
+
Dialog.Variant = string.Empty;
|
|
422
|
+
Dialog.Label = string.Empty;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Notification cards
|
|
426
|
+
if (state.Notifications is not null && state.Notifications.Length > 0)
|
|
427
|
+
{
|
|
428
|
+
var notifications = new NotificationState[state.Notifications.Length];
|
|
429
|
+
for (var i = 0; i < state.Notifications.Length; i++)
|
|
430
|
+
{
|
|
431
|
+
var dto = state.Notifications[i];
|
|
432
|
+
notifications[i] = new NotificationState
|
|
433
|
+
{
|
|
434
|
+
Open = dto.Open,
|
|
435
|
+
Variant = dto.Variant ?? string.Empty,
|
|
436
|
+
Title = dto.Title ?? string.Empty,
|
|
437
|
+
Subtitle = dto.Subtitle ?? string.Empty,
|
|
438
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
439
|
+
LinkText = dto.LinkText ?? string.Empty,
|
|
440
|
+
LinkHref = dto.LinkHref ?? string.Empty,
|
|
441
|
+
ShowIcon = dto.ShowIcon,
|
|
442
|
+
ShowCloseButton = dto.ShowCloseButton,
|
|
443
|
+
FullHeight = dto.FullHeight,
|
|
444
|
+
FullWidth = dto.FullWidth,
|
|
445
|
+
Direction = dto.Direction ?? string.Empty
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
Notifications = notifications;
|
|
449
|
+
}
|
|
450
|
+
else
|
|
451
|
+
{
|
|
452
|
+
Notifications = Array.Empty<NotificationState>();
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Snackbars
|
|
456
|
+
if (state.Snackbars is not null && state.Snackbars.Length > 0)
|
|
457
|
+
{
|
|
458
|
+
var snackbars = new SnackbarState[state.Snackbars.Length];
|
|
459
|
+
for (var i = 0; i < state.Snackbars.Length; i++)
|
|
460
|
+
{
|
|
461
|
+
var dto = state.Snackbars[i];
|
|
462
|
+
snackbars[i] = new SnackbarState
|
|
463
|
+
{
|
|
464
|
+
Open = dto.Open,
|
|
465
|
+
Message = dto.Message ?? string.Empty,
|
|
466
|
+
ActionText = dto.ActionText ?? string.Empty,
|
|
467
|
+
ShowClose = dto.ShowClose,
|
|
468
|
+
Fixed = dto.Fixed,
|
|
469
|
+
Fadeout = dto.Fadeout,
|
|
470
|
+
WithLongerAction = dto.WithLongerAction
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
Snackbars = snackbars;
|
|
474
|
+
}
|
|
475
|
+
else
|
|
476
|
+
{
|
|
477
|
+
Snackbars = Array.Empty<SnackbarState>();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Status pills
|
|
481
|
+
if (state.StatusPills is not null && state.StatusPills.Length > 0)
|
|
482
|
+
{
|
|
483
|
+
var pills = new StatusPillState[state.StatusPills.Length];
|
|
484
|
+
for (var i = 0; i < state.StatusPills.Length; i++)
|
|
485
|
+
{
|
|
486
|
+
var dto = state.StatusPills[i];
|
|
487
|
+
pills[i] = new StatusPillState
|
|
488
|
+
{
|
|
489
|
+
Status = dto.Status ?? string.Empty,
|
|
490
|
+
Label = dto.Label ?? string.Empty,
|
|
491
|
+
ShowIcon = dto.ShowIcon
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
StatusPills = pills;
|
|
495
|
+
}
|
|
496
|
+
else
|
|
497
|
+
{
|
|
498
|
+
StatusPills = Array.Empty<StatusPillState>();
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// Tooltips
|
|
502
|
+
if (state.Tooltips is not null && state.Tooltips.Length > 0)
|
|
503
|
+
{
|
|
504
|
+
var tips = new TooltipState[state.Tooltips.Length];
|
|
505
|
+
for (var i = 0; i < state.Tooltips.Length; i++)
|
|
506
|
+
{
|
|
507
|
+
var dto = state.Tooltips[i];
|
|
508
|
+
tips[i] = new TooltipState
|
|
509
|
+
{
|
|
510
|
+
Open = dto.Open,
|
|
511
|
+
Variant = dto.Variant ?? string.Empty,
|
|
512
|
+
Position = dto.Position ?? string.Empty,
|
|
513
|
+
Trigger = dto.Trigger ?? string.Empty,
|
|
514
|
+
Delay = dto.Delay,
|
|
515
|
+
Offset = dto.Offset,
|
|
516
|
+
Label = dto.Label ?? string.Empty,
|
|
517
|
+
SupportingText = dto.SupportingText ?? string.Empty
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
Tooltips = tips;
|
|
521
|
+
}
|
|
522
|
+
else
|
|
523
|
+
{
|
|
524
|
+
Tooltips = Array.Empty<TooltipState>();
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// Pagination
|
|
528
|
+
if (state.Paginations is not null && state.Paginations.Length > 0)
|
|
529
|
+
{
|
|
530
|
+
var paginations = new PaginationState[state.Paginations.Length];
|
|
531
|
+
for (var i = 0; i < state.Paginations.Length; i++)
|
|
532
|
+
{
|
|
533
|
+
var dto = state.Paginations[i];
|
|
534
|
+
paginations[i] = new PaginationState
|
|
535
|
+
{
|
|
536
|
+
Page = dto.Page,
|
|
537
|
+
TotalPages = dto.TotalPages
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
Paginations = paginations;
|
|
542
|
+
}
|
|
543
|
+
else
|
|
544
|
+
{
|
|
545
|
+
Paginations = Array.Empty<PaginationState>();
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Radio groups
|
|
549
|
+
if (state.RadioGroups is not null && state.RadioGroups.Length > 0)
|
|
550
|
+
{
|
|
551
|
+
var groups = new RadioGroupState[state.RadioGroups.Length];
|
|
552
|
+
for (var i = 0; i < state.RadioGroups.Length; i++)
|
|
553
|
+
{
|
|
554
|
+
var dto = state.RadioGroups[i];
|
|
555
|
+
groups[i] = new RadioGroupState
|
|
556
|
+
{
|
|
557
|
+
Name = dto.Name ?? string.Empty,
|
|
558
|
+
Value = dto.Value ?? string.Empty
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
RadioGroups = groups;
|
|
562
|
+
}
|
|
563
|
+
else
|
|
564
|
+
{
|
|
565
|
+
RadioGroups = Array.Empty<RadioGroupState>();
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Textfield
|
|
569
|
+
if (state.Textfields is not null && state.Textfields.Length > 0)
|
|
570
|
+
{
|
|
571
|
+
var fields = new TextfieldState[state.Textfields.Length];
|
|
572
|
+
for (var i = 0; i < state.Textfields.Length; i++)
|
|
573
|
+
{
|
|
574
|
+
var dto = state.Textfields[i];
|
|
575
|
+
fields[i] = new TextfieldState
|
|
576
|
+
{
|
|
577
|
+
Value = dto.Value ?? string.Empty,
|
|
578
|
+
Label = dto.Label ?? string.Empty,
|
|
579
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
580
|
+
Error = dto.Error
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
Textfields = fields;
|
|
584
|
+
}
|
|
585
|
+
else
|
|
586
|
+
{
|
|
587
|
+
Textfields = Array.Empty<TextfieldState>();
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// Search
|
|
591
|
+
if (state.Searches is not null && state.Searches.Length > 0)
|
|
592
|
+
{
|
|
593
|
+
var searches = new SearchState[state.Searches.Length];
|
|
594
|
+
for (var i = 0; i < state.Searches.Length; i++)
|
|
595
|
+
{
|
|
596
|
+
var dto = state.Searches[i];
|
|
597
|
+
searches[i] = new SearchState
|
|
598
|
+
{
|
|
599
|
+
Value = dto.Value ?? string.Empty,
|
|
600
|
+
SupportingText = dto.SupportingText ?? string.Empty,
|
|
601
|
+
FullScreen = dto.FullScreen,
|
|
602
|
+
Size = dto.Size ?? string.Empty
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
Searches = searches;
|
|
606
|
+
}
|
|
607
|
+
else
|
|
608
|
+
{
|
|
609
|
+
Searches = Array.Empty<SearchState>();
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
// Listor
|
|
613
|
+
if (state.Lists is not null && state.Lists.Length > 0)
|
|
614
|
+
{
|
|
615
|
+
var lists = new ListState[state.Lists.Length];
|
|
616
|
+
for (var i = 0; i < state.Lists.Length; i++)
|
|
617
|
+
{
|
|
618
|
+
var listDto = state.Lists[i];
|
|
619
|
+
var itemsDto = listDto.Items ?? Array.Empty<ListItemDto>();
|
|
620
|
+
var itemStates = new ListItemState[itemsDto.Length];
|
|
621
|
+
|
|
622
|
+
for (var j = 0; j < itemsDto.Length; j++)
|
|
623
|
+
{
|
|
624
|
+
var itemDto = itemsDto[j];
|
|
625
|
+
itemStates[j] = new ListItemState
|
|
626
|
+
{
|
|
627
|
+
Type = itemDto.Type ?? string.Empty,
|
|
628
|
+
Label = itemDto.Label ?? string.Empty,
|
|
629
|
+
SupportingText = itemDto.SupportingText ?? string.Empty,
|
|
630
|
+
Overline = itemDto.Overline ?? string.Empty,
|
|
631
|
+
Leading = itemDto.Leading,
|
|
632
|
+
LeadingVariant = itemDto.LeadingVariant ?? string.Empty,
|
|
633
|
+
LeadingIcon = itemDto.LeadingIcon ?? string.Empty,
|
|
634
|
+
Trailing = itemDto.Trailing,
|
|
635
|
+
TrailingVariant = itemDto.TrailingVariant ?? string.Empty,
|
|
636
|
+
TrailingIcon = itemDto.TrailingIcon ?? string.Empty,
|
|
637
|
+
Disabled = itemDto.Disabled,
|
|
638
|
+
Href = itemDto.Href ?? string.Empty,
|
|
639
|
+
ItemHref = itemDto.ItemHref ?? string.Empty,
|
|
640
|
+
Target = itemDto.Target ?? string.Empty,
|
|
641
|
+
Density = itemDto.Density,
|
|
642
|
+
NoDivider = itemDto.NoDivider,
|
|
643
|
+
ImgHrefImage = itemDto.ImgHrefImage ?? string.Empty,
|
|
644
|
+
AvatarLabel = itemDto.AvatarLabel ?? string.Empty,
|
|
645
|
+
AvatarAlt = itemDto.AvatarAlt ?? string.Empty,
|
|
646
|
+
AvatarVariant = itemDto.AvatarVariant ?? string.Empty,
|
|
647
|
+
AvatarSrc = itemDto.AvatarSrc ?? string.Empty
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
lists[i] = new ListState
|
|
652
|
+
{
|
|
653
|
+
NoDivider = listDto.NoDivider,
|
|
654
|
+
Items = itemStates
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
Lists = lists;
|
|
659
|
+
}
|
|
660
|
+
else
|
|
661
|
+
{
|
|
662
|
+
Lists = Array.Empty<ListState>();
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// Links
|
|
666
|
+
if (state.Links is not null && state.Links.Length > 0)
|
|
667
|
+
{
|
|
668
|
+
var links = new LinkState[state.Links.Length];
|
|
669
|
+
for (var i = 0; i < state.Links.Length; i++)
|
|
670
|
+
{
|
|
671
|
+
var dto = state.Links[i];
|
|
672
|
+
links[i] = new LinkState
|
|
673
|
+
{
|
|
674
|
+
Href = dto.Href ?? string.Empty,
|
|
675
|
+
Target = dto.Target ?? string.Empty,
|
|
676
|
+
Rel = dto.Rel ?? string.Empty,
|
|
677
|
+
Download = dto.Download ?? string.Empty,
|
|
678
|
+
Disabled = dto.Disabled,
|
|
679
|
+
AriaLabel = dto.AriaLabel ?? string.Empty,
|
|
680
|
+
Text = dto.Text ?? string.Empty
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
Links = links;
|
|
685
|
+
}
|
|
686
|
+
else
|
|
687
|
+
{
|
|
688
|
+
Links = Array.Empty<LinkState>();
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// TOC
|
|
692
|
+
if (state.Tocs is not null && state.Tocs.Length > 0)
|
|
693
|
+
{
|
|
694
|
+
var tocs = new TocState[state.Tocs.Length];
|
|
695
|
+
for (var i = 0; i < state.Tocs.Length; i++)
|
|
696
|
+
{
|
|
697
|
+
var dto = state.Tocs[i];
|
|
698
|
+
var itemsDto = dto.Items ?? Array.Empty<TocItemDto>();
|
|
699
|
+
var itemStates = new TocItemState[itemsDto.Length];
|
|
700
|
+
|
|
701
|
+
for (var j = 0; j < itemsDto.Length; j++)
|
|
702
|
+
{
|
|
703
|
+
var itemDto = itemsDto[j];
|
|
704
|
+
itemStates[j] = new TocItemState
|
|
705
|
+
{
|
|
706
|
+
Expanded = itemDto.Expanded,
|
|
707
|
+
Label = itemDto.Label ?? string.Empty,
|
|
708
|
+
SupportingText = itemDto.SupportingText ?? string.Empty,
|
|
709
|
+
ItemHref = itemDto.ItemHref ?? string.Empty,
|
|
710
|
+
Divider = itemDto.Divider
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
tocs[i] = new TocState
|
|
715
|
+
{
|
|
716
|
+
Detached = dto.Detached,
|
|
717
|
+
Items = itemStates
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
Tocs = tocs;
|
|
722
|
+
}
|
|
723
|
+
else
|
|
724
|
+
{
|
|
725
|
+
Tocs = Array.Empty<TocState>();
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// Viz
|
|
729
|
+
if (state.Viz is not null && state.Viz.Length > 0)
|
|
730
|
+
{
|
|
731
|
+
var vizStates = new VizState[state.Viz.Length];
|
|
732
|
+
for (var i = 0; i < state.Viz.Length; i++)
|
|
733
|
+
{
|
|
734
|
+
var dto = state.Viz[i];
|
|
735
|
+
vizStates[i] = new VizState
|
|
736
|
+
{
|
|
737
|
+
Variant = dto.Variant ?? string.Empty,
|
|
738
|
+
Title = dto.Title ?? string.Empty,
|
|
739
|
+
Subtitle = dto.Subtitle ?? string.Empty,
|
|
740
|
+
Description = dto.Description ?? string.Empty,
|
|
741
|
+
Comment = dto.Comment ?? string.Empty,
|
|
742
|
+
Source = dto.Source ?? string.Empty,
|
|
743
|
+
Footnote = dto.Footnote ?? string.Empty,
|
|
744
|
+
Lang = dto.Lang ?? string.Empty,
|
|
745
|
+
ImageHref = dto.ImageHref ?? string.Empty,
|
|
746
|
+
SelectedChip = dto.SelectedChip ?? string.Empty
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
Viz = vizStates;
|
|
751
|
+
}
|
|
752
|
+
else
|
|
753
|
+
{
|
|
754
|
+
Viz = Array.Empty<VizState>();
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// Hook för arvklasser som vill reagera när state uppdateras
|
|
758
|
+
await OnScbStateChangedAsync();
|
|
759
|
+
|
|
760
|
+
// Talar om för Blazor att state har ändrats
|
|
761
|
+
StateHasChanged();
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// JS anropar denna metod när något normaliserat event inträffar
|
|
765
|
+
[JSInvokable]
|
|
766
|
+
public Task OnScbEvent(string eventName)
|
|
767
|
+
{
|
|
768
|
+
return RefreshScbStateAsync();
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// Kan overridas i arvklasser för att reagera på stateändringar
|
|
772
|
+
protected virtual Task OnScbStateChangedAsync() => Task.CompletedTask;
|
|
773
|
+
|
|
774
|
+
public ValueTask DisposeAsync()
|
|
775
|
+
{
|
|
776
|
+
_dotNetRef?.Dispose();
|
|
777
|
+
return ValueTask.CompletedTask;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// Nedan följer alla state-klasser som används i Razor views
|
|
781
|
+
|
|
782
|
+
protected sealed class HeaderState
|
|
783
|
+
{
|
|
784
|
+
public int ActiveTab { get; set; }
|
|
785
|
+
public bool DrawerOpen { get; set; }
|
|
786
|
+
public string SearchText { get; set; } = string.Empty;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
protected sealed class DrawerState
|
|
790
|
+
{
|
|
791
|
+
public bool Open { get; set; }
|
|
792
|
+
public string Label { get; set; } = string.Empty;
|
|
793
|
+
public string SubLabel { get; set; } = string.Empty;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
protected sealed class MenuState
|
|
797
|
+
{
|
|
798
|
+
public bool Open { get; set; }
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
protected sealed class SubMenuState
|
|
802
|
+
{
|
|
803
|
+
public bool Open { get; set; }
|
|
804
|
+
public bool OpenLeft { get; set; }
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
protected sealed class BreadcrumbState
|
|
808
|
+
{
|
|
809
|
+
public bool ShowAll { get; set; }
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
protected sealed class BreadcrumbItemState
|
|
813
|
+
{
|
|
814
|
+
public string Label { get; set; } = string.Empty;
|
|
815
|
+
public bool IsCurrent { get; set; }
|
|
816
|
+
public string Href { get; set; } = string.Empty;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
protected sealed class AccordionListState
|
|
820
|
+
{
|
|
821
|
+
public bool Detached { get; set; }
|
|
822
|
+
public AccordionItemState[] Items { get; set; } = Array.Empty<AccordionItemState>();
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
protected sealed class AccordionItemState
|
|
826
|
+
{
|
|
827
|
+
public bool Open { get; set; }
|
|
828
|
+
public string Title { get; set; } = string.Empty;
|
|
829
|
+
public string Overline { get; set; } = string.Empty;
|
|
830
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
protected sealed class AppBarState
|
|
834
|
+
{
|
|
835
|
+
public string Title { get; set; } = string.Empty;
|
|
836
|
+
public string Type { get; set; } = "default";
|
|
837
|
+
public string Position { get; set; } = "default";
|
|
838
|
+
public string SearchSupportingText { get; set; } = string.Empty;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
protected sealed class SegmentedState
|
|
842
|
+
{
|
|
843
|
+
public string Value { get; set; } = string.Empty;
|
|
844
|
+
public string[] Values { get; set; } = Array.Empty<string>();
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
protected sealed class TabsState
|
|
848
|
+
{
|
|
849
|
+
public int ActiveIndex { get; set; }
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
protected sealed class StepperState
|
|
853
|
+
{
|
|
854
|
+
public int ActiveIndex { get; set; }
|
|
855
|
+
public int TotalSteps { get; set; }
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
protected sealed class CardState
|
|
859
|
+
{
|
|
860
|
+
public string Type { get; set; } = string.Empty;
|
|
861
|
+
public string Variant { get; set; } = string.Empty;
|
|
862
|
+
public string Direction { get; set; } = string.Empty;
|
|
863
|
+
public string Title { get; set; } = string.Empty;
|
|
864
|
+
public string Subtitle { get; set; } = string.Empty;
|
|
865
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
866
|
+
public string CardHref { get; set; } = string.Empty;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
protected sealed class KeyfigureState
|
|
870
|
+
{
|
|
871
|
+
public string Keyfigure { get; set; } = string.Empty;
|
|
872
|
+
public string Subtitle { get; set; } = string.Empty;
|
|
873
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
874
|
+
public string CardHref { get; set; } = string.Empty;
|
|
875
|
+
public string Icon { get; set; } = string.Empty;
|
|
876
|
+
public string Size { get; set; } = string.Empty;
|
|
877
|
+
public string Unit { get; set; } = string.Empty;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
protected sealed class CalendarState
|
|
881
|
+
{
|
|
882
|
+
public string Title { get; set; } = string.Empty;
|
|
883
|
+
public string Subtitle { get; set; } = string.Empty;
|
|
884
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
885
|
+
public string Variant { get; set; } = "default";
|
|
886
|
+
public bool ShowMedia { get; set; }
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
protected sealed class DialogState
|
|
890
|
+
{
|
|
891
|
+
public bool Open { get; set; }
|
|
892
|
+
public string Variant { get; set; } = string.Empty;
|
|
893
|
+
public string Label { get; set; } = string.Empty;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
protected sealed class NotificationState
|
|
897
|
+
{
|
|
898
|
+
public bool Open { get; set; }
|
|
899
|
+
public string Variant { get; set; } = string.Empty;
|
|
900
|
+
public string Title { get; set; } = string.Empty;
|
|
901
|
+
public string Subtitle { get; set; } = string.Empty;
|
|
902
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
903
|
+
public string LinkText { get; set; } = string.Empty;
|
|
904
|
+
public string LinkHref { get; set; } = string.Empty;
|
|
905
|
+
public bool ShowIcon { get; set; }
|
|
906
|
+
public bool ShowCloseButton { get; set; }
|
|
907
|
+
public bool FullHeight { get; set; }
|
|
908
|
+
public bool FullWidth { get; set; }
|
|
909
|
+
public string Direction { get; set; } = string.Empty;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
protected sealed class SnackbarState
|
|
913
|
+
{
|
|
914
|
+
public bool Open { get; set; }
|
|
915
|
+
public string Message { get; set; } = string.Empty;
|
|
916
|
+
public string ActionText { get; set; } = string.Empty;
|
|
917
|
+
public bool ShowClose { get; set; }
|
|
918
|
+
public bool Fixed { get; set; }
|
|
919
|
+
public bool Fadeout { get; set; }
|
|
920
|
+
public bool WithLongerAction { get; set; }
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
protected sealed class StatusPillState
|
|
924
|
+
{
|
|
925
|
+
public string Status { get; set; } = string.Empty;
|
|
926
|
+
public string Label { get; set; } = string.Empty;
|
|
927
|
+
public bool ShowIcon { get; set; }
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
protected sealed class TooltipState
|
|
931
|
+
{
|
|
932
|
+
public bool Open { get; set; }
|
|
933
|
+
public string Variant { get; set; } = string.Empty;
|
|
934
|
+
public string Position { get; set; } = string.Empty;
|
|
935
|
+
public string Trigger { get; set; } = string.Empty;
|
|
936
|
+
public double Delay { get; set; }
|
|
937
|
+
public double Offset { get; set; }
|
|
938
|
+
public string Label { get; set; } = string.Empty;
|
|
939
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
protected sealed class PaginationState
|
|
943
|
+
{
|
|
944
|
+
public int Page { get; set; }
|
|
945
|
+
public int TotalPages { get; set; }
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
protected sealed class RadioGroupState
|
|
949
|
+
{
|
|
950
|
+
public string Name { get; set; } = string.Empty;
|
|
951
|
+
public string Value { get; set; } = string.Empty;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
protected sealed class TextfieldState
|
|
955
|
+
{
|
|
956
|
+
public string Value { get; set; } = string.Empty;
|
|
957
|
+
public string Label { get; set; } = string.Empty;
|
|
958
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
959
|
+
public bool Error { get; set; }
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
protected sealed class SearchState
|
|
963
|
+
{
|
|
964
|
+
public string Value { get; set; } = string.Empty;
|
|
965
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
966
|
+
public bool FullScreen { get; set; }
|
|
967
|
+
public string Size { get; set; } = string.Empty;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
protected sealed class ListState
|
|
971
|
+
{
|
|
972
|
+
public bool NoDivider { get; set; }
|
|
973
|
+
public ListItemState[] Items { get; set; } = Array.Empty<ListItemState>();
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
protected sealed class ListItemState
|
|
977
|
+
{
|
|
978
|
+
public string Type { get; set; } = string.Empty;
|
|
979
|
+
public string Label { get; set; } = string.Empty;
|
|
980
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
981
|
+
public string Overline { get; set; } = string.Empty;
|
|
982
|
+
public bool Leading { get; set; }
|
|
983
|
+
public string LeadingVariant { get; set; } = string.Empty;
|
|
984
|
+
public string LeadingIcon { get; set; } = string.Empty;
|
|
985
|
+
public bool Trailing { get; set; }
|
|
986
|
+
public string TrailingVariant { get; set; } = string.Empty;
|
|
987
|
+
public string TrailingIcon { get; set; } = string.Empty;
|
|
988
|
+
public bool Disabled { get; set; }
|
|
989
|
+
public string Href { get; set; } = string.Empty;
|
|
990
|
+
public string ItemHref { get; set; } = string.Empty;
|
|
991
|
+
public string Target { get; set; } = string.Empty;
|
|
992
|
+
public int Density { get; set; }
|
|
993
|
+
public bool NoDivider { get; set; }
|
|
994
|
+
public string ImgHrefImage { get; set; } = string.Empty;
|
|
995
|
+
public string AvatarLabel { get; set; } = string.Empty;
|
|
996
|
+
public string AvatarAlt { get; set; } = string.Empty;
|
|
997
|
+
public string AvatarVariant { get; set; } = string.Empty;
|
|
998
|
+
public string AvatarSrc { get; set; } = string.Empty;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
protected sealed class LinkState
|
|
1002
|
+
{
|
|
1003
|
+
public string Href { get; set; } = string.Empty;
|
|
1004
|
+
public string Target { get; set; } = string.Empty;
|
|
1005
|
+
public string Rel { get; set; } = string.Empty;
|
|
1006
|
+
public string Download { get; set; } = string.Empty;
|
|
1007
|
+
public bool Disabled { get; set; }
|
|
1008
|
+
public string AriaLabel { get; set; } = string.Empty;
|
|
1009
|
+
public string Text { get; set; } = string.Empty;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
protected sealed class TocState
|
|
1013
|
+
{
|
|
1014
|
+
public bool Detached { get; set; }
|
|
1015
|
+
public TocItemState[] Items { get; set; } = Array.Empty<TocItemState>();
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
protected sealed class TocItemState
|
|
1019
|
+
{
|
|
1020
|
+
public bool Expanded { get; set; }
|
|
1021
|
+
public string Label { get; set; } = string.Empty;
|
|
1022
|
+
public string SupportingText { get; set; } = string.Empty;
|
|
1023
|
+
public string ItemHref { get; set; } = string.Empty;
|
|
1024
|
+
public bool Divider { get; set; }
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
protected sealed class VizState
|
|
1028
|
+
{
|
|
1029
|
+
public string Variant { get; set; } = string.Empty;
|
|
1030
|
+
public string Title { get; set; } = string.Empty;
|
|
1031
|
+
public string Subtitle { get; set; } = string.Empty;
|
|
1032
|
+
public string Description { get; set; } = string.Empty;
|
|
1033
|
+
public string Comment { get; set; } = string.Empty;
|
|
1034
|
+
public string Source { get; set; } = string.Empty;
|
|
1035
|
+
public string Footnote { get; set; } = string.Empty;
|
|
1036
|
+
public string Lang { get; set; } = string.Empty;
|
|
1037
|
+
public string ImageHref { get; set; } = string.Empty;
|
|
1038
|
+
public string SelectedChip { get; set; } = string.Empty;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
// DTO-klasserna nedan speglar exakt vad JS-bryggan skickar tillbaka
|
|
1042
|
+
|
|
1043
|
+
private sealed class ScbStateDto
|
|
1044
|
+
{
|
|
1045
|
+
public HeaderDto Header { get; set; } = new();
|
|
1046
|
+
|
|
1047
|
+
public DrawerDto Drawer { get; set; } = new();
|
|
1048
|
+
|
|
1049
|
+
public MenuDto Menu { get; set; } = new();
|
|
1050
|
+
|
|
1051
|
+
public SubMenuDto[] SubMenus { get; set; } = Array.Empty<SubMenuDto>();
|
|
1052
|
+
|
|
1053
|
+
public BreadcrumbDto Breadcrumb { get; set; } = new();
|
|
1054
|
+
|
|
1055
|
+
public BreadcrumbItemDto[] BreadcrumbItems { get; set; } = Array.Empty<BreadcrumbItemDto>();
|
|
1056
|
+
|
|
1057
|
+
public AccordionListDto[] Accordions { get; set; } = Array.Empty<AccordionListDto>();
|
|
1058
|
+
|
|
1059
|
+
public bool[] Checkboxes { get; set; } = Array.Empty<bool>();
|
|
1060
|
+
public bool[] Switches { get; set; } = Array.Empty<bool>();
|
|
1061
|
+
public AppBarDto AppBar { get; set; } = new();
|
|
1062
|
+
public SegmentedDto Segmented { get; set; } = new();
|
|
1063
|
+
|
|
1064
|
+
public TabsDto[] Tabs { get; set; } = Array.Empty<TabsDto>();
|
|
1065
|
+
|
|
1066
|
+
public StepperDto Stepper { get; set; } = new();
|
|
1067
|
+
|
|
1068
|
+
public CardDto[] Cards { get; set; } = Array.Empty<CardDto>();
|
|
1069
|
+
|
|
1070
|
+
public KeyfigureDto[] Keyfigures { get; set; } = Array.Empty<KeyfigureDto>();
|
|
1071
|
+
|
|
1072
|
+
public CalendarDto Calendar { get; set; } = new();
|
|
1073
|
+
|
|
1074
|
+
public CalendarDto[] Calendars { get; set; } = Array.Empty<CalendarDto>();
|
|
1075
|
+
|
|
1076
|
+
public DialogDto Dialog { get; set; } = new();
|
|
1077
|
+
|
|
1078
|
+
public NotificationDto[] Notifications { get; set; } = Array.Empty<NotificationDto>();
|
|
1079
|
+
|
|
1080
|
+
public SnackbarDto[] Snackbars { get; set; } = Array.Empty<SnackbarDto>();
|
|
1081
|
+
|
|
1082
|
+
public StatusPillDto[] StatusPills { get; set; } = Array.Empty<StatusPillDto>();
|
|
1083
|
+
|
|
1084
|
+
public TooltipDto[] Tooltips { get; set; } = Array.Empty<TooltipDto>();
|
|
1085
|
+
|
|
1086
|
+
public PaginationDto[] Paginations { get; set; } = Array.Empty<PaginationDto>();
|
|
1087
|
+
|
|
1088
|
+
public RadioGroupDto[] RadioGroups { get; set; } = Array.Empty<RadioGroupDto>();
|
|
1089
|
+
|
|
1090
|
+
public TextfieldDto[] Textfields { get; set; } = Array.Empty<TextfieldDto>();
|
|
1091
|
+
|
|
1092
|
+
public SearchDto[] Searches { get; set; } = Array.Empty<SearchDto>();
|
|
1093
|
+
|
|
1094
|
+
public ListDto[] Lists { get; set; } = Array.Empty<ListDto>();
|
|
1095
|
+
|
|
1096
|
+
public LinkDto[] Links { get; set; } = Array.Empty<LinkDto>();
|
|
1097
|
+
|
|
1098
|
+
public TocDto[] Tocs { get; set; } = Array.Empty<TocDto>();
|
|
1099
|
+
|
|
1100
|
+
public VizDto[] Viz { get; set; } = Array.Empty<VizDto>();
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
private sealed class HeaderDto
|
|
1104
|
+
{
|
|
1105
|
+
public int ActiveTab { get; set; }
|
|
1106
|
+
public bool DrawerOpen { get; set; }
|
|
1107
|
+
public string? SearchText { get; set; }
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
private sealed class DrawerDto
|
|
1111
|
+
{
|
|
1112
|
+
public bool Open { get; set; }
|
|
1113
|
+
public string? Label { get; set; }
|
|
1114
|
+
public string? SubLabel { get; set; }
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
private sealed class MenuDto
|
|
1118
|
+
{
|
|
1119
|
+
public bool Open { get; set; }
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
private sealed class SubMenuDto
|
|
1123
|
+
{
|
|
1124
|
+
public bool Open { get; set; }
|
|
1125
|
+
public bool OpenLeft { get; set; }
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
private sealed class BreadcrumbDto
|
|
1129
|
+
{
|
|
1130
|
+
public bool ShowAll { get; set; }
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
private sealed class BreadcrumbItemDto
|
|
1134
|
+
{
|
|
1135
|
+
public string? Label { get; set; }
|
|
1136
|
+
public bool IsCurrent { get; set; }
|
|
1137
|
+
public string? Href { get; set; }
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
private sealed class AccordionListDto
|
|
1141
|
+
{
|
|
1142
|
+
public bool Detached { get; set; }
|
|
1143
|
+
public AccordionItemDto[] Items { get; set; } = Array.Empty<AccordionItemDto>();
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
private sealed class AccordionItemDto
|
|
1147
|
+
{
|
|
1148
|
+
public bool Open { get; set; }
|
|
1149
|
+
public string? Title { get; set; }
|
|
1150
|
+
public string? Overline { get; set; }
|
|
1151
|
+
public string? SupportingText { get; set; }
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
private sealed class AppBarDto
|
|
1155
|
+
{
|
|
1156
|
+
public string? Title { get; set; }
|
|
1157
|
+
public string? Type { get; set; }
|
|
1158
|
+
public string? Position { get; set; }
|
|
1159
|
+
public string? SearchSupportingText { get; set; }
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
private sealed class SegmentedDto
|
|
1163
|
+
{
|
|
1164
|
+
public string? Value { get; set; }
|
|
1165
|
+
public string[]? Values { get; set; }
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
private sealed class TabsDto
|
|
1169
|
+
{
|
|
1170
|
+
public int ActiveIndex { get; set; }
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
private sealed class StepperDto
|
|
1174
|
+
{
|
|
1175
|
+
public int ActiveIndex { get; set; }
|
|
1176
|
+
public int TotalSteps { get; set; }
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
private sealed class CardDto
|
|
1180
|
+
{
|
|
1181
|
+
public string? Type { get; set; }
|
|
1182
|
+
public string? Variant { get; set; }
|
|
1183
|
+
public string? Direction { get; set; }
|
|
1184
|
+
public string? Title { get; set; }
|
|
1185
|
+
public string? Subtitle { get; set; }
|
|
1186
|
+
public string? SupportingText { get; set; }
|
|
1187
|
+
public string? CardHref { get; set; }
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
private sealed class KeyfigureDto
|
|
1191
|
+
{
|
|
1192
|
+
public string? Keyfigure { get; set; }
|
|
1193
|
+
public string? Subtitle { get; set; }
|
|
1194
|
+
public string? SupportingText { get; set; }
|
|
1195
|
+
public string? CardHref { get; set; }
|
|
1196
|
+
public string? Icon { get; set; }
|
|
1197
|
+
public string? Size { get; set; }
|
|
1198
|
+
public string? Unit { get; set; }
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
private sealed class CalendarDto
|
|
1202
|
+
{
|
|
1203
|
+
public string? Title { get; set; }
|
|
1204
|
+
public string? Subtitle { get; set; }
|
|
1205
|
+
public string? SupportingText { get; set; }
|
|
1206
|
+
public string? Variant { get; set; }
|
|
1207
|
+
public bool ShowMedia { get; set; }
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
private sealed class DialogDto
|
|
1211
|
+
{
|
|
1212
|
+
public bool Open { get; set; }
|
|
1213
|
+
public string? Variant { get; set; }
|
|
1214
|
+
public string? Label { get; set; }
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
private sealed class NotificationDto
|
|
1218
|
+
{
|
|
1219
|
+
public bool Open { get; set; }
|
|
1220
|
+
public string? Variant { get; set; }
|
|
1221
|
+
public string? Title { get; set; }
|
|
1222
|
+
public string? Subtitle { get; set; }
|
|
1223
|
+
public string? SupportingText { get; set; }
|
|
1224
|
+
public string? LinkText { get; set; }
|
|
1225
|
+
public string? LinkHref { get; set; }
|
|
1226
|
+
public bool ShowIcon { get; set; }
|
|
1227
|
+
public bool ShowCloseButton { get; set; }
|
|
1228
|
+
public bool FullHeight { get; set; }
|
|
1229
|
+
public bool FullWidth { get; set; }
|
|
1230
|
+
public string? Direction { get; set; }
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
private sealed class SnackbarDto
|
|
1234
|
+
{
|
|
1235
|
+
public bool Open { get; set; }
|
|
1236
|
+
public string? Message { get; set; }
|
|
1237
|
+
public string? ActionText { get; set; }
|
|
1238
|
+
public bool ShowClose { get; set; }
|
|
1239
|
+
public bool Fixed { get; set; }
|
|
1240
|
+
public bool Fadeout { get; set; }
|
|
1241
|
+
public bool WithLongerAction { get; set; }
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
private sealed class StatusPillDto
|
|
1245
|
+
{
|
|
1246
|
+
public string? Status { get; set; }
|
|
1247
|
+
public string? Label { get; set; }
|
|
1248
|
+
public bool ShowIcon { get; set; }
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
private sealed class TooltipDto
|
|
1252
|
+
{
|
|
1253
|
+
public bool Open { get; set; }
|
|
1254
|
+
public string? Variant { get; set; }
|
|
1255
|
+
public string? Position { get; set; }
|
|
1256
|
+
public string? Trigger { get; set; }
|
|
1257
|
+
public double Delay { get; set; }
|
|
1258
|
+
public double Offset { get; set; }
|
|
1259
|
+
public string? Label { get; set; }
|
|
1260
|
+
public string? SupportingText { get; set; }
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
private sealed class PaginationDto
|
|
1264
|
+
{
|
|
1265
|
+
public int Page { get; set; }
|
|
1266
|
+
public int TotalPages { get; set; }
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
private sealed class RadioGroupDto
|
|
1270
|
+
{
|
|
1271
|
+
public string? Name { get; set; }
|
|
1272
|
+
public string? Value { get; set; }
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
private sealed class TextfieldDto
|
|
1276
|
+
{
|
|
1277
|
+
public string? Value { get; set; }
|
|
1278
|
+
public string? Label { get; set; }
|
|
1279
|
+
public string? SupportingText { get; set; }
|
|
1280
|
+
public bool Error { get; set; }
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
private sealed class SearchDto
|
|
1284
|
+
{
|
|
1285
|
+
public string? Value { get; set; }
|
|
1286
|
+
public string? SupportingText { get; set; }
|
|
1287
|
+
public bool FullScreen { get; set; }
|
|
1288
|
+
public string? Size { get; set; }
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
private sealed class ListDto
|
|
1292
|
+
{
|
|
1293
|
+
public bool NoDivider { get; set; }
|
|
1294
|
+
public ListItemDto[] Items { get; set; } = Array.Empty<ListItemDto>();
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
private sealed class ListItemDto
|
|
1298
|
+
{
|
|
1299
|
+
public string? Type { get; set; }
|
|
1300
|
+
public string? Label { get; set; }
|
|
1301
|
+
public string? SupportingText { get; set; }
|
|
1302
|
+
public string? Overline { get; set; }
|
|
1303
|
+
public bool Leading { get; set; }
|
|
1304
|
+
public string? LeadingVariant { get; set; }
|
|
1305
|
+
public string? LeadingIcon { get; set; }
|
|
1306
|
+
public bool Trailing { get; set; }
|
|
1307
|
+
public string? TrailingVariant { get; set; }
|
|
1308
|
+
public string? TrailingIcon { get; set; }
|
|
1309
|
+
public bool Disabled { get; set; }
|
|
1310
|
+
public string? Href { get; set; }
|
|
1311
|
+
public string? ItemHref { get; set; }
|
|
1312
|
+
public string? Target { get; set; }
|
|
1313
|
+
public int Density { get; set; }
|
|
1314
|
+
public bool NoDivider { get; set; }
|
|
1315
|
+
public string? ImgHrefImage { get; set; }
|
|
1316
|
+
public string? AvatarLabel { get; set; }
|
|
1317
|
+
public string? AvatarAlt { get; set; }
|
|
1318
|
+
public string? AvatarVariant { get; set; }
|
|
1319
|
+
public string? AvatarSrc { get; set; }
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
private sealed class LinkDto
|
|
1323
|
+
{
|
|
1324
|
+
public string? Href { get; set; }
|
|
1325
|
+
public string? Target { get; set; }
|
|
1326
|
+
public string? Rel { get; set; }
|
|
1327
|
+
public string? Download { get; set; }
|
|
1328
|
+
public bool Disabled { get; set; }
|
|
1329
|
+
public string? AriaLabel { get; set; }
|
|
1330
|
+
public string? Text { get; set; }
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
private sealed class TocDto
|
|
1334
|
+
{
|
|
1335
|
+
public bool Detached { get; set; }
|
|
1336
|
+
public TocItemDto[] Items { get; set; } = Array.Empty<TocItemDto>();
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
private sealed class TocItemDto
|
|
1340
|
+
{
|
|
1341
|
+
public bool Expanded { get; set; }
|
|
1342
|
+
public string? Label { get; set; }
|
|
1343
|
+
public string? SupportingText { get; set; }
|
|
1344
|
+
public string? ItemHref { get; set; }
|
|
1345
|
+
public bool Divider { get; set; }
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
private sealed class VizDto
|
|
1349
|
+
{
|
|
1350
|
+
public string? Variant { get; set; }
|
|
1351
|
+
public string? Title { get; set; }
|
|
1352
|
+
public string? Subtitle { get; set; }
|
|
1353
|
+
public string? Description { get; set; }
|
|
1354
|
+
public string? Comment { get; set; }
|
|
1355
|
+
public string? Source { get; set; }
|
|
1356
|
+
public string? Footnote { get; set; }
|
|
1357
|
+
public string? Lang { get; set; }
|
|
1358
|
+
public string? ImageHref { get; set; }
|
|
1359
|
+
public string? SelectedChip { get; set; }
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
}
|