@nucleus-suite-pe/core 0.3.0 → 0.5.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/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { InjectionToken, EnvironmentProviders, Signal } from '@angular/core';
|
|
2
|
+
import { InjectionToken, EnvironmentProviders, Signal, TemplateRef } from '@angular/core';
|
|
3
3
|
import { HttpContextToken, HttpInterceptorFn } from '@angular/common/http';
|
|
4
4
|
import * as _primeuix_themes from '@primeuix/themes';
|
|
5
5
|
import * as _primeuix_themes_types_base from '@primeuix/themes/types/base';
|
|
6
6
|
import * as _nucleus_suite_pe_core from '@nucleus-suite-pe/core';
|
|
7
|
+
import { MenuItem } from 'primeng/api';
|
|
7
8
|
|
|
8
9
|
interface NucleusConfig {
|
|
9
10
|
readonly appId: string;
|
|
@@ -183,6 +184,17 @@ interface AppSummary {
|
|
|
183
184
|
}
|
|
184
185
|
type LauncherApp = AppSummary;
|
|
185
186
|
|
|
187
|
+
interface MenuPermissions {
|
|
188
|
+
readonly canView: boolean;
|
|
189
|
+
readonly canInsert: boolean;
|
|
190
|
+
readonly canEdit: boolean;
|
|
191
|
+
readonly canDelete: boolean;
|
|
192
|
+
readonly canExport: boolean;
|
|
193
|
+
}
|
|
194
|
+
declare const NO_PERMISSIONS: MenuPermissions;
|
|
195
|
+
declare function findMenuByRoute(nodes: readonly MenuNode[], route: string): MenuNode | null;
|
|
196
|
+
declare function permissionsOf(node: MenuNode | null): MenuPermissions;
|
|
197
|
+
|
|
186
198
|
declare class SessionService {
|
|
187
199
|
private readonly http;
|
|
188
200
|
private readonly auth;
|
|
@@ -217,6 +229,7 @@ declare class SessionService {
|
|
|
217
229
|
readonly companyId: _angular_core.Signal<string | null>;
|
|
218
230
|
readonly companyName: _angular_core.Signal<string | null>;
|
|
219
231
|
load(language: string, force?: boolean): Promise<void>;
|
|
232
|
+
permissionsFor(route: string): MenuPermissions;
|
|
220
233
|
reload(language: string): Promise<void>;
|
|
221
234
|
sites(companyId: string): Promise<Site[]>;
|
|
222
235
|
accessibleSites(companyId: string): Promise<Site[]>;
|
|
@@ -283,6 +296,155 @@ declare const NucleusPreset: _primeuix_themes.Preset<_primeuix_themes_types_base
|
|
|
283
296
|
declare const NUCLEUS_DARK_SELECTOR = ".ns-dark";
|
|
284
297
|
declare function provideNucleusTheme(): EnvironmentProviders;
|
|
285
298
|
|
|
299
|
+
declare function loadLordicon(): Promise<void>;
|
|
300
|
+
declare const NUCLEUS_ICONS: {
|
|
301
|
+
readonly trash: "https://cdn.lordicon.com/wpyrrmcq.json";
|
|
302
|
+
readonly check: "https://cdn.lordicon.com/lomfljuq.json";
|
|
303
|
+
readonly warning: "https://cdn.lordicon.com/vihyezfv.json";
|
|
304
|
+
readonly power: "https://cdn.lordicon.com/gwvmctbb.json";
|
|
305
|
+
readonly user: "https://cdn.lordicon.com/hrjifpbq.json";
|
|
306
|
+
readonly key: "https://cdn.lordicon.com/ossgtprr.json";
|
|
307
|
+
};
|
|
308
|
+
declare class NucleusLordicon {
|
|
309
|
+
private readonly themes;
|
|
310
|
+
readonly src: _angular_core.InputSignal<string>;
|
|
311
|
+
readonly trigger: _angular_core.InputSignal<string>;
|
|
312
|
+
readonly state: _angular_core.InputSignal<string | null>;
|
|
313
|
+
readonly size: _angular_core.InputSignal<number>;
|
|
314
|
+
readonly tone: _angular_core.InputSignal<"accent" | "danger">;
|
|
315
|
+
protected readonly colors: _angular_core.Signal<string>;
|
|
316
|
+
constructor();
|
|
317
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusLordicon, never>;
|
|
318
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusLordicon, "nucleus-lordicon", never, { "src": { "alias": "src"; "required": true; "isSignal": true; }; "trigger": { "alias": "trigger"; "required": false; "isSignal": true; }; "state": { "alias": "state"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "tone": { "alias": "tone"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
interface Crumb {
|
|
322
|
+
readonly label: string;
|
|
323
|
+
readonly route?: readonly unknown[];
|
|
324
|
+
}
|
|
325
|
+
declare class NucleusPage {
|
|
326
|
+
readonly heading: _angular_core.WritableSignal<string>;
|
|
327
|
+
readonly lead: _angular_core.WritableSignal<string>;
|
|
328
|
+
readonly crumbs: _angular_core.WritableSignal<readonly Crumb[]>;
|
|
329
|
+
set(heading: string, lead?: string, crumbs?: readonly Crumb[]): void;
|
|
330
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusPage, never>;
|
|
331
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NucleusPage>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface ConfirmRequest {
|
|
335
|
+
readonly header: string;
|
|
336
|
+
readonly message: string;
|
|
337
|
+
readonly accept: string;
|
|
338
|
+
readonly reject: string;
|
|
339
|
+
readonly icon?: string;
|
|
340
|
+
readonly tone?: 'accent' | 'danger';
|
|
341
|
+
}
|
|
342
|
+
declare function provideNucleusFeedback(): EnvironmentProviders;
|
|
343
|
+
declare class NucleusFeedback {
|
|
344
|
+
private readonly confirmation;
|
|
345
|
+
private readonly messages;
|
|
346
|
+
ask(request: ConfirmRequest): Promise<boolean>;
|
|
347
|
+
done(summary: string, detail?: string): void;
|
|
348
|
+
failed(summary: string, detail?: string): void;
|
|
349
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusFeedback, never>;
|
|
350
|
+
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NucleusFeedback>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
type FieldKind = 'text' | 'email' | 'password' | 'number' | 'textarea' | 'select' | 'checkbox' | 'switch';
|
|
354
|
+
type FieldSpan = 1 | 2 | 3 | 4 | 'full';
|
|
355
|
+
interface FieldOption {
|
|
356
|
+
readonly label: string;
|
|
357
|
+
readonly value: unknown;
|
|
358
|
+
}
|
|
359
|
+
interface FormField {
|
|
360
|
+
readonly key: string;
|
|
361
|
+
readonly label: string;
|
|
362
|
+
readonly kind?: FieldKind;
|
|
363
|
+
readonly span?: FieldSpan;
|
|
364
|
+
readonly hint?: string;
|
|
365
|
+
readonly placeholder?: string;
|
|
366
|
+
readonly maxlength?: number;
|
|
367
|
+
readonly rows?: number;
|
|
368
|
+
readonly options?: readonly FieldOption[];
|
|
369
|
+
readonly disabled?: boolean;
|
|
370
|
+
readonly clearable?: boolean;
|
|
371
|
+
}
|
|
372
|
+
type FormValue = Record<string, unknown>;
|
|
373
|
+
|
|
374
|
+
declare class NucleusForm {
|
|
375
|
+
readonly fields: _angular_core.InputSignal<readonly FormField[]>;
|
|
376
|
+
readonly value: _angular_core.InputSignal<FormValue>;
|
|
377
|
+
readonly readonly: _angular_core.InputSignal<boolean>;
|
|
378
|
+
readonly dense: _angular_core.InputSignal<boolean>;
|
|
379
|
+
readonly valueChange: _angular_core.OutputEmitterRef<FormValue>;
|
|
380
|
+
protected read(field: FormField): unknown;
|
|
381
|
+
protected text(field: FormField): string;
|
|
382
|
+
protected checked(field: FormField): boolean;
|
|
383
|
+
protected write(field: FormField, next: unknown): void;
|
|
384
|
+
protected isDisabled(field: FormField): boolean;
|
|
385
|
+
protected spanClass(field: FormField): string;
|
|
386
|
+
protected optionsOf(field: FormField): FieldOption[];
|
|
387
|
+
protected kindOf(field: FormField): string;
|
|
388
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusForm, never>;
|
|
389
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusForm, "nucleus-form", never, { "fields": { "alias": "fields"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": true; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "dense": { "alias": "dense"; "required": false; "isSignal": true; }; }, { "valueChange": "valueChange"; }, never, never, true, never>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
type ListAlign = 'left' | 'center' | 'right';
|
|
393
|
+
interface ListTag {
|
|
394
|
+
readonly label: string;
|
|
395
|
+
readonly severity?: 'success' | 'info' | 'warn' | 'danger' | 'secondary';
|
|
396
|
+
}
|
|
397
|
+
interface ListColumn<T = Record<string, unknown>> {
|
|
398
|
+
readonly key: string;
|
|
399
|
+
readonly header: string;
|
|
400
|
+
readonly align?: ListAlign;
|
|
401
|
+
readonly strong?: boolean;
|
|
402
|
+
readonly width?: string;
|
|
403
|
+
readonly value?: (row: T) => string;
|
|
404
|
+
readonly tag?: (row: T) => ListTag | null;
|
|
405
|
+
}
|
|
406
|
+
interface ListAction<T = Record<string, unknown>> {
|
|
407
|
+
readonly id: string;
|
|
408
|
+
readonly icon: string;
|
|
409
|
+
readonly label: string;
|
|
410
|
+
readonly tone?: 'default' | 'danger';
|
|
411
|
+
readonly visible?: (row: T) => boolean;
|
|
412
|
+
}
|
|
413
|
+
interface ListActionEvent<T = Record<string, unknown>> {
|
|
414
|
+
readonly id: string;
|
|
415
|
+
readonly row: T;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
declare class NucleusCell {
|
|
419
|
+
readonly nucleusCell: _angular_core.InputSignal<string>;
|
|
420
|
+
readonly template: TemplateRef<any>;
|
|
421
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusCell, never>;
|
|
422
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NucleusCell, "[nucleusCell]", never, { "nucleusCell": { "alias": "nucleusCell"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
declare class NucleusList<T extends object = Record<string, unknown>> {
|
|
426
|
+
readonly rows: _angular_core.InputSignal<T[]>;
|
|
427
|
+
readonly columns: _angular_core.InputSignal<readonly ListColumn<T>[]>;
|
|
428
|
+
readonly actions: _angular_core.InputSignal<readonly ListAction<T>[]>;
|
|
429
|
+
readonly empty: _angular_core.InputSignal<string>;
|
|
430
|
+
readonly loading: _angular_core.InputSignal<boolean>;
|
|
431
|
+
readonly minWidth: _angular_core.InputSignal<string>;
|
|
432
|
+
readonly rowClass: _angular_core.InputSignal<(row: T) => string>;
|
|
433
|
+
readonly action: _angular_core.OutputEmitterRef<ListActionEvent<T>>;
|
|
434
|
+
private readonly cells;
|
|
435
|
+
protected readonly tableStyle: _angular_core.Signal<{
|
|
436
|
+
'min-width': string;
|
|
437
|
+
}>;
|
|
438
|
+
protected readonly showEmpty: _angular_core.Signal<boolean>;
|
|
439
|
+
protected cellTemplate(key: string): TemplateRef<unknown> | null;
|
|
440
|
+
protected text(column: ListColumn<T>, row: T): string;
|
|
441
|
+
protected tagOf(column: ListColumn<T>, row: T): ListTag | null;
|
|
442
|
+
protected visibleActions(row: T): readonly ListAction<T>[];
|
|
443
|
+
protected run(entry: ListAction<T>, row: T): void;
|
|
444
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NucleusList<any>, never>;
|
|
445
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusList<any>, "nucleus-list", never, { "rows": { "alias": "rows"; "required": true; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "actions": { "alias": "actions"; "required": false; "isSignal": true; }; "empty": { "alias": "empty"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "minWidth": { "alias": "minWidth"; "required": false; "isSignal": true; }; "rowClass": { "alias": "rowClass"; "required": false; "isSignal": true; }; }, { "action": "action"; }, ["cells"], ["[nucleusListTitle]", "[nucleusListActions]"], true, never>;
|
|
446
|
+
}
|
|
447
|
+
|
|
286
448
|
declare class NucleusMark {
|
|
287
449
|
readonly accent: _angular_core.InputSignal<string>;
|
|
288
450
|
readonly size: _angular_core.InputSignal<number>;
|
|
@@ -369,6 +531,7 @@ declare class NucleusShell {
|
|
|
369
531
|
private readonly sessionAuth;
|
|
370
532
|
private readonly themes;
|
|
371
533
|
private readonly language;
|
|
534
|
+
private readonly page;
|
|
372
535
|
private readonly config;
|
|
373
536
|
private readonly injector;
|
|
374
537
|
private readonly router;
|
|
@@ -381,6 +544,18 @@ declare class NucleusShell {
|
|
|
381
544
|
readonly navSelect: _angular_core.OutputEmitterRef<string>;
|
|
382
545
|
readonly menuSelect: _angular_core.OutputEmitterRef<MenuNode>;
|
|
383
546
|
protected readonly lang: _angular_core.Signal<NucleusLang>;
|
|
547
|
+
protected readonly icons: {
|
|
548
|
+
readonly trash: "https://cdn.lordicon.com/wpyrrmcq.json";
|
|
549
|
+
readonly check: "https://cdn.lordicon.com/lomfljuq.json";
|
|
550
|
+
readonly warning: "https://cdn.lordicon.com/vihyezfv.json";
|
|
551
|
+
readonly power: "https://cdn.lordicon.com/gwvmctbb.json";
|
|
552
|
+
readonly user: "https://cdn.lordicon.com/hrjifpbq.json";
|
|
553
|
+
readonly key: "https://cdn.lordicon.com/ossgtprr.json";
|
|
554
|
+
};
|
|
555
|
+
protected readonly title: _angular_core.Signal<string>;
|
|
556
|
+
protected readonly subtitle: _angular_core.Signal<string>;
|
|
557
|
+
protected readonly home: _angular_core.Signal<MenuItem>;
|
|
558
|
+
protected readonly crumbs: _angular_core.Signal<MenuItem[]>;
|
|
384
559
|
protected readonly copy: _angular_core.Signal<_nucleus_suite_pe_core.ShellCopy>;
|
|
385
560
|
protected readonly starfield: _angular_core.Signal<boolean>;
|
|
386
561
|
protected readonly themePreference: _angular_core.Signal<ThemePreference>;
|
|
@@ -427,5 +602,5 @@ declare class NucleusShell {
|
|
|
427
602
|
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NucleusShell, "nucleus-shell", never, { "brand": { "alias": "brand"; "required": false; "isSignal": true; }; "heading": { "alias": "heading"; "required": false; "isSignal": true; }; "lead": { "alias": "lead"; "required": false; "isSignal": true; }; "navItems": { "alias": "navItems"; "required": false; "isSignal": true; }; "activeNavId": { "alias": "activeNavId"; "required": false; "isSignal": true; }; "selectedMenuId": { "alias": "selectedMenuId"; "required": false; "isSignal": true; }; }, { "navSelect": "navSelect"; "menuSelect": "menuSelect"; }, never, ["[nucleusTop]", "*"], true, never>;
|
|
428
603
|
}
|
|
429
604
|
|
|
430
|
-
export { DEFAULT_THEME, NUCLEUS_CONFIG, NUCLEUS_DARK_SELECTOR, NUCLEUS_FORCE_BEARER, NUCLEUS_LANGS, NUCLEUS_LOGOUT_PARAM, NUCLEUS_SKIP_AUTH, NucleusAuth, NucleusLanguage, NucleusMark, NucleusPreset, NucleusSessionAuth, NucleusShell, NucleusStarfield, SHELL_COPY, SessionService, THEMES, THEME_LABELS, ThemeService, UserSyncService, consumeNucleusLogout, isNucleusConfigured, isThemePreference, loadNucleusConfig, nucleusAuthInterceptor, nucleusLogoutUrl, ownsUrl, provideNucleus, provideNucleusTheme, themeById };
|
|
431
|
-
export type { AccessScope, AppSummary, AppUser, AuthSyncRequest, CompanyOption, CompanyRelation, CompanySummary, LauncherApp, MeResponse, MenuNode, NucleusConfig, NucleusIdentity, NucleusLang, SessionTicket, ShellCopy, ShellNavItem, Site, SiteAccess, Subscription, Theme, ThemeId, ThemePreference, ThemeTokens, UserProfile };
|
|
605
|
+
export { DEFAULT_THEME, NO_PERMISSIONS, NUCLEUS_CONFIG, NUCLEUS_DARK_SELECTOR, NUCLEUS_FORCE_BEARER, NUCLEUS_ICONS, NUCLEUS_LANGS, NUCLEUS_LOGOUT_PARAM, NUCLEUS_SKIP_AUTH, NucleusAuth, NucleusCell, NucleusFeedback, NucleusForm, NucleusLanguage, NucleusList, NucleusLordicon, NucleusMark, NucleusPage, NucleusPreset, NucleusSessionAuth, NucleusShell, NucleusStarfield, SHELL_COPY, SessionService, THEMES, THEME_LABELS, ThemeService, UserSyncService, consumeNucleusLogout, findMenuByRoute, isNucleusConfigured, isThemePreference, loadLordicon, loadNucleusConfig, nucleusAuthInterceptor, nucleusLogoutUrl, ownsUrl, permissionsOf, provideNucleus, provideNucleusFeedback, provideNucleusTheme, themeById };
|
|
606
|
+
export type { AccessScope, AppSummary, AppUser, AuthSyncRequest, CompanyOption, CompanyRelation, CompanySummary, ConfirmRequest, Crumb, FieldKind, FieldOption, FieldSpan, FormField, FormValue, LauncherApp, ListAction, ListActionEvent, ListAlign, ListColumn, ListTag, MeResponse, MenuNode, MenuPermissions, NucleusConfig, NucleusIdentity, NucleusLang, SessionTicket, ShellCopy, ShellNavItem, Site, SiteAccess, Subscription, Theme, ThemeId, ThemePreference, ThemeTokens, UserProfile };
|