avancement planning
This commit is contained in:
+15
-18
@@ -60,30 +60,17 @@ let NzButtonComponent = (() => {
|
||||
iconDir = contentChild(NzIconDirective, ...(ngDevMode ? [{ debugName: "iconDir" }] : []));
|
||||
loadingIconDir = viewChild(NzIconDirective, ...(ngDevMode ? [{ debugName: "loadingIconDir" }] : []));
|
||||
iconOnly = computed(() => this.elementOnly() && (!!this.iconDir() || !!this.loadingIconDir()), ...(ngDevMode ? [{ debugName: "iconOnly" }] : []));
|
||||
insertSpan(nodes, renderer) {
|
||||
nodes.forEach(node => {
|
||||
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim().length > 0) {
|
||||
const span = renderer.createElement('span');
|
||||
const parent = renderer.parentNode(node);
|
||||
renderer.insertBefore(parent, span, node);
|
||||
renderer.appendChild(span, node);
|
||||
}
|
||||
});
|
||||
}
|
||||
constructor() {
|
||||
onConfigChangeEventForComponent(NZ_CONFIG_MODULE_NAME, () => {
|
||||
this.size.set(this.nzSize);
|
||||
this.cdr.markForCheck();
|
||||
});
|
||||
let elementOnly = false;
|
||||
afterEveryRender({
|
||||
read: () => {
|
||||
const { childNodes, children } = this.elementRef.nativeElement;
|
||||
const hasText = Array.from(childNodes).some(node => node.nodeType === Node.TEXT_NODE && node.textContent.trim().length > 0);
|
||||
const visibleElementCount = Array.from(children).filter(element => element.style.display !== 'none').length;
|
||||
elementOnly = !hasText && visibleElementCount === 1;
|
||||
},
|
||||
write: () => this.elementOnly.set(elementOnly)
|
||||
const { children } = this.elementRef.nativeElement;
|
||||
const visibleElement = Array.from(children).filter(element => element.style.display !== 'none');
|
||||
this.elementOnly.set(visibleElement.length === 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
ngOnInit() {
|
||||
@@ -115,7 +102,7 @@ let NzButtonComponent = (() => {
|
||||
}
|
||||
}
|
||||
ngAfterViewInit() {
|
||||
this.insertSpan(this.elementRef.nativeElement.childNodes, this.renderer);
|
||||
this.insertSpan();
|
||||
}
|
||||
ngAfterContentInit() {
|
||||
this.loading$
|
||||
@@ -130,6 +117,16 @@ let NzButtonComponent = (() => {
|
||||
}
|
||||
});
|
||||
}
|
||||
insertSpan() {
|
||||
this.elementRef.nativeElement.childNodes.forEach(node => {
|
||||
if (node.nodeType === Node.TEXT_NODE && node.textContent.trim().length > 0) {
|
||||
const span = this.renderer.createElement('span');
|
||||
const parent = this.renderer.parentNode(node);
|
||||
this.renderer.insertBefore(parent, span, node);
|
||||
this.renderer.appendChild(span, node);
|
||||
}
|
||||
});
|
||||
}
|
||||
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: NzButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
||||
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.0", type: NzButtonComponent, isStandalone: true, selector: "button[nz-button], a[nz-button]", inputs: { nzBlock: ["nzBlock", "nzBlock", booleanAttribute], nzGhost: ["nzGhost", "nzGhost", booleanAttribute], nzSearch: ["nzSearch", "nzSearch", booleanAttribute], nzLoading: ["nzLoading", "nzLoading", booleanAttribute], nzDanger: ["nzDanger", "nzDanger", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], tabIndex: "tabIndex", nzType: "nzType", nzShape: "nzShape", nzSize: "nzSize" }, host: { properties: { "class.ant-btn-default": "nzType === 'default'", "class.ant-btn-primary": "nzType === 'primary'", "class.ant-btn-dashed": "nzType === 'dashed'", "class.ant-btn-link": "nzType === 'link'", "class.ant-btn-text": "nzType === 'text'", "class.ant-btn-circle": "nzShape === 'circle'", "class.ant-btn-round": "nzShape === 'round'", "class.ant-btn-lg": "finalSize() === 'large'", "class.ant-btn-sm": "finalSize() === 'small'", "class.ant-btn-dangerous": "nzDanger", "class.ant-btn-loading": "nzLoading", "class.ant-btn-background-ghost": "nzGhost", "class.ant-btn-block": "nzBlock", "class.ant-input-search-button": "nzSearch", "class.ant-btn-rtl": "dir === 'rtl'", "class.ant-btn-icon-only": "iconOnly()", "attr.tabindex": "disabled ? -1 : (tabIndex === null ? null : tabIndex)", "attr.disabled": "disabled || null" }, classAttribute: "ant-btn" }, providers: [{ provide: NZ_SPACE_COMPACT_ITEM_TYPE, useValue: 'btn' }], queries: [{ propertyName: "iconDir", first: true, predicate: NzIconDirective, descendants: true, isSignal: true }, { propertyName: "nzIconDirectiveElement", first: true, predicate: NzIconDirective, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "loadingIconDir", first: true, predicate: NzIconDirective, descendants: true, isSignal: true }], exportAs: ["nzButton"], usesOnChanges: true, hostDirectives: [{ directive: i1.NzSpaceCompactItemDirective }], ngImport: i0, template: `
|
||||
@if (nzLoading) {
|
||||
|
||||
Reference in New Issue
Block a user