@coolon/angular-ui-powerups 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/jest.config.js +9 -0
- package/ng-package.json +13 -0
- package/package.json +12 -14
- package/schematics/ng-add/index.ts +10 -0
- package/schematics/place-routes/index.ts +152 -0
- package/schematics/place-routes/place-def.ts +93 -0
- package/schematics/place-routes/scanner.ts +145 -0
- package/schematics/place-routes/schema.ts +7 -0
- package/src/lib/angular-ui-powerups.module.spec.ts +14 -0
- package/src/lib/angular-ui-powerups.module.ts +49 -0
- package/{lib/animations/index.d.ts → src/lib/animations/index.ts} +1 -0
- package/src/lib/animations/slideDownAndUpAnimation.ts +39 -0
- package/src/lib/components/disposable-component.ts +9 -0
- package/src/lib/components/forms/abstract-input.component.ts +108 -0
- package/src/lib/components/forms/number-input/number-input.component.html +15 -0
- package/src/lib/components/forms/number-input/number-input.component.scss +3 -0
- package/src/lib/components/forms/number-input/number-input.component.spec.ts +25 -0
- package/src/lib/components/forms/number-input/number-input.component.ts +19 -0
- package/src/lib/components/forms/password-input/password-input.component.html +16 -0
- package/src/lib/components/forms/password-input/password-input.component.scss +3 -0
- package/src/lib/components/forms/password-input/password-input.component.spec.ts +25 -0
- package/src/lib/components/forms/password-input/password-input.component.ts +18 -0
- package/src/lib/components/forms/scss/mixins.scss +16 -0
- package/src/lib/components/forms/select-input/select-input.component.html +16 -0
- package/src/lib/components/forms/select-input/select-input.component.scss +7 -0
- package/src/lib/components/forms/select-input/select-input.component.spec.ts +25 -0
- package/src/lib/components/forms/select-input/select-input.component.ts +31 -0
- package/src/lib/components/forms/string-input/string-input.component.html +15 -0
- package/src/lib/components/forms/string-input/string-input.component.scss +3 -0
- package/src/lib/components/forms/string-input/string-input.component.spec.ts +25 -0
- package/src/lib/components/forms/string-input/string-input.component.ts +18 -0
- package/{lib/components/index.d.ts → src/lib/components/index.ts} +1 -0
- package/src/lib/components/resize-aware.component.ts +52 -0
- package/src/lib/components/types/bounds.class.ts +25 -0
- package/src/lib/components/types/dimension.class.ts +3 -0
- package/src/lib/components/types/point.class.ts +13 -0
- package/src/lib/directives/command.directive.spec.ts +73 -0
- package/src/lib/directives/command.directive.ts +81 -0
- package/src/lib/directives/focus-binding.directive.spec.ts +8 -0
- package/src/lib/directives/focus-binding.directive.ts +108 -0
- package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +1 -0
- package/src/lib/interaction/abstract-activity.ts +57 -0
- package/src/lib/interaction/activity.ts +17 -0
- package/src/lib/interaction/alert.ts +6 -0
- package/src/lib/interaction/components/activity-container/activity-container.component.html +8 -0
- package/src/lib/interaction/components/activity-container/activity-container.component.scss +3 -0
- package/src/lib/interaction/components/activity-container/activity-container.component.spec.ts +25 -0
- package/src/lib/interaction/components/activity-container/activity-container.component.ts +93 -0
- package/{lib/interaction/components/activity-outlet/activity-outlet-context.d.ts → src/lib/interaction/components/activity-outlet/activity-outlet-context.ts} +7 -5
- package/src/lib/interaction/components/activity-outlet/activity-outlet.component.scss +3 -0
- package/src/lib/interaction/components/activity-outlet/activity-outlet.component.spec.ts +25 -0
- package/src/lib/interaction/components/activity-outlet/activity-outlet.component.ts +96 -0
- package/src/lib/interaction/components/alert-dialog/alert-dialog.component.html +7 -0
- package/src/lib/interaction/components/alert-dialog/alert-dialog.component.scss +7 -0
- package/src/lib/interaction/components/alert-dialog/alert-dialog.component.spec.ts +25 -0
- package/src/lib/interaction/components/alert-dialog/alert-dialog.component.ts +20 -0
- package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.html +9 -0
- package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.scss +8 -0
- package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.spec.ts +25 -0
- package/src/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.ts +26 -0
- package/{lib/interaction/confirm.d.ts → src/lib/interaction/confirm.ts} +3 -2
- package/{lib/interaction/index.d.ts → src/lib/interaction/index.ts} +1 -0
- package/src/lib/interaction/interaction-context.ts +16 -0
- package/src/lib/interaction/interaction.module.ts +35 -0
- package/src/lib/interaction/result.ts +16 -0
- package/src/lib/interaction/services/dialog-interaction.service.scss +11 -0
- package/src/lib/interaction/services/dialog-interaction.service.spec.ts +12 -0
- package/src/lib/interaction/services/dialog-interaction.service.ts +63 -0
- package/src/lib/place/abstract-place-component.ts +33 -0
- package/src/lib/place/components/busy-overlay/busy-overlay.component.html +4 -0
- package/src/lib/place/components/busy-overlay/busy-overlay.component.scss +27 -0
- package/src/lib/place/components/busy-overlay/busy-overlay.component.spec.ts +25 -0
- package/src/lib/place/components/busy-overlay/busy-overlay.component.ts +23 -0
- package/src/lib/place/components/empty-state/empty-state.component.scss +15 -0
- package/src/lib/place/components/empty-state/empty-state.component.spec.ts +25 -0
- package/src/lib/place/components/empty-state/empty-state.component.ts +19 -0
- package/src/lib/place/components/place-outlet/place-outlet.component.html +7 -0
- package/src/lib/place/components/place-outlet/place-outlet.component.scss +12 -0
- package/src/lib/place/components/place-outlet/place-outlet.component.spec.ts +25 -0
- package/src/lib/place/components/place-outlet/place-outlet.component.ts +37 -0
- package/src/lib/place/components/place-outlet/route-animations.ts +30 -0
- package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.html +7 -0
- package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.scss +100 -0
- package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.spec.ts +25 -0
- package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.ts +30 -0
- package/src/lib/place/guards/leave-place.guard.spec.ts +15 -0
- package/src/lib/place/guards/leave-place.guard.ts +18 -0
- package/src/lib/place/guards/place-route.guard.ts +37 -0
- package/{lib/place/index.d.ts → src/lib/place/index.ts} +2 -1
- package/src/lib/place/place-component.ts +6 -0
- package/src/lib/place/place.decorator.ts +40 -0
- package/src/lib/place/place.module.ts +44 -0
- package/src/lib/place/place.service.spec.ts +12 -0
- package/src/lib/place/place.service.ts +29 -0
- package/src/lib/place/route/json-types.ts +5 -0
- package/src/lib/place/route/parameter-decorators.ts +99 -0
- package/src/lib/place/route/parameter-definition.class.ts +12 -0
- package/{lib/place/route/parameter-sanitiser.d.ts → src/lib/place/route/parameter-sanitiser.ts} +1 -1
- package/src/lib/place/route/parameter-type.ts +31 -0
- package/src/lib/place/route/route-parameter-bindings.ts +140 -0
- package/src/lib/place/route/route-parameter-sanitiser.ts +135 -0
- package/src/test-setup.ts +1 -0
- package/tsconfig.json +7 -0
- package/tsconfig.lib.json +20 -0
- package/tsconfig.schematics.json +35 -0
- package/tsconfig.spec.json +10 -0
- package/tslint.json +7 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +0 -3908
- package/bundles/coolon-angular-ui-powerups.umd.js.map +0 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +0 -2
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +0 -1
- package/coolon-angular-ui-powerups.d.ts +0 -30
- package/coolon-angular-ui-powerups.metadata.json +0 -1
- package/esm2015/coolon-angular-ui-powerups.js +0 -33
- package/esm2015/index.js +0 -6
- package/esm2015/lib/angular-ui-powerups.module.js +0 -54
- package/esm2015/lib/animations/index.js +0 -9
- package/esm2015/lib/animations/slideDownAndUpAnimation.js +0 -30
- package/esm2015/lib/components/disposable-component.js +0 -14
- package/esm2015/lib/components/forms/abstract-input.component.js +0 -183
- package/esm2015/lib/components/forms/number-input/number-input.component.js +0 -26
- package/esm2015/lib/components/forms/password-input/password-input.component.js +0 -26
- package/esm2015/lib/components/forms/select-input/select-input.component.js +0 -60
- package/esm2015/lib/components/forms/string-input/string-input.component.js +0 -26
- package/esm2015/lib/components/index.js +0 -18
- package/esm2015/lib/components/resize-aware.component.js +0 -96
- package/esm2015/lib/components/types/bounds.class.js +0 -56
- package/esm2015/lib/components/types/dimension.class.js +0 -21
- package/esm2015/lib/components/types/point.class.js +0 -36
- package/esm2015/lib/directives/command.directive.js +0 -135
- package/esm2015/lib/directives/focus-binding.directive.js +0 -179
- package/esm2015/lib/directives/index.js +0 -10
- package/esm2015/lib/interaction/abstract-activity.js +0 -129
- package/esm2015/lib/interaction/activity.js +0 -27
- package/esm2015/lib/interaction/alert.js +0 -23
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +0 -144
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -22
- package/esm2015/lib/interaction/components/activity-outlet/activity-outlet.component.js +0 -169
- package/esm2015/lib/interaction/components/alert-dialog/alert-dialog.component.js +0 -37
- package/esm2015/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +0 -46
- package/esm2015/lib/interaction/confirm.js +0 -17
- package/esm2015/lib/interaction/index.js +0 -21
- package/esm2015/lib/interaction/interaction-context.js +0 -35
- package/esm2015/lib/interaction/interaction.module.js +0 -41
- package/esm2015/lib/interaction/result.js +0 -24
- package/esm2015/lib/interaction/services/dialog-interaction.service.js +0 -114
- package/esm2015/lib/place/abstract-place-component.js +0 -59
- package/esm2015/lib/place/components/busy-overlay/busy-overlay.component.js +0 -44
- package/esm2015/lib/place/components/empty-state/empty-state.component.js +0 -28
- package/esm2015/lib/place/components/nav/nav.component.js +0 -31
- package/esm2015/lib/place/components/place-outlet/place-outlet.component.js +0 -67
- package/esm2015/lib/place/components/place-outlet/route-animations.js +0 -35
- package/esm2015/lib/place/guards/leave-place.guard.js +0 -52
- package/esm2015/lib/place/guards/place-route.guard.js +0 -74
- package/esm2015/lib/place/index.js +0 -27
- package/esm2015/lib/place/place-component.js +0 -17
- package/esm2015/lib/place/place.decorator.js +0 -72
- package/esm2015/lib/place/place.module.js +0 -49
- package/esm2015/lib/place/place.service.js +0 -61
- package/esm2015/lib/place/route/json-types.js +0 -13
- package/esm2015/lib/place/route/parameter-decorators.js +0 -178
- package/esm2015/lib/place/route/parameter-definition.class.js +0 -24
- package/esm2015/lib/place/route/parameter-sanitiser.js +0 -17
- package/esm2015/lib/place/route/parameter-type.js +0 -43
- package/esm2015/lib/place/route/route-parameter-bindings.js +0 -294
- package/esm2015/lib/place/route/route-parameter-sanitiser.js +0 -280
- package/esm2015/public_api.js +0 -11
- package/esm5/coolon-angular-ui-powerups.js +0 -33
- package/esm5/index.js +0 -6
- package/esm5/lib/angular-ui-powerups.module.js +0 -58
- package/esm5/lib/animations/index.js +0 -9
- package/esm5/lib/animations/slideDownAndUpAnimation.js +0 -30
- package/esm5/lib/components/disposable-component.js +0 -24
- package/esm5/lib/components/forms/abstract-input.component.js +0 -232
- package/esm5/lib/components/forms/number-input/number-input.component.js +0 -33
- package/esm5/lib/components/forms/password-input/password-input.component.js +0 -33
- package/esm5/lib/components/forms/select-input/select-input.component.js +0 -67
- package/esm5/lib/components/forms/string-input/string-input.component.js +0 -33
- package/esm5/lib/components/index.js +0 -18
- package/esm5/lib/components/resize-aware.component.js +0 -124
- package/esm5/lib/components/types/bounds.class.js +0 -59
- package/esm5/lib/components/types/dimension.class.js +0 -19
- package/esm5/lib/components/types/point.class.js +0 -43
- package/esm5/lib/directives/command.directive.js +0 -155
- package/esm5/lib/directives/focus-binding.directive.js +0 -231
- package/esm5/lib/directives/index.js +0 -10
- package/esm5/lib/interaction/abstract-activity.js +0 -173
- package/esm5/lib/interaction/activity.js +0 -27
- package/esm5/lib/interaction/alert.js +0 -23
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +0 -181
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet-context.js +0 -22
- package/esm5/lib/interaction/components/activity-outlet/activity-outlet.component.js +0 -206
- package/esm5/lib/interaction/components/alert-dialog/alert-dialog.component.js +0 -42
- package/esm5/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.js +0 -54
- package/esm5/lib/interaction/confirm.js +0 -17
- package/esm5/lib/interaction/index.js +0 -21
- package/esm5/lib/interaction/interaction-context.js +0 -45
- package/esm5/lib/interaction/interaction.module.js +0 -45
- package/esm5/lib/interaction/result.js +0 -24
- package/esm5/lib/interaction/services/dialog-interaction.service.js +0 -140
- package/esm5/lib/place/abstract-place-component.js +0 -66
- package/esm5/lib/place/components/busy-overlay/busy-overlay.component.js +0 -49
- package/esm5/lib/place/components/empty-state/empty-state.component.js +0 -29
- package/esm5/lib/place/components/nav/nav.component.js +0 -36
- package/esm5/lib/place/components/place-outlet/place-outlet.component.js +0 -81
- package/esm5/lib/place/components/place-outlet/route-animations.js +0 -35
- package/esm5/lib/place/guards/leave-place.guard.js +0 -57
- package/esm5/lib/place/guards/place-route.guard.js +0 -78
- package/esm5/lib/place/index.js +0 -27
- package/esm5/lib/place/place-component.js +0 -17
- package/esm5/lib/place/place.decorator.js +0 -69
- package/esm5/lib/place/place.module.js +0 -53
- package/esm5/lib/place/place.service.js +0 -75
- package/esm5/lib/place/route/json-types.js +0 -13
- package/esm5/lib/place/route/parameter-decorators.js +0 -178
- package/esm5/lib/place/route/parameter-definition.class.js +0 -24
- package/esm5/lib/place/route/parameter-sanitiser.js +0 -17
- package/esm5/lib/place/route/parameter-type.js +0 -65
- package/esm5/lib/place/route/route-parameter-bindings.js +0 -339
- package/esm5/lib/place/route/route-parameter-sanitiser.js +0 -395
- package/esm5/public_api.js +0 -11
- package/fesm2015/coolon-angular-ui-powerups.js +0 -3129
- package/fesm2015/coolon-angular-ui-powerups.js.map +0 -1
- package/fesm5/coolon-angular-ui-powerups.js +0 -3681
- package/fesm5/coolon-angular-ui-powerups.js.map +0 -1
- package/lib/angular-ui-powerups.module.d.ts +0 -2
- package/lib/animations/slideDownAndUpAnimation.d.ts +0 -5
- package/lib/components/disposable-component.d.ts +0 -5
- package/lib/components/forms/abstract-input.component.d.ts +0 -35
- package/lib/components/forms/number-input/number-input.component.d.ts +0 -6
- package/lib/components/forms/password-input/password-input.component.d.ts +0 -6
- package/lib/components/forms/select-input/select-input.component.d.ts +0 -11
- package/lib/components/forms/string-input/string-input.component.d.ts +0 -6
- package/lib/components/resize-aware.component.d.ts +0 -22
- package/lib/components/types/bounds.class.d.ts +0 -16
- package/lib/components/types/dimension.class.d.ts +0 -5
- package/lib/components/types/point.class.d.ts +0 -10
- package/lib/directives/command.directive.d.ts +0 -14
- package/lib/directives/focus-binding.directive.d.ts +0 -22
- package/lib/interaction/abstract-activity.d.ts +0 -17
- package/lib/interaction/activity.d.ts +0 -11
- package/lib/interaction/alert.d.ts +0 -5
- package/lib/interaction/components/activity-container/activity-container.component.d.ts +0 -32
- package/lib/interaction/components/activity-outlet/activity-outlet.component.d.ts +0 -30
- package/lib/interaction/components/alert-dialog/alert-dialog.component.d.ts +0 -8
- package/lib/interaction/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -9
- package/lib/interaction/interaction-context.d.ts +0 -11
- package/lib/interaction/interaction.module.d.ts +0 -2
- package/lib/interaction/result.d.ts +0 -8
- package/lib/interaction/services/dialog-interaction.service.d.ts +0 -14
- package/lib/place/abstract-place-component.d.ts +0 -13
- package/lib/place/components/busy-overlay/busy-overlay.component.d.ts +0 -8
- package/lib/place/components/empty-state/empty-state.component.d.ts +0 -5
- package/lib/place/components/nav/nav.component.d.ts +0 -7
- package/lib/place/components/place-outlet/place-outlet.component.d.ts +0 -13
- package/lib/place/components/place-outlet/route-animations.d.ts +0 -1
- package/lib/place/guards/leave-place.guard.d.ts +0 -10
- package/lib/place/guards/place-route.guard.d.ts +0 -9
- package/lib/place/place-component.d.ts +0 -5
- package/lib/place/place.decorator.d.ts +0 -20
- package/lib/place/place.module.d.ts +0 -2
- package/lib/place/place.service.d.ts +0 -8
- package/lib/place/route/json-types.d.ts +0 -7
- package/lib/place/route/parameter-decorators.d.ts +0 -26
- package/lib/place/route/parameter-definition.class.d.ts +0 -11
- package/lib/place/route/parameter-type.d.ts +0 -16
- package/lib/place/route/route-parameter-bindings.d.ts +0 -18
- package/lib/place/route/route-parameter-sanitiser.d.ts +0 -42
- package/schematics/ng-add/index.d.ts +0 -2
- package/schematics/ng-add/index.js +0 -12
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/place-routes/index.d.ts +0 -3
- package/schematics/place-routes/index.js +0 -114
- package/schematics/place-routes/index.js.map +0 -1
- package/schematics/place-routes/place-def.d.ts +0 -34
- package/schematics/place-routes/place-def.js +0 -84
- package/schematics/place-routes/place-def.js.map +0 -1
- package/schematics/place-routes/scanner.d.ts +0 -26
- package/schematics/place-routes/scanner.js +0 -125
- package/schematics/place-routes/scanner.js.map +0 -1
- package/schematics/place-routes/schema.d.ts +0 -7
- package/schematics/place-routes/schema.js +0 -3
- package/schematics/place-routes/schema.js.map +0 -1
- /package/{index.d.ts → src/index.ts} +0 -0
- /package/{public_api.d.ts → src/public_api.ts} +0 -0
package/CHANGELOG.md
ADDED
package/jest.config.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: 'angular-ui-powerups',
|
|
3
|
+
preset: '../../jest.config.js',
|
|
4
|
+
coverageDirectory: '../../coverage/libs/angular-ui-powerups',
|
|
5
|
+
snapshotSerializers: [
|
|
6
|
+
'jest-preset-angular/AngularSnapshotSerializer.js',
|
|
7
|
+
'jest-preset-angular/HTMLCommentSerializer.js'
|
|
8
|
+
]
|
|
9
|
+
};
|
package/ng-package.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../dist/libs/angular-ui-powerups",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/index.ts"
|
|
6
|
+
},
|
|
7
|
+
"whitelistedNonPeerDependencies": [
|
|
8
|
+
"ts-morph",
|
|
9
|
+
"@typescript-plus/fast-memoize-decorator",
|
|
10
|
+
"@coolon/typescript-utilities",
|
|
11
|
+
"json5"
|
|
12
|
+
]
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coolon/angular-ui-powerups",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "../../node_modules/.bin/tsc -p tsconfig.schematics.json",
|
|
7
|
+
"copy:schemas": "rsync -av -R schematics/*/schema.json ../../dist/libs/angular-ui-powerups/",
|
|
8
|
+
"copy:files": "rsync -av -R schematics/*/templates/** ../../dist/libs/angular-ui-powerups/",
|
|
9
|
+
"copy:collection": "shx cp schematics/collection.json ../../dist/libs/angular-ui-powerups/schematics/collection.json",
|
|
10
|
+
"copy:styles": "rsync -av -R styles/* ../../dist/libs/angular-ui-powerups",
|
|
11
|
+
"postbuild": "npm run copy:schemas && npm run copy:files && npm run copy:collection && npm run copy:styles",
|
|
12
|
+
"release": "standard-version && git push --follow-tags origin master && npm publish"
|
|
13
|
+
},
|
|
5
14
|
"dependencies": {
|
|
6
15
|
"ts-morph": "^3.1.3",
|
|
7
16
|
"@typescript-plus/fast-memoize-decorator": "^0.1.0",
|
|
8
17
|
"@coolon/typescript-utilities": "^2.0.0",
|
|
9
|
-
"json5": "^2.1.0"
|
|
10
|
-
"tslib": "^1.9.0"
|
|
18
|
+
"json5": "^2.1.0"
|
|
11
19
|
},
|
|
12
20
|
"peerDependencies": {
|
|
13
21
|
"@angular/common": "^8.1.1",
|
|
@@ -17,15 +25,5 @@
|
|
|
17
25
|
"@angular/cdk": "^8.1.3",
|
|
18
26
|
"@coolon/pectin": ">=1.14.22",
|
|
19
27
|
"resize-observer-polyfill": "^1.5.1"
|
|
20
|
-
}
|
|
21
|
-
"main": "bundles/coolon-angular-ui-powerups.umd.js",
|
|
22
|
-
"module": "fesm5/coolon-angular-ui-powerups.js",
|
|
23
|
-
"es2015": "fesm2015/coolon-angular-ui-powerups.js",
|
|
24
|
-
"esm5": "esm5/coolon-angular-ui-powerups.js",
|
|
25
|
-
"esm2015": "esm2015/coolon-angular-ui-powerups.js",
|
|
26
|
-
"fesm5": "fesm5/coolon-angular-ui-powerups.js",
|
|
27
|
-
"fesm2015": "fesm2015/coolon-angular-ui-powerups.js",
|
|
28
|
-
"typings": "coolon-angular-ui-powerups.d.ts",
|
|
29
|
-
"metadata": "coolon-angular-ui-powerups.metadata.json",
|
|
30
|
-
"sideEffects": false
|
|
28
|
+
}
|
|
31
29
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';
|
|
2
|
+
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
|
3
|
+
|
|
4
|
+
// Just return the tree
|
|
5
|
+
export function ngAdd(_options: any): Rule {
|
|
6
|
+
return (tree: Tree, _context: SchematicContext) => {
|
|
7
|
+
_context.addTask(new NodePackageInstallTask());
|
|
8
|
+
return tree;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { experimental, strings } from '@angular-devkit/core';
|
|
2
|
+
import {
|
|
3
|
+
apply,
|
|
4
|
+
applyTemplates,
|
|
5
|
+
FileEntry,
|
|
6
|
+
forEach,
|
|
7
|
+
mergeWith,
|
|
8
|
+
Rule,
|
|
9
|
+
SchematicContext,
|
|
10
|
+
Tree,
|
|
11
|
+
url,
|
|
12
|
+
move
|
|
13
|
+
} from '@angular-devkit/schematics';
|
|
14
|
+
import { scanForRouteEntryPoints } from '@angular/compiler-cli/src/ngtsc/routing/src/lazy';
|
|
15
|
+
import { fileExists } from '@nrwl/workspace/src/utils/fileutils';
|
|
16
|
+
import * as JSON5 from 'json5';
|
|
17
|
+
import { ClassDeclaration, Project } from 'ts-morph';
|
|
18
|
+
import { PlaceDef } from './place-def';
|
|
19
|
+
import { Schema } from './schema';
|
|
20
|
+
|
|
21
|
+
const PLACE_ANNOTATION = /@Place\({([^})]*)}\)/m;
|
|
22
|
+
|
|
23
|
+
export function generateRoutes(options: Schema): Rule {
|
|
24
|
+
|
|
25
|
+
return (tree: Tree, context: SchematicContext) => {
|
|
26
|
+
|
|
27
|
+
const workspaceConfig = tree.read('/angular.json');
|
|
28
|
+
if (!workspaceConfig) {
|
|
29
|
+
throw new Error('Could not find Angular workspace configuration');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// convert workspace to string
|
|
33
|
+
const workspaceContent = workspaceConfig.toString();
|
|
34
|
+
|
|
35
|
+
// parse workspace string into JSON object
|
|
36
|
+
const workspace: experimental.workspace.WorkspaceSchema = JSON.parse(workspaceContent);
|
|
37
|
+
|
|
38
|
+
if (!options.project) {
|
|
39
|
+
options.project = workspace.defaultProject;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const projectName = options.project as string;
|
|
43
|
+
const project = workspace.projects[projectName];
|
|
44
|
+
const config = loadConfig(project, tree, context);
|
|
45
|
+
const placeDefs = extractPlaces(project, options, tree, context);
|
|
46
|
+
const projectType = project.projectType === 'application' ? 'app' : 'lib';
|
|
47
|
+
|
|
48
|
+
const files = apply(
|
|
49
|
+
url('./templates'),
|
|
50
|
+
[
|
|
51
|
+
applyTemplates({
|
|
52
|
+
...options,
|
|
53
|
+
placeDefs,
|
|
54
|
+
config,
|
|
55
|
+
...strings
|
|
56
|
+
}),
|
|
57
|
+
move(`${project.sourceRoot}/${projectType}`),
|
|
58
|
+
// @see https://github.com/angular/angular-cli/issues/11337#issuecomment-448259549
|
|
59
|
+
forEach((fileEntry: FileEntry) => {
|
|
60
|
+
if (tree.exists(fileEntry.path)) {
|
|
61
|
+
tree.overwrite(fileEntry.path, fileEntry.content);
|
|
62
|
+
}
|
|
63
|
+
return fileEntry;
|
|
64
|
+
})
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
return mergeWith(files);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// function applyWithOverwrite(source: Source, rules: Rule[]): Rule {
|
|
75
|
+
// return (tree: Tree, _context: SchematicContext) => {
|
|
76
|
+
// const rule = mergeWith(
|
|
77
|
+
// apply(source, [
|
|
78
|
+
// ...rules,
|
|
79
|
+
// forEach((fileEntry) => {
|
|
80
|
+
// if (tree.exists(fileEntry.path)) {
|
|
81
|
+
// tree.overwrite(fileEntry.path, fileEntry.content);
|
|
82
|
+
// return null;
|
|
83
|
+
// }
|
|
84
|
+
// return fileEntry;
|
|
85
|
+
// })
|
|
86
|
+
// ])
|
|
87
|
+
// );
|
|
88
|
+
//
|
|
89
|
+
// return rule(tree, _context);
|
|
90
|
+
// };
|
|
91
|
+
// }
|
|
92
|
+
|
|
93
|
+
function createProject(project: any, context: SchematicContext) {
|
|
94
|
+
const tsConfigPath = project.architect.build.options.tsConfig;
|
|
95
|
+
context.logger.info(`loading tsConfig from -> ${tsConfigPath}`);
|
|
96
|
+
try {
|
|
97
|
+
return new Project({
|
|
98
|
+
tsConfigFilePath: `./${tsConfigPath}`
|
|
99
|
+
});
|
|
100
|
+
} catch (error) {
|
|
101
|
+
context.logger.fatal(`Failed to load typescript project form: ${project.root} You probably need to specify the --project option?`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function loadConfig(project: any, tree: Tree, context: SchematicContext) {
|
|
106
|
+
context.logger.info(`loading places config from -> ${project.root}/places.json (or places.json5)`);
|
|
107
|
+
const fileEntry = tree.get(`${project.root}/places.json5`) || tree.get(`${project.root}/places.json5`);
|
|
108
|
+
if (!fileEntry) {
|
|
109
|
+
throw new Error(`Unable to find config file at '${project.root}/places.json' or '${project.root}/places.json5'`);
|
|
110
|
+
}
|
|
111
|
+
const config = JSON5.parse(fileEntry.content.toString('utf-8'));
|
|
112
|
+
return config;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function extractPlaces(project: any, schema: Schema, tree: Tree, context: SchematicContext): PlaceDef[] {
|
|
116
|
+
const projectType = project.projectType === 'application' ? 'app' : 'lib';
|
|
117
|
+
const projectRoot = `${project.root}`;
|
|
118
|
+
const sourceRoot = `${project.sourceRoot}/${projectType}`;
|
|
119
|
+
const importPrefix = `./${sourceRoot}`;
|
|
120
|
+
const tsProject = createProject(project, context);
|
|
121
|
+
const placeDefs: PlaceDef[] = [];
|
|
122
|
+
context.logger.info(`Scanning sources in -> ${sourceRoot}`);
|
|
123
|
+
tree.getDir(sourceRoot).visit(filePath => {
|
|
124
|
+
if (!filePath.endsWith('.ts')) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const content = tree.read(filePath);
|
|
129
|
+
if (!content) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const sourceText = content.toString('utf-8');
|
|
133
|
+
|
|
134
|
+
if (sourceText.match(PLACE_ANNOTATION)) {
|
|
135
|
+
|
|
136
|
+
const sourceFile = tsProject.getSourceFileOrThrow(`./${filePath}`);
|
|
137
|
+
|
|
138
|
+
sourceFile.getClasses().forEach((classDecl: ClassDeclaration) => {
|
|
139
|
+
|
|
140
|
+
PlaceDef.scan(classDecl, context).onMatch(result => {
|
|
141
|
+
// context.logger.info(`filePath=${filePath}`);
|
|
142
|
+
const moduleImportPath = `./${filePath.substr(importPrefix.length, filePath.length - importPrefix.length - '.ts'.length)}`;
|
|
143
|
+
const definition = result.createDefinition(moduleImportPath);
|
|
144
|
+
context.logger.info(`${moduleImportPath} -> ${classDecl.getName()}(route: /${definition.fullPath})`);
|
|
145
|
+
placeDefs.push(definition);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return placeDefs;
|
|
152
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { SchematicContext } from '@angular-devkit/schematics';
|
|
2
|
+
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
3
|
+
import { ClassDeclaration } from 'ts-morph';
|
|
4
|
+
import { Scanner } from './scanner';
|
|
5
|
+
|
|
6
|
+
export class PlaceDef {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
readonly importPath: string,
|
|
11
|
+
readonly componentClass: string,
|
|
12
|
+
readonly properties: PlaceDef.Options,
|
|
13
|
+
readonly routeDef: PlaceDef.Parameter,
|
|
14
|
+
readonly queryParameters: PlaceDef.Parameter[]
|
|
15
|
+
) {
|
|
16
|
+
// console.log({ properties, routeDef });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Memoize()
|
|
20
|
+
get path() {
|
|
21
|
+
return this.stripEnclosingQuotes(this.properties.path);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Memoize()
|
|
25
|
+
get routeIdentifier() {
|
|
26
|
+
return this.routeDef ? this.stripEnclosingQuotes(this.routeDef.parameterName) : null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get fullPath() {
|
|
30
|
+
return !!this.routeIdentifier ?
|
|
31
|
+
`${this.path}/:${this.routeIdentifier}` :
|
|
32
|
+
this.path;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Memoize()
|
|
36
|
+
get placeName() {
|
|
37
|
+
return this.componentClass.replace(/Component$/, "")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get order() {
|
|
41
|
+
return this.properties.order
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@Memoize()
|
|
45
|
+
get activateGuardNames() {
|
|
46
|
+
const activateGuards = [];
|
|
47
|
+
if (this.authenticate) {
|
|
48
|
+
activateGuards.push('AuthGuard');
|
|
49
|
+
}
|
|
50
|
+
if (this.requiresRouteGuard()) {
|
|
51
|
+
activateGuards.push('PlaceRouteGuard');
|
|
52
|
+
}
|
|
53
|
+
return activateGuards;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
private requiresRouteGuard() {
|
|
57
|
+
return this.routeIdentifier || this.queryParameters.length > 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Memoize()
|
|
61
|
+
get routeModelName() {
|
|
62
|
+
return this.routeDef ? this.stripEnclosingQuotes(this.routeDef.modelName) : null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get authenticate() {
|
|
66
|
+
return this.properties.authenticate === 'true';
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
stripEnclosingQuotes(value: string): string {
|
|
70
|
+
const cooked = value.replace(/(^["'])|(["']$)/g, '');
|
|
71
|
+
// console.log({ raw: value, cooked: cooked });
|
|
72
|
+
return cooked;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export namespace PlaceDef {
|
|
77
|
+
|
|
78
|
+
export interface Options {
|
|
79
|
+
title: string;
|
|
80
|
+
path: string;
|
|
81
|
+
order: number;
|
|
82
|
+
authenticate: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface Parameter {
|
|
86
|
+
parameterName: string;
|
|
87
|
+
modelName: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function scan(classDecl: ClassDeclaration, context: SchematicContext): Scanner {
|
|
91
|
+
return new Scanner(classDecl, context);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { SchematicContext } from '@angular-devkit/schematics';
|
|
2
|
+
import {
|
|
3
|
+
ClassDeclaration,
|
|
4
|
+
Decorator,
|
|
5
|
+
Node,
|
|
6
|
+
ObjectLiteralExpression,
|
|
7
|
+
PropertyAssignmentStructure,
|
|
8
|
+
PropertyDeclaration,
|
|
9
|
+
SyntaxKind
|
|
10
|
+
} from 'ts-morph';
|
|
11
|
+
import { PlaceDef } from './place-def';
|
|
12
|
+
|
|
13
|
+
function isDecoratorNode(node: Node, name: string): node is Decorator {
|
|
14
|
+
return node.getKind() === SyntaxKind.Decorator && node.getText().startsWith(`${name}(`); // NOTE: I'm only supporting the @Decorator(...) style of usage (i.e. decorator factories).
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class Scanner {
|
|
18
|
+
|
|
19
|
+
private placeAnnotation: Decorator;
|
|
20
|
+
|
|
21
|
+
constructor(private readonly classDecl: ClassDeclaration, readonly context: SchematicContext) {
|
|
22
|
+
classDecl.forEachChild((node) => {
|
|
23
|
+
if (isDecoratorNode(node, '@Place')) {
|
|
24
|
+
this.placeAnnotation = node as Decorator;
|
|
25
|
+
// stop iterating when the node is a class declaration
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
isPlace() {
|
|
32
|
+
return !!this.placeAnnotation;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onMatch(callback: (scan: Scanner) => void) {
|
|
36
|
+
if (this.isPlace()) {
|
|
37
|
+
callback(this);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
createDefinition(moduleImportPath: string): PlaceDef {
|
|
42
|
+
this.getRouteIdParameter();
|
|
43
|
+
return new PlaceDef(moduleImportPath,
|
|
44
|
+
this.classDecl.getName(),
|
|
45
|
+
this.getPlaceOptions(),
|
|
46
|
+
this.getRouteIdParameter(),
|
|
47
|
+
this.getQueryParameters()
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
protected getPlaceOptions(): PlaceDef.Options {
|
|
52
|
+
// const args = this.placeAnnotation.getArguments();
|
|
53
|
+
// if (args.length !== 1) {
|
|
54
|
+
// console.error('@Place() accepts a single Options argument. got', args);
|
|
55
|
+
// }
|
|
56
|
+
return Scanner.getOptionsArg(this.placeAnnotation, {
|
|
57
|
+
title: '',
|
|
58
|
+
path: '',
|
|
59
|
+
order: -1,
|
|
60
|
+
authenticate: 'true'
|
|
61
|
+
}, {
|
|
62
|
+
position: 0,
|
|
63
|
+
required: true
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
protected getRouteIdParameter(): PlaceDef.Parameter {
|
|
68
|
+
const routeProperties = this.getDecoratedProperties('@RouteId');
|
|
69
|
+
if (routeProperties.length === 1) {
|
|
70
|
+
const route = routeProperties[0];
|
|
71
|
+
const routeOptions = Scanner.getOptionsArg(route.decorator, { as: 'id' }, {
|
|
72
|
+
position: 1,
|
|
73
|
+
required: false
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
modelName: route.property.getName(),
|
|
77
|
+
parameterName: routeOptions.as
|
|
78
|
+
};
|
|
79
|
+
} else if (routeProperties.length > 1) {
|
|
80
|
+
this.context.logger.error(`There an only be one @RouteId(), got ${routeProperties.length}`);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected getQueryParameters(): PlaceDef.Parameter[] {
|
|
86
|
+
return this.getDecoratedProperties('@QueryParameter')
|
|
87
|
+
.map(p => {
|
|
88
|
+
const options = Scanner.getOptionsArg(p.decorator, { as: p.property.getName() }, {
|
|
89
|
+
position: 1,
|
|
90
|
+
required: false
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
modelName: p.property.getName(),
|
|
94
|
+
parameterName: options.as
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
protected getDecoratedProperties(annotation: string): { decorator: Decorator, property: PropertyDeclaration }[] {
|
|
100
|
+
return this.classDecl.getProperties().map(p => {
|
|
101
|
+
let result: { decorator: Decorator, property: PropertyDeclaration } = null;
|
|
102
|
+
p.forEachChild((child) => {
|
|
103
|
+
if (isDecoratorNode(child, annotation)) {
|
|
104
|
+
result = {
|
|
105
|
+
decorator: child,
|
|
106
|
+
property: p
|
|
107
|
+
};
|
|
108
|
+
// stop traversal
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return result;
|
|
113
|
+
}).filter(r => !!r);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export namespace Scanner {
|
|
119
|
+
|
|
120
|
+
export function getObjectLiteralArgument(annotation: Decorator, position: number): ObjectLiteralExpression {
|
|
121
|
+
const args = annotation.getArguments();
|
|
122
|
+
if (args.length > position && args[position] instanceof ObjectLiteralExpression) {
|
|
123
|
+
return args[position] as ObjectLiteralExpression;
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function getOptionsArg<T extends {}>(annotation: Decorator, defaults: T, options: { position: number, required: boolean } = {
|
|
129
|
+
position: 0,
|
|
130
|
+
required: true
|
|
131
|
+
}): T {
|
|
132
|
+
const objectLiteralArgument = getObjectLiteralArgument(annotation, options.position);
|
|
133
|
+
if (!objectLiteralArgument) {
|
|
134
|
+
if (options.required) {
|
|
135
|
+
console.error(`expected object literal arg at position ${options.position}`, { expectedType: defaults });
|
|
136
|
+
}
|
|
137
|
+
return defaults;
|
|
138
|
+
} else {
|
|
139
|
+
return objectLiteralArgument.getProperties().reduce((result, p) => {
|
|
140
|
+
const structure = p.getStructure() as PropertyAssignmentStructure;
|
|
141
|
+
return { ...result, [structure.name]: structure.initializer as string };
|
|
142
|
+
}, { ...defaults });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { async, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { AngularUiPowerupsModule } from './angular-ui-powerups.module';
|
|
3
|
+
|
|
4
|
+
describe('AngularUiPowerupsModule', () => {
|
|
5
|
+
beforeEach(async(() => {
|
|
6
|
+
TestBed.configureTestingModule({
|
|
7
|
+
imports: [AngularUiPowerupsModule]
|
|
8
|
+
}).compileComponents();
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
it('should create', () => {
|
|
12
|
+
expect(AngularUiPowerupsModule).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { MatFormFieldModule, MatInputModule, MatSelectModule } from '@angular/material';
|
|
5
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
6
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
|
+
import { NumberInputComponent} from './components/forms/number-input/number-input.component';
|
|
8
|
+
import { CommandDirective } from './directives/command.directive';
|
|
9
|
+
import { FocusBindingDirective } from './directives/focus-binding.directive';
|
|
10
|
+
import { StringInputComponent } from './components/forms/string-input/string-input.component';
|
|
11
|
+
import { PasswordInputComponent } from './components/forms/password-input/password-input.component';
|
|
12
|
+
import { SelectInputComponent } from './components/forms/select-input/select-input.component';
|
|
13
|
+
import { InteractionModule } from './interaction/interaction.module';
|
|
14
|
+
import { PlaceModule } from './place/place.module';
|
|
15
|
+
|
|
16
|
+
@NgModule({
|
|
17
|
+
declarations: [
|
|
18
|
+
CommandDirective,
|
|
19
|
+
FocusBindingDirective,
|
|
20
|
+
NumberInputComponent,
|
|
21
|
+
StringInputComponent,
|
|
22
|
+
PasswordInputComponent,
|
|
23
|
+
SelectInputComponent,
|
|
24
|
+
],
|
|
25
|
+
imports: [
|
|
26
|
+
CommonModule,
|
|
27
|
+
BrowserModule,
|
|
28
|
+
BrowserAnimationsModule,
|
|
29
|
+
FormsModule,
|
|
30
|
+
MatInputModule,
|
|
31
|
+
MatFormFieldModule,
|
|
32
|
+
MatSelectModule,
|
|
33
|
+
PlaceModule,
|
|
34
|
+
InteractionModule
|
|
35
|
+
],
|
|
36
|
+
exports: [
|
|
37
|
+
CommandDirective,
|
|
38
|
+
FocusBindingDirective,
|
|
39
|
+
NumberInputComponent,
|
|
40
|
+
StringInputComponent,
|
|
41
|
+
PasswordInputComponent,
|
|
42
|
+
SelectInputComponent,
|
|
43
|
+
InteractionModule,
|
|
44
|
+
PlaceModule,
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
})
|
|
48
|
+
export class AngularUiPowerupsModule {
|
|
49
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { animate, AnimationStyleMetadata, style, transition, trigger } from '@angular/animations';
|
|
2
|
+
import { OptionsHelper } from '@coolon/pectin';
|
|
3
|
+
|
|
4
|
+
const defaultHiddenStyleDef = style({
|
|
5
|
+
opacity: 0,
|
|
6
|
+
'height': '0',
|
|
7
|
+
paddingTop: '0',
|
|
8
|
+
paddingBottom: '0'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export function slideDownAndUpAnimation(triggerName: string, options?: {
|
|
12
|
+
duration?: string;
|
|
13
|
+
hiddenStyleDef?: AnimationStyleMetadata;
|
|
14
|
+
}) {
|
|
15
|
+
// SEE to fix this: https://github.com/angular/angular/issues/15587#issuecomment-351510501
|
|
16
|
+
const duration = OptionsHelper.get(options).getOptional('duration', '100ms');
|
|
17
|
+
const hiddenStyleDef = OptionsHelper.get(options).getOptional('hiddenStyleDef', defaultHiddenStyleDef);
|
|
18
|
+
return trigger(triggerName, [
|
|
19
|
+
transition(':enter', [hiddenStyleDef, animate('100ms')]),
|
|
20
|
+
transition(':leave', [animate('100ms', hiddenStyleDef)])
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// export function slideOutLeftAnimation(triggerName: string, duration:string = "100ms") {
|
|
25
|
+
// return trigger(triggerName, [
|
|
26
|
+
// state('true', style(
|
|
27
|
+
// {
|
|
28
|
+
// 'width': '*',
|
|
29
|
+
// 'overflow': 'hidden',
|
|
30
|
+
// 'opacity': '1'
|
|
31
|
+
// })),
|
|
32
|
+
// state('false', style({
|
|
33
|
+
// 'width': '0px',
|
|
34
|
+
// 'overflow': 'hidden',
|
|
35
|
+
// 'opacity': '0'
|
|
36
|
+
// })),
|
|
37
|
+
// transition('* => *', [animate(duration)])
|
|
38
|
+
// ]);
|
|
39
|
+
// }
|