feat(platform): sprint 11.5 standardization
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
Some checks failed
Architecture Governance / architecture (push) Has been cancelled
This commit is contained in:
@@ -8,6 +8,16 @@ export interface WidgetSettingsSchema {
|
||||
required?: string[];
|
||||
}
|
||||
|
||||
export interface WidgetMetadataSupport {
|
||||
title: boolean;
|
||||
subtitle: boolean;
|
||||
visibility: boolean;
|
||||
layout: boolean;
|
||||
animation: boolean;
|
||||
style: boolean;
|
||||
permissions: boolean;
|
||||
}
|
||||
|
||||
export interface WidgetManifestEntry {
|
||||
type: string;
|
||||
version: string;
|
||||
@@ -16,6 +26,7 @@ export interface WidgetManifestEntry {
|
||||
supportedDataSources: WidgetDataSourceName[];
|
||||
settingsSchema: WidgetSettingsSchema;
|
||||
defaultSettings: Record<string, unknown>;
|
||||
metadataSupport?: WidgetMetadataSupport;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,31 @@ export class DataSourceResolverService {
|
||||
}
|
||||
|
||||
private resolveSettings(definition: WidgetManifestEntry | undefined, widget: WidgetConfig): Record<string, unknown> {
|
||||
const metadataSettings: Record<string, unknown> = {};
|
||||
|
||||
if (widget.title != null) {
|
||||
metadataSettings['title'] = widget.title;
|
||||
}
|
||||
|
||||
if (widget.subtitle != null) {
|
||||
metadataSettings['subtitle'] = widget.subtitle;
|
||||
}
|
||||
|
||||
if (widget.animation != null) {
|
||||
metadataSettings['animation'] = widget.animation;
|
||||
}
|
||||
|
||||
if (widget.style != null) {
|
||||
metadataSettings['style'] = widget.style;
|
||||
}
|
||||
|
||||
if (widget.permissions != null) {
|
||||
metadataSettings['permissions'] = widget.permissions;
|
||||
}
|
||||
|
||||
return {
|
||||
...(definition?.defaultSettings ?? {}),
|
||||
...metadataSettings,
|
||||
...(widget.props ?? {})
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, inject } from '@angular/core';
|
||||
import { SectionConfig } from '../../shared/models/config';
|
||||
import { RecentlyViewedStripComponent } from '../../features/website/user-experience/components/recently-viewed-strip/recently-viewed-strip.component';
|
||||
import { TranslateService } from '../../i18n/translate.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-recently-viewed-widget',
|
||||
@@ -16,12 +17,14 @@ import { RecentlyViewedStripComponent } from '../../features/website/user-experi
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class RecentlyViewedWidgetComponent {
|
||||
private readonly translate = inject(TranslateService);
|
||||
|
||||
@Input() section: SectionConfig | null = null;
|
||||
@Input() data: { settings?: Record<string, unknown> } | null = null;
|
||||
|
||||
get title(): string {
|
||||
const raw = this.data?.settings?.['title'];
|
||||
return typeof raw === 'string' && raw.trim().length > 0 ? raw : 'Recently Viewed';
|
||||
return typeof raw === 'string' && raw.trim().length > 0 ? raw : this.translate.t('ux.recentlyViewedTitle');
|
||||
}
|
||||
|
||||
get maxItems(): number {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||
import { TranslatePipe } from '../../i18n/translate.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-unknown-widget',
|
||||
standalone: true,
|
||||
imports: [TranslatePipe],
|
||||
template: `
|
||||
<section class="unknown-widget" role="status" aria-live="polite">
|
||||
<strong>Widget unavailable</strong>
|
||||
<strong>{{ 'widgets.unavailable' | translate }}</strong>
|
||||
<p>{{ widgetType }}@{{ widgetVersion }}</p>
|
||||
</section>
|
||||
`,
|
||||
|
||||
Reference in New Issue
Block a user