@@ -17,6 +17,7 @@ import {NodePackageInstallTask, RunSchematicTask} from '@angular-devkit/schemati
1717import { NodeDependencyType } from '@schematics/angular/utility/dependencies' ;
1818import { JSONFile } from '@schematics/angular/utility/json-file' ;
1919import {
20+ addToAppModule ,
2021 addToAppSharedModule ,
2122 addToComponentModule ,
2223 addToDeclarationsArray ,
@@ -63,6 +64,10 @@ export default function (options: Schema): Rule {
6364export function generateTable ( options : Schema ) : Rule {
6465 options . spinner = ora ( ) . start ( ) ;
6566
67+ if ( ! options . skipImport ) {
68+ options . skipImport = false ;
69+ }
70+
6671 loadAndApplyConfigFile ( options . configFile , options ) ;
6772
6873 if ( options . aspectModelTFilesString ) {
@@ -96,7 +101,7 @@ export function generateTable(options: Schema): Rule {
96101 generateModule ( options ) ,
97102 generateTranslationModule ( options ) ,
98103 addPackageJsonDependencies (
99- options . skipImport || false ,
104+ options . skipImport ,
100105 options . spinner ,
101106 options . enableRemoteDataHandling
102107 ? [
@@ -136,8 +141,10 @@ export function generateTable(options: Schema): Rule {
136141 ]
137142 ) ,
138143 updateConfigFiles ( options ) ,
139- addToComponentModule ( options . skipImport || false , options , [
140- { name : 'BrowserAnimationsModule' , fromLib : '@angular/platform-browser/animations' } ,
144+ addToAppModule ( options . skipImport , [
145+ { name : 'BrowserAnimationsModule' , fromLib : '@angular/platform-browser/animations' }
146+ ] ) ,
147+ addToComponentModule ( options . skipImport , options , [
141148 { name : 'MatTableModule' , fromLib : '@angular/material/table' } ,
142149 { name : 'MatPaginatorModule' , fromLib : '@angular/material/paginator' } ,
143150 { name : 'MatSortModule' , fromLib : '@angular/material/sort' } ,
@@ -149,15 +156,20 @@ export function generateTable(options: Schema): Rule {
149156 { name : 'MatTooltipModule' , fromLib : '@angular/material/tooltip' } ,
150157 { name : 'MatListModule' , fromLib : '@angular/material/list' } ,
151158 { name : 'DragDropModule' , fromLib : '@angular/cdk/drag-drop' } ,
159+ { name : 'NgTemplateOutlet' , fromLib : '@angular/common' } ,
160+ { name : 'DatePipe' , fromLib : '@angular/common' } ,
161+ { name : 'NgIf' , fromLib : '@angular/common' } ,
162+ { name : 'NgFor' , fromLib : '@angular/common' } ,
163+ { name : 'NgClass' , fromLib : '@angular/common' } ,
152164 ] ) ,
153- addToComponentModule ( ! options . addRowCheckboxes || options . skipImport || false , options , [
165+ addToComponentModule ( ! options . addRowCheckboxes || options . skipImport , options , [
154166 { name : 'MatCheckboxModule' , fromLib : '@angular/material/checkbox' } ,
155167 { name : 'MatDialogModule' , fromLib : '@angular/material/dialog' } ,
156168 ] ) ,
157169 addToComponentModule (
158170 {
159171 skip ( ) {
160- return ! options . addCommandBar || options . skipImport || false ;
172+ return ! options . addCommandBar || options . skipImport as boolean ;
161173 } ,
162174 } ,
163175 options ,
@@ -176,7 +188,7 @@ export function generateTable(options: Schema): Rule {
176188 addToComponentModule (
177189 {
178190 skip ( ) {
179- return options . templateHelper . getDateProperties ( options ) . length < 1 || options . skipImport || false ;
191+ return options . templateHelper . getDateProperties ( options ) . length < 1 || options . skipImport as boolean ;
180192 } ,
181193 } ,
182194 options ,
@@ -185,7 +197,7 @@ export function generateTable(options: Schema): Rule {
185197 addToComponentModule (
186198 {
187199 skip ( ) {
188- return ! options . enabledCommandBarFunctions ?. includes ( 'addDateQuickFilters' ) || options . skipImport || false ;
200+ return ! options . enabledCommandBarFunctions ?. includes ( 'addDateQuickFilters' ) || options . skipImport as boolean ;
189201 } ,
190202 } ,
191203 options ,
@@ -197,7 +209,7 @@ export function generateTable(options: Schema): Rule {
197209 addToComponentModule (
198210 {
199211 skip ( ) {
200- return ! options . enabledCommandBarFunctions ?. includes ( 'addEnumQuickFilters' ) || options . skipImport || false ;
212+ return ! options . enabledCommandBarFunctions ?. includes ( 'addEnumQuickFilters' ) || options . skipImport as boolean ;
201213 } ,
202214 } ,
203215 options ,
@@ -207,15 +219,15 @@ export function generateTable(options: Schema): Rule {
207219 ]
208220 ) ,
209221 addToAppSharedModule (
222+ false ,
210223 [
211224 { name : 'MatButtonModule' , fromLib : '@angular/material/button' } ,
212225 { name : 'MatDialogModule' , fromLib : '@angular/material/dialog' } ,
213226 { name : 'MatCheckboxModule' , fromLib : '@angular/material/checkbox' } ,
214227 { name : 'MatIconModule' , fromLib : '@angular/material/icon' } ,
215228 { name : 'FormsModule' , fromLib : '@angular/forms' } ,
216229 { name : 'NgIf' , fromLib : '@angular/common' } ,
217- ] ,
218- false
230+ ]
219231 ) ,
220232 generateComponentFiles ( options ) ,
221233 generateStyles ( options ) ,
0 commit comments