-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge branch 'master' into feat-provide
- Loading branch information
Showing
31 changed files
with
150 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
schematics/ng-update/upgrade-rules/v17/autoRegisterFormWidgets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics'; | ||
import { insertImport, addSymbolToNgModuleMetadata } from '@schematics/angular/utility/ast-utils'; | ||
import { Change, InsertChange } from '@schematics/angular/utility/change'; | ||
|
||
import { DEFAULT_WORKSPACE_PATH, getSourceFile, readJSON, applyChanges, logWarn } from '../../../utils'; | ||
|
||
export function autoRegisterFormWidgets(): Rule { | ||
return (tree: Tree, context: SchematicContext) => { | ||
const angularJson = readJSON(tree, DEFAULT_WORKSPACE_PATH); | ||
const projectNames = Object.keys(angularJson.projects); | ||
for (const name of projectNames) { | ||
autoRegisterFormWidgetsRun(tree, name, angularJson.projects[name].sourceRoot, context); | ||
} | ||
}; | ||
} | ||
|
||
function autoRegisterFormWidgetsRun(tree: Tree, name: string, sourceRoot: string, context: SchematicContext): void { | ||
const modulePath = `${sourceRoot}/app/shared/json-schema/json-schema.module.ts`; | ||
if (!tree.exists(modulePath)) return; | ||
|
||
const list = [ | ||
{ symbolName: 'AutoCompleteWidgetModule', fileName: '@delon/form/widgets/autocomplete' }, | ||
{ symbolName: 'CascaderWidgetModule', fileName: '@delon/form/widgets/cascader' }, | ||
{ symbolName: 'MentionWidgetModule', fileName: '@delon/form/widgets/mention' }, | ||
{ symbolName: 'RateWidgetModule', fileName: '@delon/form/widgets/rate' }, | ||
{ symbolName: 'SliderWidgetModule', fileName: '@delon/form/widgets/slider' }, | ||
{ symbolName: 'TagWidgetModule', fileName: '@delon/form/widgets/tag' }, | ||
{ symbolName: 'TimeWidgetModule', fileName: '@delon/form/widgets/time' }, | ||
{ symbolName: 'TransferWidgetModule', fileName: '@delon/form/widgets/transfer' }, | ||
{ symbolName: 'TreeSelectWidgetModule', fileName: '@delon/form/widgets/tree-select' }, | ||
{ symbolName: 'UploadWidgetModule', fileName: '@delon/form/widgets/upload' } | ||
]; | ||
const source = getSourceFile(tree, modulePath); | ||
const changes: Change[] = []; | ||
for (const item of list) { | ||
changes.push(insertImport(source, modulePath, item.symbolName, item.fileName) as InsertChange); | ||
changes.push(...addSymbolToNgModuleMetadata(source, modulePath, 'imports', item.symbolName)); | ||
} | ||
applyChanges(tree, modulePath, changes); | ||
|
||
logWarn( | ||
context, | ||
`[@delon/form] Register all widgets in ${name} project, you can reduce package size by removing unnecessary parts` | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.