Skip to content

feat: migrated on new angular control flow (#DS-2872) #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ const config = {
'@angular-eslint/template/click-events-have-key-events': 0,
'@angular-eslint/template/interactive-supports-focus': 0,
'@angular-eslint/template/label-has-associated-control': 0,
'@angular-eslint/template/prefer-self-closing-tags': 1
'@angular-eslint/template/prefer-self-closing-tags': 1,
'@angular-eslint/template/prefer-control-flow': 1
}
},
{
Expand Down
27 changes: 14 additions & 13 deletions apps/docs/src/app/components/anchors/anchors.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<div
*ngFor="let anchor of anchors"
class="docs-anchors__element docs-anchors__element_{{ anchor.level }}"
[ngClass]="{ 'docs-anchors__element_active': anchor.active }"
>
<a
class="docs-anchors__link"
[fragment]="anchor.href"
[routerLink]="this.pathName"
(click)="scrollIntoView(anchor)"
@for (anchor of anchors; track anchor) {
<div
class="docs-anchors__element docs-anchors__element_{{ anchor.level }}"
[ngClass]="{ 'docs-anchors__element_active': anchor.active }"
>
{{ anchor.name }}
</a>
</div>
<a
class="docs-anchors__link"
[fragment]="anchor.href"
[routerLink]="this.pathName"
(click)="scrollIntoView(anchor)"
>
{{ anchor.name }}
</a>
</div>
}
7 changes: 5 additions & 2 deletions apps/docs/src/app/components/anchors/anchors.module.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { CommonModule } from '@angular/common';
import { NgClass } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { AnchorsComponent } from './anchors.component';
import { HeaderDirective } from './header.directive';

@NgModule({
imports: [CommonModule, RouterModule],
imports: [
RouterModule,
NgClass
],
exports: [AnchorsComponent, HeaderDirective],
declarations: [AnchorsComponent, HeaderDirective]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div
*ngIf="documentLost"
class="layout-margin-top-xl kbq-alert kbq-alert_error kbq-alert_dismissible"
>
<span>
Oops, {{ componentDocItem.id }} component seems to be lost... But you can help us find it! Just send a Pull
Request to this repository:
<a
href="#"
class="kbq-markdown__a"
>
Koobiq
</a>
</span>
</div>
@if (documentLost) {
<div class="layout-margin-top-xl kbq-alert kbq-alert_error kbq-alert_dismissible">
<span>
Oops, {{ componentDocItem.id }} component seems to be lost... But you can help us find it! Just send a Pull
Request to this repository:
<a
href="#"
class="kbq-markdown__a"
>
Koobiq
</a>
</span>
</div>
}

<doc-example-viewer
*ngIf="!documentLost"
[documentUrl]="docItemUrl"
(contentRendered)="scrollToSelectedContentSection()"
(contentRenderFailed)="showDocumentLostAlert()"
/>
@if (!documentLost) {
<doc-example-viewer
[documentUrl]="docItemUrl"
(contentRendered)="scrollToSelectedContentSection()"
(contentRenderFailed)="showDocumentLostAlert()"
/>
}

<div class="sticky-wrapper">
<docs-anchors [headerSelectors]="'.docs-header-link'" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<div
*ngIf="documentLost"
class="layout-margin-top-xl kbq-alert kbq-alert_error kbq-alert_dismissible"
>
<span>
Oops, {{ componentDocItem.id }} component seems to be lost... But you can help us find it! Just send a Pull
Request to this repository:
<a
href="#"
class="kbq-markdown__a"
>
Koobiq
</a>
</span>
</div>
@if (documentLost) {
<div class="layout-margin-top-xl kbq-alert kbq-alert_error kbq-alert_dismissible">
<span>
Oops, {{ componentDocItem.id }} component seems to be lost... But you can help us find it! Just send a Pull
Request to this repository:
<a
href="#"
class="kbq-markdown__a"
>
Koobiq
</a>
</span>
</div>
}

<docs-live-example
*ngIf="!documentLost"
[documentUrl]="docItemUrl"
(contentRendered)="scrollToSelectedContentSection()"
(contentRenderFailed)="showDocumentLostAlert()"
/>
@if (!documentLost) {
<docs-live-example
[documentUrl]="docItemUrl"
(contentRendered)="scrollToSelectedContentSection()"
(contentRenderFailed)="showDocumentLostAlert()"
/>
}

<div class="sticky-wrapper">
<docs-anchors [headerSelectors]="'.docs-header-link'" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { KbqButtonModule } from '@koobiq/components/button';
Expand Down Expand Up @@ -38,7 +37,6 @@ import {
RouterModule,
DocsLiveExampleModule,
DocExampleViewerModule,
CommonModule,
SidenavModule,
NavbarModule,
KbqIconModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,35 @@
{{ docItem.name }}
</div>
<div class="docs-component-navbar layout-row layout-padding-top-s">
<nav
*ngIf="!docItem.isGuide"
kbq-tab-nav-bar
>
<a
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'overview'"
>
Обзор
</a>
<a
*ngIf="docItem.hasApi"
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'api'"
>
API
</a>
<a
*ngIf="docItem.hasExamples"
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'examples'"
>
Примеры
</a>
</nav>
<!-- на будущее-->
<!-- <div class="docs-component-navbar__links">-->
<!-- <button kbq-button [kbqStyle]="'transparent'" [color]="'theme'">-->
<!-- <i kbq-icon="pt-icons-file-code_16"></i>-->
<!-- Исходный код-->
<!-- </button>-->
<!---->
<!-- <button kbq-button [kbqStyle]="'transparent'" [color]="'theme'">-->
<!-- <i kbq-icon="pt-icons-file-code_16"></i>-->
<!-- Изменить страницу-->
<!-- </button>-->
<!-- </div>-->
@if (!docItem.isGuide) {
<nav kbq-tab-nav-bar>
<a
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'overview'"
>
Обзор
</a>
@if (docItem.hasApi) {
<a
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'api'"
>
API
</a>
}
@if (docItem.hasExamples) {
<a
kbq-tab-link
routerLinkActive="kbq-selected"
[routerLink]="'examples'"
>
Примеры
</a>
}
</nav>
}
</div>
</div>

Expand Down
40 changes: 21 additions & 19 deletions apps/docs/src/app/components/copy-button/copy-button.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<span
*ngIf="isLabelSuccessVisible"
disabled
kbq-link
pseudo
>
<i class="mc mc-check_16"></i>
<span class="kbq-link__text">{{ successLabelText }}</span>
</span>
@if (isLabelSuccessVisible) {
<span
disabled
kbq-link
pseudo
>
<i class="mc mc-check_16"></i>
<span class="kbq-link__text">{{ successLabelText }}</span>
</span>
}

<span
*ngIf="!isLabelSuccessVisible"
kbq-link
pseudo
>
<i
class="mc kbq-copy_16"
(click)="copyContent()"
></i>
</span>
@if (!isLabelSuccessVisible) {
<span
kbq-link
pseudo
>
<i
class="mc kbq-copy_16"
(click)="copyContent()"
></i>
</span>
}
3 changes: 1 addition & 2 deletions apps/docs/src/app/components/copy-button/copy-button.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Clipboard } from '@angular/cdk/clipboard';
import { CommonModule } from '@angular/common';
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Expand Down Expand Up @@ -50,7 +49,7 @@ export class CopyButton {
}

@NgModule({
imports: [CommonModule, KbqIconModule, KbqLinkModule],
imports: [KbqIconModule, KbqLinkModule],
exports: [CopyButton],
declarations: [CopyButton]
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PortalModule } from '@angular/cdk/portal';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { KbqButtonModule } from '@koobiq/components/button';
import { KbqLinkModule } from '@koobiq/components/link';
Expand All @@ -12,7 +11,6 @@ import { DocExampleViewer } from './doc-example-viewer';
// ExampleViewer is included in the DocViewerModule because they have a circular dependency.
@NgModule({
imports: [
CommonModule,
KbqButtonModule,
KbqTabsModule,
KbqLinkModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<div class="docs-live-example__container">
<div
*ngIf="exampleData"
class="docs-live-example__example"
>
<ng-template
*ngIf="exampleComponentType && exampleModuleFactory"
[ngComponentOutlet]="exampleComponentType"
[ngComponentOutletNgModuleFactory]="exampleModuleFactory"
/>
</div>
@if (exampleData) {
<div class="docs-live-example__example">
@if (exampleComponentType && exampleModuleFactory) {
<ng-template
[ngComponentOutlet]="exampleComponentType"
[ngComponentOutletNgModuleFactory]="exampleModuleFactory"
/>
}
</div>
}

<div class="docs-live-example__footer">
<span
kbq-link
pseudo
[ngSwitch]="isSourceShown"
(click)="toggleSourceView()"
(keydown.enter)="toggleSourceView()"
>
Expand All @@ -25,18 +24,17 @@
</div>
</div>

<ng-container *ngIf="exampleData; else lostExample">
<kbq-code-block
*ngIf="isSourceShown"
[codeFiles]="this.files"
[codeFiles]="files"
[filled]="true"
[filled]="true"
[lineNumbers]="true"
/>
</ng-container>

<ng-template #lostExample>
@if (exampleData) {
@if (isSourceShown) {
<kbq-code-block
[codeFiles]="this.files"
[codeFiles]="files"
[filled]="true"
[filled]="true"
[lineNumbers]="true"
/>
}
} @else {
<div class="kbq-alert kbq-alert_error kbq-alert_dismissible kbq-markdown">
<span>
Oops, this code example is lost... But you can help us find it! Just send a Pull Request to this repository:
Expand All @@ -48,4 +46,4 @@
</a>
</span>
</div>
</ng-template>
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PortalModule } from '@angular/cdk/portal';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { KbqButtonModule } from '@koobiq/components/button';
import { KbqCodeBlockModule } from '@koobiq/components/code-block';
Expand All @@ -15,7 +14,6 @@ import { DocsLiveExample } from './docs-live-example';
// ExampleViewer is included in the DocViewerModule because they have a circular dependency.
@NgModule({
imports: [
CommonModule,
KbqButtonModule,
KbqTabsModule,
KbqLinkModule,
Expand Down
Loading