Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@quantumart/qa-engine-page-structure-angular

Package Overview
Dependencies
Maintainers
6
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@quantumart/qa-engine-page-structure-angular

**@quantumart/qa-engine-page-structure-angular**

  • 1.1.1
  • npm
  • Socket score

Version published
Weekly downloads
23
increased by2200%
Maintainers
6
Weekly downloads
 
Created
Source

@quantumart/qa-engine-page-structure-angular

Данная библиотека предоставляет набор инструментов для построения фронтенда для сайта на базе QP (Angular версия).

Demo site

  • Исходники
  • Площадка
  • QP (customer code: qa_demosite_rus)

Описание

Необходимый бэкенд для построения сайта:

  • База данных на основе qp
  • API на .NET Core с методом получения структуры сайта (дерево UniversalAbstractItem)

Установка

Установить npm пакет:

npm install @quantumart/qa-engine-page-structure-angular

Пример подключения

Импортировать модуль QaEnginePageStructureModule в основном модуле angular-приложения:

...
import { QaEnginePageStructureModule, WidgetComponent } from '@quantumart/qa-engine-page-structure-angular';

@NgModule({
  ...  
  imports: [
    ...
    QaEnginePageStructureModule.forRoot({
      widgetPlatformApiUrl: environment.WIDGET_PLATFORM_API_URL,
      layoutWidgetZones: ['SiteHeaderZone', 'SiteFooterZone'],
      widgetMapping: new Map<string, Type<WidgetComponent>>([
        ['html_widget', HtmlWidgetComponent],
        ['banner_widget', BannerWidgetComponent],
        ['feedback_widget', FeedbackWidgetComponent],
        ...
      ]),
    }), 
    ...  
  ],
  ...
  • widgetPlatformApiUrl - базовый URL API виджетной платформы
  • layoutWidgetZones - список виджетных зон, размещенных в шаблоне
  • widgetMapping - маппинг виджетов на angular-компоненты

Определить angular-роуты:

...
import {
    DynamicRoutesInitializer,
    InitialRequestComponent,
    LayoutWidgetsResolver,
    PageDetailsResolver
} from '@quantumart/qa-engine-page-structure-angular';

const routes: Routes = [
  {
    path: '**',
    component: InitialRequestComponent,
    canActivate: [DynamicRoutesInitializer],
  },
  {
    path: 'start-page',
    loadChildren: () => import('./start-page/start-page.module').then(m => m.StartPageModule),
    resolve: {
      details: PageDetailsResolver,
      staticWidgets: LayoutWidgetsResolver,
    },
    data: {
      nodeType: 'start_page',
    },
  },
  ...
];

Пример реализации компонента стартовой страницы:

import { NodeDetails } from '@quantumart/qa-engine-page-structure-angular';
import { SiteNodeComponent, SiteNodeService } from '../services';

export interface StartPageDetails extends NodeDetails {
  title: string;
}

@Component({
  selector: 'qa-start-page',
  templateUrl: './start-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class StartPageComponent implements SiteNodeComponent {
  public get id(): number {
    return this.siteNodeService.getNodeId();
  }

  public readonly pageDetails$ = this.siteNodeService.getDetails<StartPageDetails>();

  constructor(private readonly siteNodeService: SiteNodeService) {
  }
}

Пример реализации компонента виджета:

...
import { WidgetComponent, WidgetDetails } from '@quantumart/qa-engine-page-structure-angular';

export interface HtmlWidgetDetails extends WidgetDetails {
  html: string;
}

@Component({
  selector: 'qa-html-widget',
  templateUrl: './html-widget.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HtmlWidgetComponent implements WidgetComponent {
  @Input() public widget!: HtmlWidgetDetails;
}

FAQs

Package last updated on 05 Sep 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc