diff --git a/.gitignore b/.gitignore index b901689e..bc5bd388 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -/.angular/cache +/.angular # Logs logs *.log diff --git a/README.md b/README.md index f567aa33..635817fa 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > UI tour library for Angular -Angular Material, Ionic, Taiga UI, Ng Bootstrap and Ngx Bootstrap UIs are supported. +Angular Material, Ionic, PrimeNG, Taiga UI, Ng Bootstrap and Ngx Bootstrap UIs are supported. `ngx-ui-tour` is a fork of __Isaac Mann's__ `ngx-tour`. The project had to be forked since the original is no longer maintained. @@ -72,6 +72,12 @@ Demo and documentation can be found at [hakimio.github.io/ngx-ui-tour](https://h | 16 | 7 | 6, 7 | 2 | | 15 | 7 | 6, 7 | 1 | +### PrimeNG tour UI + +| Angular | RxJS | PrimeNG | ngx-ui-tour | +|---------|------|---------|-------------| +| 19 | 7 | 19 | 1 | + ### Taiga UI tour UI | Angular | RxJS | Taiga UI | ngx-ui-tour | diff --git a/apps/ngx-ui-tour-demo/src/app/app.providers.ts b/apps/ngx-ui-tour-demo/src/app/app.providers.ts index 40b1e6a6..9318e7c2 100644 --- a/apps/ngx-ui-tour-demo/src/app/app.providers.ts +++ b/apps/ngx-ui-tour-demo/src/app/app.providers.ts @@ -13,6 +13,8 @@ import {provideAnimations} from '@angular/platform-browser/animations'; import {provideIonicAngular} from '@ionic/angular/standalone'; import {NG_EVENT_PLUGINS} from '@taiga-ui/event-plugins'; import {TUI_ANIMATIONS_SPEED} from '@taiga-ui/core'; +import {providePrimeNG} from 'primeng/config'; +import Aura from '@primeng/themes/aura'; export const DEFAULT_TABS = [ `Description`, @@ -90,5 +92,10 @@ export const APP_PROVIDERS: (Provider | EnvironmentProviders)[] = [ provideIonicAngular({ mode: 'md' }), + providePrimeNG({ + theme: { + preset: Aura + } + }), NG_EVENT_PLUGINS ]; diff --git a/apps/ngx-ui-tour-demo/src/app/app.routes.ts b/apps/ngx-ui-tour-demo/src/app/app.routes.ts index 6ba3a1fb..9871395f 100644 --- a/apps/ngx-ui-tour-demo/src/app/app.routes.ts +++ b/apps/ngx-ui-tour-demo/src/app/app.routes.ts @@ -37,6 +37,11 @@ export const ROUTES: Routes = [ title: 'Ionic', loadComponent: async () => import('./ion-popover/ion-popover.component') }), + route({ + path: 'prime-ng', + title: 'PrimeNG', + loadComponent: async () => import('./prime-ng-popover/prime-ng-popover.component') + }), { redirectTo: 'md-menu', path: '**' diff --git a/apps/ngx-ui-tour-demo/src/app/pages.ts b/apps/ngx-ui-tour-demo/src/app/pages.ts index b22291f3..e0b93d22 100644 --- a/apps/ngx-ui-tour-demo/src/app/pages.ts +++ b/apps/ngx-ui-tour-demo/src/app/pages.ts @@ -8,6 +8,10 @@ export const pages: TuiDocRoutePages = [{ section: 'Tour UI Libraries', title: 'Ionic', route: 'ion-popover' +}, { + section: 'Tour UI Libraries', + title: 'PrimeNG', + route: 'prime-ng' }, { section: 'Tour UI Libraries', title: 'NG Bootstrap', diff --git a/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/examples/default-template.md b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/examples/default-template.md new file mode 100644 index 00000000..f33a2afe --- /dev/null +++ b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/examples/default-template.md @@ -0,0 +1,61 @@ +```html + + +
+
+
{{ step?.title }}
+ +
+ +

