Browse Source

disable tree style loading with token

pull/15085/head
Mahmut Gundogdu 4 years ago
parent
commit
720865b967
  1. 5
      npm/ng-packs/angular.json
  2. 15
      npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts
  3. 5
      npm/ng-packs/packages/components/tree/src/lib/disable-tree-style-loading.token.ts
  4. 1
      npm/ng-packs/packages/components/tree/src/public-api.ts

5
npm/ng-packs/angular.json

@ -277,6 +277,11 @@
"inject": true,
"bundleName": "ngx-datatable-material"
},
{
"input": "node_modules/ng-zorro-antd/tree/style/index.min.css",
"inject": false,
"bundleName": "ng-zorro-antd-tree"
},
"apps/dev-app/src/styles.scss"
],
"scripts": []

15
npm/ng-packs/packages/components/tree/src/lib/components/tree.component.ts

@ -2,7 +2,9 @@ import {
Component,
ContentChild,
EventEmitter,
Inject,
Input,
Optional,
Output,
TemplateRef,
ViewEncapsulation,
@ -13,6 +15,7 @@ import { TreeNodeTemplateDirective } from '../templates/tree-node-template.direc
import { ExpandedIconTemplateDirective } from '../templates/expanded-icon-template.directive';
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap';
import { LazyLoadService, LOADING_STRATEGY, SubscriptionService } from '@abp/ng.core';
import { DISABLE_TREE_STYLE_LADING_TOKEN } from '../disable-tree-style-loading.token';
export type DropEvent = NzFormatEmitEvent & { pos: number };
@ -27,7 +30,17 @@ export class TreeComponent {
dropPosition: number;
dropdowns = {} as { [key: string]: NgbDropdown };
constructor(private lazyLoadService: LazyLoadService, subscriptionService: SubscriptionService) {
constructor(
private lazyLoadService: LazyLoadService,
subscriptionService: SubscriptionService,
@Optional()
@Inject(DISABLE_TREE_STYLE_LADING_TOKEN)
disableTreeStyleLoading: boolean | undefined,
) {
if (disableTreeStyleLoading) {
return;
}
const loaded$ = this.lazyLoadService.load(
LOADING_STRATEGY.AppendAnonymousStyleToHead('ng-zorro-antd-tree.css'),
);

5
npm/ng-packs/packages/components/tree/src/lib/disable-tree-style-loading.token.ts

@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const DISABLE_TREE_STYLE_LADING_TOKEN = new InjectionToken<boolean>(
'DISABLE_TREE_STYLE__LADING_TOKEN',
);

1
npm/ng-packs/packages/components/tree/src/public-api.ts

@ -3,3 +3,4 @@ export * from './lib/components/tree.component';
export * from './lib/utils/nz-tree-adapter';
export * from './lib/templates/tree-node-template.directive';
export * from './lib/templates/expanded-icon-template.directive';
export * from './lib/disable-tree-style-loading.token';

Loading…
Cancel
Save