@coolon/angular-ui-powerups 0.0.24 → 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} +1 -0
- 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 -3926
- 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/place-outlet/place-outlet.component.js +0 -67
- package/esm2015/lib/place/components/place-outlet/route-animations.js +0 -35
- package/esm2015/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +0 -50
- 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/place-outlet/place-outlet.component.js +0 -81
- package/esm5/lib/place/components/place-outlet/route-animations.js +0 -35
- package/esm5/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.js +0 -57
- 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 -3145
- package/fesm2015/coolon-angular-ui-powerups.js.map +0 -1
- package/fesm5/coolon-angular-ui-powerups.js +0 -3699
- 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/place-outlet/place-outlet.component.d.ts +0 -13
- package/lib/place/components/place-outlet/route-animations.d.ts +0 -1
- package/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.d.ts +0 -11
- 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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PortalModule } from '@angular/cdk/portal';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NgModule } from '@angular/core';
|
|
4
|
+
import { MatButtonModule, MatDialogModule, MatTabsModule } from '@angular/material';
|
|
5
|
+
import { ActivityContainerComponent } from './components/activity-container/activity-container.component';
|
|
6
|
+
import { AlertDialogComponent } from './components/alert-dialog/alert-dialog.component';
|
|
7
|
+
import { ConfirmationDialogComponent } from './components/confirmation-dialog/confirmation-dialog.component';
|
|
8
|
+
import { ActivityOutletComponent } from './components/activity-outlet/activity-outlet.component';
|
|
9
|
+
import { DialogInteractionService } from './services/dialog-interaction.service';
|
|
10
|
+
|
|
11
|
+
@NgModule({
|
|
12
|
+
imports: [
|
|
13
|
+
CommonModule,
|
|
14
|
+
MatButtonModule,
|
|
15
|
+
MatDialogModule,
|
|
16
|
+
MatTabsModule,
|
|
17
|
+
PortalModule
|
|
18
|
+
],
|
|
19
|
+
declarations: [
|
|
20
|
+
ActivityContainerComponent,
|
|
21
|
+
ConfirmationDialogComponent,
|
|
22
|
+
AlertDialogComponent,
|
|
23
|
+
ActivityOutletComponent
|
|
24
|
+
],
|
|
25
|
+
entryComponents: [
|
|
26
|
+
ActivityContainerComponent,
|
|
27
|
+
ConfirmationDialogComponent,
|
|
28
|
+
AlertDialogComponent
|
|
29
|
+
],
|
|
30
|
+
providers: [
|
|
31
|
+
DialogInteractionService
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
export class InteractionModule {
|
|
35
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface Result<R, E> {
|
|
2
|
+
// catch(callback: (error: E) => void): Result<R,E>;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export namespace Result {
|
|
6
|
+
export interface Callback<R,E> {
|
|
7
|
+
then: <T>(result:R)=>T;
|
|
8
|
+
catch: <T>(result:E)=>T;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// const r:Result<string, number> = null;
|
|
14
|
+
|
|
15
|
+
// r.catch(e => {}).then();
|
|
16
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// this is currently imported by styles.scss in the project root.
|
|
2
|
+
.dialog-interaction-service {
|
|
3
|
+
max-width: 95vw !important;
|
|
4
|
+
max-height: 95vh !important;
|
|
5
|
+
|
|
6
|
+
mat-dialog-container {
|
|
7
|
+
max-width: 95vw !important;
|
|
8
|
+
max-height: 95vh !important;
|
|
9
|
+
padding: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { DialogInteractionService } from './dialog-interaction.service';
|
|
4
|
+
|
|
5
|
+
describe('DialogInteractionService', () => {
|
|
6
|
+
beforeEach(() => TestBed.configureTestingModule({}));
|
|
7
|
+
|
|
8
|
+
it('should be created', () => {
|
|
9
|
+
const service: DialogInteractionService = TestBed.get(DialogInteractionService);
|
|
10
|
+
expect(service).toBeTruthy();
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { MatDialog, MatDialogRef } from '@angular/material';
|
|
3
|
+
import { Constructable } from '@coolon/pectin';
|
|
4
|
+
import { Activity } from '../activity';
|
|
5
|
+
import { Alert } from '../alert';
|
|
6
|
+
import { ActivityContainerComponent } from '../components/activity-container/activity-container.component';
|
|
7
|
+
import { AlertDialogComponent } from '../components/alert-dialog/alert-dialog.component';
|
|
8
|
+
import { ConfirmationDialogComponent } from '../components/confirmation-dialog/confirmation-dialog.component';
|
|
9
|
+
import { Confirm } from '../confirm';
|
|
10
|
+
import { InteractionContext } from '../interaction-context';
|
|
11
|
+
import { assert } from '@coolon/typescript-utilities';
|
|
12
|
+
|
|
13
|
+
@Injectable({
|
|
14
|
+
providedIn: 'root'
|
|
15
|
+
})
|
|
16
|
+
export class DialogInteractionService extends InteractionContext {
|
|
17
|
+
|
|
18
|
+
constructor(private readonly dialogService: MatDialog) {
|
|
19
|
+
super();
|
|
20
|
+
assert.notNil(dialogService);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data?: D): Promise<R> {
|
|
24
|
+
return this._startActivity(activityType, data);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private _startActivity<D, R, E>(activityType: Constructable<Activity<D, R, E>>, data: D, disableClose: boolean = true) {
|
|
28
|
+
const config = {
|
|
29
|
+
data,
|
|
30
|
+
disableClose,
|
|
31
|
+
panelClass: 'dialog-interaction-service',
|
|
32
|
+
autoFocus: false
|
|
33
|
+
};
|
|
34
|
+
const matDialogRef = this.dialogService.open(ActivityContainerComponent, config) as MatDialogRef<ActivityContainerComponent>;
|
|
35
|
+
return new Promise<R>((resolve, reject) => {
|
|
36
|
+
const activityContainer = matDialogRef.componentInstance;
|
|
37
|
+
activityContainer.parentInteractionContext = this;
|
|
38
|
+
activityContainer.initialise({
|
|
39
|
+
activityClass: activityType,
|
|
40
|
+
activityData: data,
|
|
41
|
+
onDone(result) {
|
|
42
|
+
resolve(result);
|
|
43
|
+
matDialogRef.close(result);
|
|
44
|
+
},
|
|
45
|
+
onCancel(error) {
|
|
46
|
+
reject(error);
|
|
47
|
+
matDialogRef.close(error);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
matDialogRef.updateSize();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
alert(alert: Alert): Promise<void> {
|
|
56
|
+
return this._startActivity(AlertDialogComponent, alert, false);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
confirm(confirm: Confirm): Promise<boolean> {
|
|
60
|
+
return this._startActivity(ConfirmationDialogComponent, confirm, true);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
2
|
+
|
|
3
|
+
import { Constructable, DelegatingValueModel, MutableValueModel, UseDelegate } from '@coolon/pectin';
|
|
4
|
+
import { Memoize } from '@typescript-plus/fast-memoize-decorator';
|
|
5
|
+
import { DisposableComponent } from '../components/disposable-component';
|
|
6
|
+
import { PlaceComponent } from './place-component';
|
|
7
|
+
import { Place } from './place.decorator';
|
|
8
|
+
import { RouteParameterBindings } from './route/route-parameter-bindings';
|
|
9
|
+
|
|
10
|
+
export class AbstractPlaceComponent extends DisposableComponent implements PlaceComponent {
|
|
11
|
+
|
|
12
|
+
@UseDelegate()
|
|
13
|
+
readonly titleModel: MutableValueModel<string>;
|
|
14
|
+
|
|
15
|
+
private routeBindingMediator: RouteParameterBindings;
|
|
16
|
+
|
|
17
|
+
constructor(protected activatedRoute: ActivatedRoute, router: Router) {
|
|
18
|
+
super();
|
|
19
|
+
this.routeBindingMediator = this.registerDisposable(new RouteParameterBindings(this, router, activatedRoute));
|
|
20
|
+
// See https://coolon.atlassian.net/browse/PEC-59
|
|
21
|
+
(this.titleModel as unknown as DelegatingValueModel<string>).setDefault(this.placeConfig.title);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Memoize()
|
|
25
|
+
get placeConfig(): Place.Descriptor {
|
|
26
|
+
return Place.getDescriptor(this.constructor as any as Constructable<PlaceComponent>);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
canDeactivate(): boolean | Promise<boolean> {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
position: relative;
|
|
3
|
+
//display: grid;
|
|
4
|
+
//grid-template-columns: 1fr;
|
|
5
|
+
//grid-template-rows: 1fr;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.busy-overlay-content {
|
|
9
|
+
//display: grid;
|
|
10
|
+
//grid-template-columns: 1fr;
|
|
11
|
+
//grid-template-rows: 1fr;
|
|
12
|
+
//width: 100%;
|
|
13
|
+
//height: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
div.busy-overlay-backdrop {
|
|
17
|
+
position: absolute;
|
|
18
|
+
background-color: rgba(0,0,0,0.2);
|
|
19
|
+
top: 0;
|
|
20
|
+
left: 0;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
right: 0;
|
|
23
|
+
display: grid;
|
|
24
|
+
grid-template-columns: auto;
|
|
25
|
+
grid-template-rows: auto;
|
|
26
|
+
place-content: center;
|
|
27
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { BusyOverlayComponent } from './busy-overlay.component';
|
|
4
|
+
|
|
5
|
+
describe('BusyComponent', () => {
|
|
6
|
+
let component: BusyOverlayComponent;
|
|
7
|
+
let fixture: ComponentFixture<BusyOverlayComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ BusyOverlayComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(BusyOverlayComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { StoreInValueModel, UseDelegate, ValueModel } from '@coolon/pectin';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'angular-ui-powerups-busy-overlay',
|
|
6
|
+
templateUrl: `./busy-overlay.component.html`,
|
|
7
|
+
styleUrls: ['./busy-overlay.component.scss']
|
|
8
|
+
})
|
|
9
|
+
export class BusyOverlayComponent implements OnInit {
|
|
10
|
+
|
|
11
|
+
@Input() @UseDelegate()
|
|
12
|
+
busyModel: ValueModel<boolean>;
|
|
13
|
+
|
|
14
|
+
@Input() @StoreInValueModel('busyModel')
|
|
15
|
+
busy: boolean;
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ngOnInit() {
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
align-items: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.container {
|
|
9
|
+
//display: inline-block;
|
|
10
|
+
padding: var(--angular-ui-powerups-default-padding);
|
|
11
|
+
border: 2px dashed rgba(0,0,0,0.2);
|
|
12
|
+
border-radius: 5px;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
font-weight: 300;
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { EmptyStateComponent } from './empty-state.component';
|
|
4
|
+
|
|
5
|
+
describe('EmptyStateComponent', () => {
|
|
6
|
+
let component: EmptyStateComponent;
|
|
7
|
+
let fixture: ComponentFixture<EmptyStateComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ EmptyStateComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(EmptyStateComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'angular-ui-powerups-empty-state',
|
|
5
|
+
template: `
|
|
6
|
+
<div class="container">
|
|
7
|
+
<ng-content></ng-content>
|
|
8
|
+
</div>
|
|
9
|
+
`,
|
|
10
|
+
styleUrls: ['./empty-state.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class EmptyStateComponent implements OnInit {
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PlaceOutletComponent } from './place-outlet.component';
|
|
4
|
+
|
|
5
|
+
describe('PlaceOutletComponent', () => {
|
|
6
|
+
let component: PlaceOutletComponent;
|
|
7
|
+
let fixture: ComponentFixture<PlaceOutletComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ PlaceOutletComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(PlaceOutletComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { RouterOutlet } from '@angular/router';
|
|
3
|
+
import { PlaceComponent } from '../../place-component';
|
|
4
|
+
import { PlaceService } from '../../place.service';
|
|
5
|
+
import { LEFT_RIGHT_PLACE_ANIMATION } from './route-animations';
|
|
6
|
+
import {Trace} from "@coolon/pectin";
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'angular-ui-powerups-place-outlet',
|
|
10
|
+
templateUrl: './place-outlet.component.html',
|
|
11
|
+
styleUrls: ['./place-outlet.component.scss'],
|
|
12
|
+
animations: [LEFT_RIGHT_PLACE_ANIMATION]
|
|
13
|
+
})
|
|
14
|
+
export class PlaceOutletComponent implements OnInit {
|
|
15
|
+
|
|
16
|
+
@Input()
|
|
17
|
+
animate = true;
|
|
18
|
+
|
|
19
|
+
constructor(private readonly placeService: PlaceService) {
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
ngOnInit() {
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
onActivate($event: PlaceComponent) {
|
|
26
|
+
this.placeService.onActivate($event);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
onDeactivate($event: PlaceComponent) {
|
|
30
|
+
this.placeService.onDeactivate($event);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getPlaceOrder(outlet: RouterOutlet) {
|
|
34
|
+
return this.animate && outlet && outlet.activatedRouteData && outlet.activatedRouteData['placeOrder'];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { animate, animateChild, group, query, style, transition, trigger } from '@angular/animations';
|
|
2
|
+
|
|
3
|
+
const left = [
|
|
4
|
+
query(':enter, :leave', style({ position: 'fixed', width: '100%' }), { optional: true }),
|
|
5
|
+
group([
|
|
6
|
+
query(':enter', [style({ transform: 'translateX(-100%)' }), animate('.3s ease-out', style({ transform: 'translateX(0%)' }))], {
|
|
7
|
+
optional: true,
|
|
8
|
+
}),
|
|
9
|
+
query(':leave', [style({ transform: 'translateX(0%)' }), animate('.3s ease-out', style({ transform: 'translateX(100%)' }))], {
|
|
10
|
+
optional: true,
|
|
11
|
+
}),
|
|
12
|
+
]),
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
const right = [
|
|
16
|
+
query(':enter, :leave', style({ position: 'fixed', width: '100%' }), { optional: true }),
|
|
17
|
+
group([
|
|
18
|
+
query(':enter', [style({ transform: 'translateX(100%)' }), animate('.3s ease-out', style({ transform: 'translateX(0%)' }))], {
|
|
19
|
+
optional: true,
|
|
20
|
+
}),
|
|
21
|
+
query(':leave', [style({ transform: 'translateX(0%)' }), animate('.3s ease-out', style({ transform: 'translateX(-100%)' }))], {
|
|
22
|
+
optional: true,
|
|
23
|
+
}),
|
|
24
|
+
]),
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export const LEFT_RIGHT_PLACE_ANIMATION = trigger('routeAnimations', [
|
|
28
|
+
transition(':increment', right),
|
|
29
|
+
transition(':decrement', left),
|
|
30
|
+
]);
|
package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.html
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<nav mat-tab-nav-bar>
|
|
2
|
+
<a mat-tab-link *ngFor="let placeDescriptor of orderedPlaces.value" [routerLink]='placeDescriptor.path'
|
|
3
|
+
routerLinkActive #rla="routerLinkActive"
|
|
4
|
+
[active]="rla.isActive"
|
|
5
|
+
[matTooltip]="placeDescriptor.title">{{placeDescriptor.title}}</a>
|
|
6
|
+
</nav>
|
|
7
|
+
|
package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.scss
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//:host {
|
|
2
|
+
// display: flex;
|
|
3
|
+
// flex-direction: column;
|
|
4
|
+
// --expanded-width: 235px;
|
|
5
|
+
// --nav-item-width: var(--nav-bar-height);
|
|
6
|
+
//
|
|
7
|
+
// width: var(--nav-item-width);
|
|
8
|
+
// //max-width: var(--nav-item-width);
|
|
9
|
+
//
|
|
10
|
+
// transition: width 125ms linear;
|
|
11
|
+
//
|
|
12
|
+
// &.expanded {
|
|
13
|
+
// width: var(--expanded-width);
|
|
14
|
+
// max-width: var(--expanded-width);
|
|
15
|
+
// }
|
|
16
|
+
//
|
|
17
|
+
// background-color: #555;
|
|
18
|
+
// color: rgba(255, 255, 255, 0.9);
|
|
19
|
+
//}
|
|
20
|
+
//
|
|
21
|
+
//.expanded-only {
|
|
22
|
+
// max-width: 0;
|
|
23
|
+
// overflow: hidden;
|
|
24
|
+
//}
|
|
25
|
+
//
|
|
26
|
+
//.collapsed-only {
|
|
27
|
+
// max-width: 100%;
|
|
28
|
+
// overflow: hidden;
|
|
29
|
+
//}
|
|
30
|
+
//
|
|
31
|
+
//.header {
|
|
32
|
+
// display: flex;
|
|
33
|
+
// flex-direction: row;
|
|
34
|
+
// justify-content: flex-end;
|
|
35
|
+
// align-items: center;
|
|
36
|
+
// height: var(--nav-bar-height);
|
|
37
|
+
// border-bottom: 1px solid rgba(0, 0, 0, 0.2);
|
|
38
|
+
//
|
|
39
|
+
// .menu {
|
|
40
|
+
// //padding-left: var(--default-padding);
|
|
41
|
+
// flex: 1;
|
|
42
|
+
// }
|
|
43
|
+
//
|
|
44
|
+
// button {
|
|
45
|
+
// color: inherit;
|
|
46
|
+
// width: var(--nav-item-width);
|
|
47
|
+
// height: var(--nav-bar-height);
|
|
48
|
+
// }
|
|
49
|
+
//
|
|
50
|
+
//}
|
|
51
|
+
//
|
|
52
|
+
//mat-nav-list {
|
|
53
|
+
// flex: 1;
|
|
54
|
+
// display: flex;
|
|
55
|
+
// flex-direction: column;
|
|
56
|
+
//}
|
|
57
|
+
//
|
|
58
|
+
//.mat-list-item {
|
|
59
|
+
// width: var(--nav-item-width);
|
|
60
|
+
// height: var(--nav-bar-height);
|
|
61
|
+
// color: inherit;
|
|
62
|
+
//
|
|
63
|
+
// &.active {
|
|
64
|
+
// background-color: #444;
|
|
65
|
+
// }
|
|
66
|
+
//}
|
|
67
|
+
//
|
|
68
|
+
//mat-icon {
|
|
69
|
+
// color: inherit;
|
|
70
|
+
// &.flip-horizontal {
|
|
71
|
+
// transform: scaleX(-1);
|
|
72
|
+
// }
|
|
73
|
+
//}
|
|
74
|
+
//
|
|
75
|
+
//:host-context(.expanded) {
|
|
76
|
+
//
|
|
77
|
+
// .expanded-only {
|
|
78
|
+
// max-width: 100%;
|
|
79
|
+
// }
|
|
80
|
+
// .collapsed-only {
|
|
81
|
+
// max-width: 0;
|
|
82
|
+
// }
|
|
83
|
+
//
|
|
84
|
+
// .mat-list-item {
|
|
85
|
+
// mat-icon {
|
|
86
|
+
// margin-right: 12px;
|
|
87
|
+
// }
|
|
88
|
+
//
|
|
89
|
+
// span {
|
|
90
|
+
// text-wrap: none;
|
|
91
|
+
// white-space: nowrap;
|
|
92
|
+
// }
|
|
93
|
+
// }
|
|
94
|
+
//}
|
|
95
|
+
//
|
|
96
|
+
//.app-menu {
|
|
97
|
+
// padding-top: 0;
|
|
98
|
+
//}
|
|
99
|
+
//
|
|
100
|
+
//
|
package/src/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.spec.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { TabbedPlaceNavigationComponent } from './tabbed-place-navigation.component';
|
|
4
|
+
|
|
5
|
+
describe('NavComponent', () => {
|
|
6
|
+
let component: TabbedPlaceNavigationComponent;
|
|
7
|
+
let fixture: ComponentFixture<TabbedPlaceNavigationComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async(() => {
|
|
10
|
+
TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ TabbedPlaceNavigationComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
fixture = TestBed.createComponent(TabbedPlaceNavigationComponent);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { Dsl, ListModel, ListModelChain, StoreInListModel, UseDelegate } from '@coolon/pectin';
|
|
3
|
+
import { DisposableComponent } from '../../../components/disposable-component';
|
|
4
|
+
import { Place } from '../../place.decorator';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'angular-ui-powerups-tabbed-place-navigation',
|
|
8
|
+
templateUrl: './tabbed-place-navigation.component.html',
|
|
9
|
+
styleUrls: ['./tabbed-place-navigation.component.scss']
|
|
10
|
+
})
|
|
11
|
+
export class TabbedPlaceNavigationComponent extends DisposableComponent implements OnInit {
|
|
12
|
+
|
|
13
|
+
@Input() @StoreInListModel('placesModel')
|
|
14
|
+
places: Place.Descriptor[];
|
|
15
|
+
|
|
16
|
+
@Input() @UseDelegate()
|
|
17
|
+
placesModel: ListModel<Place.Descriptor>;
|
|
18
|
+
|
|
19
|
+
readonly orderedPlaces: ListModelChain<Place.Descriptor>;
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
|
|
24
|
+
this.orderedPlaces = chain(this.placesModel).sortBy('order');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
ngOnInit() {
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TestBed, async, inject } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { LeavePlaceGuard } from './leave-place.guard';
|
|
4
|
+
|
|
5
|
+
describe('LeavePlaceGuard', () => {
|
|
6
|
+
beforeEach(() => {
|
|
7
|
+
TestBed.configureTestingModule({
|
|
8
|
+
providers: [LeavePlaceGuard]
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should ...', inject([LeavePlaceGuard], (guard: LeavePlaceGuard) => {
|
|
13
|
+
expect(guard).toBeTruthy();
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Injectable, Injector } from '@angular/core';
|
|
2
|
+
import { ActivatedRouteSnapshot, CanDeactivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import { PlaceComponent } from '../place-component';
|
|
5
|
+
|
|
6
|
+
@Injectable({
|
|
7
|
+
providedIn: 'root'
|
|
8
|
+
})
|
|
9
|
+
export class LeavePlaceGuard implements CanDeactivate<PlaceComponent> {
|
|
10
|
+
|
|
11
|
+
constructor(private router: Router, private injector: Injector) {
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
|
15
|
+
return component.canDeactivate();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|