+ +
+ + @if (step.showProgress) { +
{{ tourService.steps.indexOf(step) + 1 }} / {{ tourService.steps.length }}
+ } + + @if (tourService.hasNext(step) && !step.nextOnAnchorClick) { + + } + @if (!tourService.hasNext(step)) { + + } +
+
+
+
+``` diff --git a/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.html b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.html new file mode 100644 index 00000000..3e0309d1 --- /dev/null +++ b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.html @@ -0,0 +1,69 @@ + + +

+ ngx-ui-tour is a UI tour library built for Angular. It's inspired by + angular-ui-tour. +

+

+ TourPrimeNgModule is an implementation of the tour UI that uses + PrimeNG Popover to display tour steps. +

+

+ +

+
+ + Installation + +
    +
  1. + npm install ngx-ui-tour-primeng primeng @primeng/themes primeicons +
  2. +
  3. + Import TourPrimeNgModule into your app module +
  4. +
  5. + Make sure RouterModule is imported in your app module +
  6. +
  7. + Make sure PrimeNG is + installed correctly +
  8. +
+ +
+ + + + + + + + + + + + + + +
+ + diff --git a/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.scss b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.scss new file mode 100644 index 00000000..acaeb90b --- /dev/null +++ b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.scss @@ -0,0 +1,3 @@ +app-header { + margin-top: 0; +} diff --git a/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.ts b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.ts new file mode 100644 index 00000000..3b056019 --- /dev/null +++ b/apps/ngx-ui-tour-demo/src/app/prime-ng-popover/prime-ng-popover.component.ts @@ -0,0 +1,121 @@ +import {ChangeDetectionStrategy, Component, inject, type OnInit} from '@angular/core'; +import {TuiAddonDoc} from '@taiga-ui/addon-doc'; +import {type IStepOption, TourAnchorPrimeNgDirective, TourPrimeNgModule, TourService} from 'ngx-ui-tour-primeng'; +import {TuiButton, TuiLink} from '@taiga-ui/core'; +import {provideTourDirective, SHARED_COMPONENTS} from '../shared'; +import defaultTemplate from './examples/default-template.md' with {loader: 'text'}; +import {DELAY_AFTER_NAVIGATION} from '../app.providers'; + +@Component({ + selector: 'app-prime-ng-popover', + imports: [ + TuiAddonDoc, + TuiLink, + TourPrimeNgModule, + TuiButton, + SHARED_COMPONENTS + ], + templateUrl: './prime-ng-popover.component.html', + styleUrl: './prime-ng-popover.component.scss', + changeDetection: ChangeDetectionStrategy.OnPush, + providers: [ + provideTourDirective(TourAnchorPrimeNgDirective) + ] +}) +export default class PrimeNgPopoverComponent implements OnInit { + + readonly tourSteps: IStepOption[] = [{ + anchorId: 'start.tour', + content: 'Welcome to the Ngx-UI-Tour tour!', + title: 'Welcome' + }, { + anchorId: 'angular-ui-tour', + content: 'Thanks to angular-ui-tour for the inspiration for the library', + title: 'angular-ui-tour' + }, { + anchorId: 'installation', + content: 'First, install the library...', + title: 'Installation', + route: 'prime-ng/Setup' + }, { + anchorId: 'usage', + content: '...then use it.', + title: 'Usage', + route: 'prime-ng/Setup' + }, { + anchorId: 'tourService.start', + content: 'Don\'t forget to actually start the tour.', + title: 'Start the tour', + route: 'prime-ng/Setup' + }, { + anchorId: 'config.anchorId', + content: 'Every step needs an anchor.', + title: 'Anchor', + route: 'prime-ng/API' + }, { + anchorId: 'config.enableBackdrop', + content: 'You can enable backdrop to highlight active element.', + title: 'Backdrop', + enableBackdrop: true, + route: 'prime-ng/API' + }, { + anchorId: 'config.route', + content: 'Tours can span multiple routes.', + title: 'Route', + route: 'prime-ng/API' + }, { + anchorId: 'config.centerAnchorOnScroll', + content: 'Enable this config to keep active anchor element centered when possible.', + title: 'Center active anchor', + route: 'prime-ng/API' + }, { + anchorId: 'config.smoothScroll', + content: 'Enable "smoothScroll" option to smoothly scroll to an active element.', + title: 'Smooth scroll', + route: 'prime-ng/API' + }, { + anchorId: 'config.buttons.custom', + content: 'You can set custom step button names', + title: 'Button Titles', + prevBtnTitle: 'My Prev', + nextBtnTitle: 'My Next', + endBtnTitle: 'My End', + route: 'prime-ng/API', + stepDimensions: { + maxWidth: '350px' + } + }, { + anchorId: 'config.isAsync', + content: 'Mark your step as async if anchor element is added to DOM with a delay', + title: 'Wait for async event', + route: 'prime-ng/API' + }, { + anchorId: 'config.nextOnAnchorClick', + content: 'Click on the config description to go to the next step', + title: 'Next on Anchor Click', + route: 'prime-ng/API', + nextOnAnchorClick: true + }, { + anchorId: 'events', + content: 'You can subscribe to events', + title: 'Events', + route: 'prime-ng/API' + }, { + anchorId: 'hotkeys', + content: 'Try using the hotkeys to navigate through the tour.', + title: 'Hotkeys', + route: 'prime-ng/Misc' + }]; + readonly defaultTemplate = defaultTemplate; + + protected readonly tourService = inject(TourService); + private readonly delayAfterNavigation = inject(DELAY_AFTER_NAVIGATION); + + ngOnInit() { + this.tourService.initialize(this.tourSteps, { + route: 'prime-ng', + delayAfterNavigation: this.delayAfterNavigation + }); + } + +} diff --git a/apps/ngx-ui-tour-demo/src/app/shared/proxy-tour-anchor.directive.ts b/apps/ngx-ui-tour-demo/src/app/shared/proxy-tour-anchor.directive.ts index 0aea7a68..2b8c76a9 100644 --- a/apps/ngx-ui-tour-demo/src/app/shared/proxy-tour-anchor.directive.ts +++ b/apps/ngx-ui-tour-demo/src/app/shared/proxy-tour-anchor.directive.ts @@ -18,6 +18,7 @@ import {TourAnchorConsoleDirective} from 'ngx-ui-tour-console'; import {TourAnchorTuiDropdownDirective} from 'ngx-ui-tour-tui-dropdown'; import {TourAnchorTuiHintDirective} from 'ngx-ui-tour-tui-hint'; import {TourAnchorIonPopoverDirective} from 'ngx-ui-tour-ionic'; +import {TourAnchorPrimeNgDirective} from 'ngx-ui-tour-primeng'; export const TOUR_ANCHOR_DIRECTIVE = new InjectionToken('TourAnchorDirective'); export const TOUR_ANCHOR_DIRECTIVE_TYPE = new InjectionToken>('TourAnchorDirectiveType'); @@ -40,6 +41,7 @@ interface CustomTourAnchorDirective extends TourAnchorDirective, OnInit, OnDestr TourAnchorTuiDropdownDirective, TourAnchorTuiHintDirective, TourAnchorIonPopoverDirective, + TourAnchorPrimeNgDirective, { provide: TOUR_ANCHOR_DIRECTIVE, useFactory: () => { diff --git a/apps/ngx-ui-tour-demo/src/index.html b/apps/ngx-ui-tour-demo/src/index.html index 16c6c034..0770e31f 100644 --- a/apps/ngx-ui-tour-demo/src/index.html +++ b/apps/ngx-ui-tour-demo/src/index.html @@ -17,6 +17,8 @@ + +