Skip to content

Commit

Permalink
fix(*): update circular dependency error
Browse files Browse the repository at this point in the history
  • Loading branch information
ng-nest-moon committed Jun 3, 2021
1 parent d389ce7 commit 2921cd6
Show file tree
Hide file tree
Showing 32 changed files with 96 additions and 63 deletions.
Empty file.
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/border/border.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { XConfigService } from '@ng-nest/ui/core';

@Component({
selector: 'x-border',
templateUrl: './border.component.html',
template: '',
styleUrls: ['./style/index.scss'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/comment/comment.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
></x-comment-reply>
</div>
</li>
<li class="x-comment-more" *ngIf="node.count > node.children?.length">
<li class="x-comment-more" *ngIf="hasMore(node)">
<x-link icon="fto-chevron-right" type="primary" (click)="moreOnClick(node)" iconRight>{{ 'comment.more' | xI18n }} </x-link>
</li>
</ul>
Expand Down
4 changes: 4 additions & 0 deletions lib/ng-nest/ui/comment/comment.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export class XCommentComponent extends XCommentProperty implements OnChanges {
this.moreClick.emit(node);
}

hasMore(node: XCommentNode) {
return (node.count as number) > (node.children?.length as number);
}

trackByNode(index: number, item: XCommentNode) {
return item.id;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/comment/comment.property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class XCommentProperty extends XProperty {
* @zh_CN 评论最大字数
* @en_US Maximum number of comments
*/
@Input() @XWithConfig(X_CONFIG_NAME, 512) contentMax?: number;
@Input() @XWithConfig(X_CONFIG_NAME, 512) contentMax!: XNumber;
/**
* @zh_CN 点赞的事件
* @en_US Like events
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/date-picker/date-picker.property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class XDatePickerProperty extends XControlValueAccessor<any> implements X
* @zh_CN 只读
* @en_US Readonly
*/
@Input() @XInputBoolean() readonly?: XBoolean;
@Input() @XInputBoolean() readonly!: XBoolean;
/**
* @zh_CN 节点点击的事件
* @en_US Node click event
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/date-picker/picker-date.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*ngIf="!dateTemp"
type="text"
size="mini"
[title]="week | date: 'yyyy-MM-dd'"
title="{{ week | date: 'yyyy-MM-dd' }}"
[activated]="(week | date: 'yyyyMMdd') === (model | date: 'yyyyMMdd')"
(click)="dateClick(week)"
>{{ week | date: 'd' }}</x-button
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/date-picker/picker-month.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<x-button
*ngIf="!monthTemp"
type="text"
[title]="month | date: 'yyyy-MM'"
title="{{ month | date: 'yyyy-MM' }}"
[activated]="(month | date: 'yyyyMM') === (model | date: 'yyyyMM')"
(click)="monthClick(month)"
>{{ getLocaleMonth(month) }}</x-button
Expand Down
8 changes: 6 additions & 2 deletions lib/ng-nest/ui/form/control.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import {
XTextareaControlOption,
XTextareaControl
} from './form.property';
import { XFormComponent } from './form.component';
import { FormControlName, Validators, FormControl, ValidatorFn } from '@angular/forms';
import { XIsEmpty, XConfigService } from '@ng-nest/ui/core';
import { Subject } from 'rxjs';
Expand All @@ -60,6 +59,7 @@ import { takeUntil } from 'rxjs/operators';
})
export class XControlComponent extends XControlProperty implements OnInit, AfterViewInit, OnDestroy {
@Input() option!: XFormControlOption;
@Input() form: any;
@ViewChild(FormControlName, { static: false }) control!: FormControlName;
private _sharedProps = ['span', 'direction', 'justify', 'align', 'labelWidth', 'labelAlign'];
private _changeProps = ['label', ...this._sharedProps];
Expand All @@ -68,7 +68,11 @@ export class XControlComponent extends XControlProperty implements OnInit, After
private _unSubject = new Subject();
private _formControl!: FormControl;

constructor(@Host() @Optional() public form: XFormComponent, public cdr: ChangeDetectorRef, public configService: XConfigService) {
constructor(
// @Host() @Optional() public form: XFormComponent,
public cdr: ChangeDetectorRef,
public configService: XConfigService
) {
super();
}

Expand Down
4 changes: 2 additions & 2 deletions lib/ng-nest/ui/form/form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
[hidden]="control.hidden"
>
<ng-container *xOutlet="controlTpl[control.id]; context: { $option: control }">
<x-control [option]="control"></x-control>
</ng-container>
<x-control [option]="control" [form]="this"></x-control>
</ng-container>
</x-col>
</x-row>
</ng-template>
Expand Down
6 changes: 3 additions & 3 deletions lib/ng-nest/ui/menu/menu-node.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef, Host, Optional, ElementRef } from '@angular/core';
import { Component, ViewEncapsulation, ChangeDetectionStrategy, ChangeDetectorRef, Host, Optional, ElementRef, Input } from '@angular/core';
import { XMenuNodeProperty, XMenuNodePrefix } from './menu.property';
import { XMenuComponent } from './menu.component';
import { XConfigService } from '@ng-nest/ui/core';

@Component({
Expand All @@ -10,8 +9,9 @@ import { XConfigService } from '@ng-nest/ui/core';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class XMenuNodeComponent extends XMenuNodeProperty {
@Input() menu: any;
constructor(
@Host() @Optional() public menu: XMenuComponent,
// @Host() @Optional() public menu: XMenuComponent,
public cdr: ChangeDetectorRef,
public elementRef: ElementRef,
public configService: XConfigService
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-nest/ui/menu/menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
(nodeClick)="onNodeClick($event)"
children
>
<x-menu-node [node]="node"></x-menu-node>
<x-menu-node [node]="node" [menu]="this"></x-menu-node>
</x-dropdown>
<x-menu-node *ngIf="!collapsed" [node]="node"></x-menu-node>
<x-menu-node *ngIf="!collapsed" [node]="node" [menu]="this"></x-menu-node>
</ng-template>

<ng-template #nodeRowTpl let-node="$node">
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/menu/menu.property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const XMenuNodePrefix = 'x-menu-node';
* Menu Node Property
*/
@Component({ template: '' })
export class XMenuNodeProperty {
export class XMenuNodeProperty extends XProperty {
/**
* @zh_CN 节点数据
* @en_US Node data
Expand Down
7 changes: 4 additions & 3 deletions lib/ng-nest/ui/table/table-body.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
SimpleChanges,
OnChanges,
Inject,
ViewChild
ViewChild,
Input
} from '@angular/core';
import { XTableBodyPrefix, XTableBodyProperty, XTableRow, XTableColumn, XTableCell } from './table.property';
import { removeNgTag, XIsChange, XResize, XConfigService, XNumber } from '@ng-nest/ui/core';
import { XTableComponent } from './table.component';
import { Subject, fromEvent } from 'rxjs';
import { DOCUMENT } from '@angular/common';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
Expand All @@ -35,12 +35,13 @@ export class XTableBodyComponent extends XTableBodyProperty implements OnInit, O

@ViewChild('tbody') tbody!: ElementRef;
@ViewChild('virtualBody') virtualBody!: CdkVirtualScrollViewport;
@Input() table: any;

private _unSubject = new Subject<void>();
private _resizeObserver!: ResizeObserver;

constructor(
@Optional() @Host() public table: XTableComponent,
// @Optional() @Host() public table: XTableComponent,
public renderer: Renderer2,
public elementRef: ElementRef,
public cdr: ChangeDetectorRef,
Expand Down
7 changes: 4 additions & 3 deletions lib/ng-nest/ui/table/table-foot.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
ChangeDetectionStrategy,
Host,
Optional,
ViewChild
ViewChild,
Input
} from '@angular/core';
import { XTableFootPrefix, XTableFootProperty } from './table.property';
import { removeNgTag } from '@ng-nest/ui/core';
import { XTableComponent } from './table.component';

@Component({
selector: `${XTableFootPrefix}`,
Expand All @@ -22,8 +22,9 @@ import { XTableComponent } from './table.component';
})
export class XTableFootComponent extends XTableFootProperty implements OnInit {
@ViewChild('tfoot') tfoot!: ElementRef;
@Input() table: any;
constructor(
@Optional() @Host() public table: XTableComponent,
// @Optional() @Host() public table: XTableComponent,
public renderer: Renderer2,
public elementRef: ElementRef,
public cdr: ChangeDetectorRef
Expand Down
8 changes: 5 additions & 3 deletions lib/ng-nest/ui/table/table-head.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import {
Optional,
Host,
SimpleChanges,
ViewChild
ViewChild,
Input
} from '@angular/core';
import { XTableHeadPrefix, XTableHeadProperty, XTableColumn, XTableCell } from './table.property';
import { removeNgTag, XIsEmpty, XSort, XIsChange, XConfigService, XNumber } from '@ng-nest/ui/core';
import { XTableComponent } from './table.component';


@Component({
selector: `${XTableHeadPrefix}`,
Expand All @@ -24,8 +25,9 @@ export class XTableHeadComponent extends XTableHeadProperty implements OnInit {
sortStr = '';
theadStyle: { [property: string]: any } = {};
@ViewChild('thead') thead!: ElementRef;
@Input() table: any;
constructor(
@Optional() @Host() public table: XTableComponent,
// @Optional() @Host() public table: XTableComponent,
public renderer: Renderer2,
public elementRef: ElementRef,
public cdr: ChangeDetectorRef,
Expand Down
4 changes: 3 additions & 1 deletion lib/ng-nest/ui/table/table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
[scrollYWidth]="scrollYWidth"
[scrollXWidth]="scrollXWidth"
[cellConfig]="cellConfig?.thead"
[table]="this"
></x-table-head>
<x-table-body
[data]="tableData"
Expand All @@ -33,8 +34,9 @@
[cellConfig]="cellConfig?.tbody"
[(activatedRow)]="activatedRow"
(activatedRowChange)="activatedRowChange.emit($event)"
[table]="this"
></x-table-body>
<x-table-foot></x-table-foot>
<x-table-foot [table]="this"></x-table-foot>
</table>
<x-pagination #pagination [(index)]="index" [(size)]="size" [(query)]="query" [total]="total" (indexChange)="change($event)">
</x-pagination>
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/table/table.property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,4 +527,4 @@ export const XTableFootPrefix = 'x-table-foot';
* Table Foot Property
*/
@Component({ template: '' })
export class XTableFootProperty {}
export class XTableFootProperty extends XProperty {}
6 changes: 3 additions & 3 deletions lib/ng-nest/ui/tabs/tabs.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
[animated]="animated && type !== 'tag'"
[justify]="justify"
[nodeJustify]="nodeJustify"
[data]="sliderOption?.data"
[layout]="sliderOption?.layout"
[data]="sliderOption.data"
[layout]="sliderOption.layout"
[size]="size"
[nodeTpl]="nodeTpl"
[activatedIndex]="sliderOption?.activatedIndex"
[activatedIndex]="sliderOption.activatedIndex"
(indexChange)="activatedChange($event)"
></x-slider>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-nest/ui/tabs/tabs.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import {
QueryList
} from '@angular/core';
import { XTabsPrefix, XTabsNode, XTabsProperty } from './tabs.property';
import { XIsChange, XSetData, XIsEmpty, XConfigService } from '@ng-nest/ui/core';
import { XIsChange, XSetData, XIsEmpty, XConfigService, XData } from '@ng-nest/ui/core';
import { Subject } from 'rxjs';
import { XSliderComponent, XSliderProperty } from '@ng-nest/ui/slider';
import { XSliderComponent, XSliderNode, XSliderProperty } from '@ng-nest/ui/slider';
import { XTabComponent } from './tab.component';

@Component({
Expand Down
2 changes: 1 addition & 1 deletion lib/ng-nest/ui/tabs/tabs.property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class XTabsProperty extends XProperty {
* @zh_CN 节点模板
* @en_US Node template
*/
@Input() nodeTpl?: TemplateRef<any>;
@Input() nodeTpl!: TemplateRef<any>;
/**
* @zh_CN 尺寸
* @en_US Size
Expand Down
9 changes: 5 additions & 4 deletions lib/ng-nest/ui/transfer/transfer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ export class XTransferComponent extends XTransferProperty implements OnInit, OnC
this.cdr.detectChanges();
}

dropCdk(event: CdkDragDrop<XTransferSource[]>) {
if (event.previousContainer === event.container) {
moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
dropCdk(event: CdkDragDrop<XTransferNode[] | undefined, any>) {
const ev = event as CdkDragDrop<XTransferNode[]>;
if (ev.previousContainer === ev.container) {
moveItemInArray(ev.container.data, ev.previousIndex, ev.currentIndex);
} else {
transferArrayItem(event.previousContainer.data, event.container.data, event.previousIndex, event.currentIndex);
transferArrayItem(ev.previousContainer.data, ev.container.data, ev.previousIndex, ev.currentIndex);
this.setCheckedCount(this.left, this.right);
this.setCheckedAll(this.left, this.right);
this.setButtonDisabled(this.left, this.right);
Expand Down
4 changes: 2 additions & 2 deletions lib/ng-nest/ui/tree-file/tree-file.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<div class="x-tree-file-body" [x-loading]="loading">
<div class="x-tree-file-crumb" *ngIf="showCrumb">
<x-link icon="fto-menu" *ngIf="showToggle && showTree" (click)="menuToggle()"></x-link>
<x-crumb [data]="activatedNode?.crumbData" [separator]="separatorTpl"></x-crumb>
<x-crumb [data]="getCrumbData" [separator]="separatorTpl"></x-crumb>
<ng-template #separatorTpl>
<x-icon type="fto-chevron-right"></x-icon>
</ng-template>
Expand All @@ -25,7 +25,7 @@
*ngSwitchCase="'code'"
[type]="activatedNode?.type"
[data]="activatedNode?.content"
[highlightLines]="activatedNode?.highlightLines"
[highlightLines]="getHighlightLines"
></x-highlight>
</div>
</div>
Expand Down
9 changes: 9 additions & 0 deletions lib/ng-nest/ui/tree-file/tree-file.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { HttpClient } from '@angular/common/http';
import { XIsEmpty, XConfigService } from '@ng-nest/ui/core';
import { XCrumbNode } from '@ng-nest/ui/crumb';
import { delay } from 'rxjs/operators';
import { XHighlightLines } from '@ng-nest/ui/highlight';

@Component({
selector: `${XTreeFilePrefix}`,
Expand All @@ -26,6 +27,14 @@ export class XTreeFileComponent extends XTreeFileProperty {
return Number(this.maxHeight) - (Boolean(this.showCrumb) ? 1.5 : 0);
}

get getCrumbData() {
return this.activatedNode?.crumbData as XCrumbNode[];
}

get getHighlightLines() {
return this.activatedNode?.highlightLines as XHighlightLines;
}

constructor(
public renderer: Renderer2,
public elementRef: ElementRef,
Expand Down
5 changes: 3 additions & 2 deletions lib/ng-nest/ui/tree/tree-node.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[class.is-leaf]="!node.leaf"
[class.is-open]="node.open"
type="fto-chevron-right"
(click)="!tree.nodeOpen && onToggle($event, node) && $event.stop"
(click)="!tree.nodeOpen && onToggle($event, node)"
></x-icon>
<x-icon *ngIf="loading" type="fto-loader" [spin]="loading"></x-icon>
<x-checkbox
Expand All @@ -20,7 +20,7 @@
[(ngModel)]="node.checked"
(ngModelChange)="onCheckboxChange()"
[indeterminate]="node.indeterminate"
[disabled]="node.disabled"
[disabled]="getNodeDisabled(node.disabled)"
(click)="$event.stopPropagation()"
></x-checkbox>
<span
Expand Down Expand Up @@ -53,5 +53,6 @@
[nodeHeight]="nodeHeight"
[nodeNowrap]="nodeNowrap"
[nodeAlignItems]="nodeAlignItems"
[tree]="tree"
></li>
</ul>

0 comments on commit 2921cd6

Please sign in to comment.