@coolon/angular-ui-powerups 2.0.0-alpha.12 → 2.0.0-alpha.14
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 +9 -0
- package/bundles/coolon-angular-ui-powerups.umd.js +84 -93
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js +1 -1
- package/bundles/coolon-angular-ui-powerups.umd.min.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/forms/abstract-list-input.component.js +11 -10
- package/esm2015/lib/components/forms/abstract-list-input.component.js.map +1 -1
- package/esm2015/lib/components/forms/abstract-list-input.component.metadata.json +1 -1
- package/esm2015/lib/components/forms/abstract-value-input.component.js +2 -1
- package/esm2015/lib/components/forms/abstract-value-input.component.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js +2 -7
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm2015/lib/interaction/components/activity-container/activity-container.component.metadata.json +1 -1
- package/esm2015/lib/place/place-component.js +1 -1
- package/esm2015/lib/place/place-component.js.map +1 -1
- package/esm2015/lib/place/place-router.js +2 -8
- package/esm2015/lib/place/place-router.js.map +1 -1
- package/esm2015/lib/place/place-router.metadata.json +1 -1
- package/esm2015/lib/place/route/parameter-decorators.js +2 -3
- package/esm2015/lib/place/route/parameter-decorators.js.map +1 -1
- package/esm2015/lib/place/route/parameter-decorators.metadata.json +1 -1
- package/esm5/lib/components/forms/abstract-list-input.component.js +11 -10
- package/esm5/lib/components/forms/abstract-list-input.component.js.map +1 -1
- package/esm5/lib/components/forms/abstract-value-input.component.js +2 -1
- package/esm5/lib/components/forms/abstract-value-input.component.js.map +1 -1
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js +2 -7
- package/esm5/lib/interaction/components/activity-container/activity-container.component.js.map +1 -1
- package/esm5/lib/place/place-component.js +1 -1
- package/esm5/lib/place/place-component.js.map +1 -1
- package/esm5/lib/place/place-router.js +2 -8
- package/esm5/lib/place/place-router.js.map +1 -1
- package/esm5/lib/place/route/parameter-decorators.js +2 -3
- package/esm5/lib/place/route/parameter-decorators.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +80 -89
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/fesm5/coolon-angular-ui-powerups.js +85 -94
- package/fesm5/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/forms/abstract-list-input.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import { MatTableModule } from '@angular/material/table';
|
|
|
17
17
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
18
18
|
import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
19
19
|
import { fas } from '@fortawesome/free-solid-svg-icons';
|
|
20
|
-
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, FocusManager, Form, Guard, MutableListModel, MutableValueModel, ListModel, StoreInListModel, ValueModel, StoreInValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred,
|
|
20
|
+
import { GarbageCollector, DelegatingValueModel, assert, UnaryCommand, lang, Dsl, Logger, TrackExternal, Command, FocusManager, Form, Guard, DebugContext, MutableListModel, MutableValueModel, ListModel, StoreInListModel, ValueModel, StoreInValueModel, MultipleSelectionModel, DirtyTrackingForm, DelegatingCommand, Deferred, Binding, Functions } from '@coolon/pectin';
|
|
21
21
|
import ___default, { isEqual, isNil } from 'lodash';
|
|
22
22
|
import { assert as assert$1, Opts, lang as lang$1, Klass } from '@coolon/typescript-utilities';
|
|
23
23
|
import { Memoize } from '@typescript-plus/fast-memoize-decorator/dist/src';
|
|
@@ -636,24 +636,25 @@ let AbstractListInputComponent = class AbstractListInputComponent extends Abstra
|
|
|
636
636
|
*/
|
|
637
637
|
// We have to register it as a disposable so it ditches any listeners when we're disposed.
|
|
638
638
|
this.inputModel = this.registerDisposable(new Form.DelegatingListModel());
|
|
639
|
-
this.
|
|
639
|
+
this.setValueIsInProgress = new Guard();
|
|
640
640
|
this.valueChange = new EventEmitter();
|
|
641
641
|
const { when } = Dsl.disposeWith(this);
|
|
642
642
|
when(this.inputModel).changes(value => this.valueChange.emit(value), {
|
|
643
643
|
initialValue: 'ignore',
|
|
644
|
-
unless: this.
|
|
644
|
+
unless: this.setValueIsInProgress
|
|
645
645
|
});
|
|
646
|
+
DebugContext.tag(this.inputModel, `${this.constructor.name}.inputModel`);
|
|
646
647
|
}
|
|
647
648
|
set value(value) {
|
|
648
|
-
|
|
649
|
-
this.
|
|
649
|
+
this.setValueIsInProgress.whileTrue(() => {
|
|
650
|
+
if (!this.listHolder) {
|
|
650
651
|
this.listHolder = new MutableListModel(value);
|
|
651
652
|
this.listModel = this.listHolder;
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
}
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
this.listHolder.value = value;
|
|
656
|
+
}
|
|
657
|
+
});
|
|
657
658
|
}
|
|
658
659
|
};
|
|
659
660
|
__decorate([
|
|
@@ -696,6 +697,7 @@ let AbstractValueInputComponent = class AbstractValueInputComponent extends Abst
|
|
|
696
697
|
initialValue: 'ignore',
|
|
697
698
|
unless: this.setValueInProgress
|
|
698
699
|
});
|
|
700
|
+
DebugContext.tag(this.inputModel, `${this.constructor.name}.inputModel`);
|
|
699
701
|
}
|
|
700
702
|
set value(value) {
|
|
701
703
|
// we never fire events during an external set value operation. This allows
|
|
@@ -2747,6 +2749,7 @@ let ActivityContainerComponent = class ActivityContainerComponent extends Abstra
|
|
|
2747
2749
|
registerDisposable(disposable) {
|
|
2748
2750
|
return this.garbage.registerDisposable(disposable);
|
|
2749
2751
|
}
|
|
2752
|
+
// @Trace()
|
|
2750
2753
|
dispose() {
|
|
2751
2754
|
// TODO: think about auto cancelling any outstanding activity on dispose.
|
|
2752
2755
|
// See NavigationState.Navigating for a use-case.
|
|
@@ -2886,12 +2889,6 @@ __decorate([
|
|
|
2886
2889
|
ViewChildren(ActivityOutletComponent),
|
|
2887
2890
|
__metadata("design:type", QueryList)
|
|
2888
2891
|
], ActivityContainerComponent.prototype, "activityOutlets", void 0);
|
|
2889
|
-
__decorate([
|
|
2890
|
-
Trace(),
|
|
2891
|
-
__metadata("design:type", Function),
|
|
2892
|
-
__metadata("design:paramtypes", []),
|
|
2893
|
-
__metadata("design:returntype", void 0)
|
|
2894
|
-
], ActivityContainerComponent.prototype, "dispose", null);
|
|
2895
2892
|
ActivityContainerComponent = __decorate([
|
|
2896
2893
|
Component({
|
|
2897
2894
|
selector: 'aup-activity-container',
|
|
@@ -3878,7 +3875,7 @@ let PlaceComponent = PlaceComponent_1 = class PlaceComponent extends DisposableC
|
|
|
3878
3875
|
assert.isNil(this.visitModel.value);
|
|
3879
3876
|
const { when } = Dsl.disposeWith(this);
|
|
3880
3877
|
this.visitModel.value = visit;
|
|
3881
|
-
DebugContext.
|
|
3878
|
+
DebugContext.getOrCreate(this.visitModel).tag(`${this.placeDefinition.component.name}.visitModel`);
|
|
3882
3879
|
this.placeDefinition.getVisitParameterDefs().forEach(parameterDef => this.installBinding(parameterDef));
|
|
3883
3880
|
when.valueOf(this.visitModel).changes((current, previous) => {
|
|
3884
3881
|
notifyVisitChanged(current, previous);
|
|
@@ -4918,70 +4915,6 @@ UrlService = __decorate([
|
|
|
4918
4915
|
__metadata("design:paramtypes", [Router, Location, UrlSerializer])
|
|
4919
4916
|
], UrlService);
|
|
4920
4917
|
|
|
4921
|
-
class Visit {
|
|
4922
|
-
constructor(placeDefinition, visitParameters = {}) {
|
|
4923
|
-
this.placeDefinition = placeDefinition;
|
|
4924
|
-
this.visitParameters = visitParameters;
|
|
4925
|
-
}
|
|
4926
|
-
// @Trace()
|
|
4927
|
-
getRouteId() {
|
|
4928
|
-
return this.placeDefinition.getRouteIdFrom(this);
|
|
4929
|
-
}
|
|
4930
|
-
// @Trace()
|
|
4931
|
-
hasRouteId() {
|
|
4932
|
-
return !isNil(this.getRouteId());
|
|
4933
|
-
}
|
|
4934
|
-
/**
|
|
4935
|
-
* Returns the value of the place parameter with the specified name. The parameter
|
|
4936
|
-
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
4937
|
-
* same as the the ValueModel property name.
|
|
4938
|
-
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
4939
|
-
*/
|
|
4940
|
-
getParameter(parameterName) {
|
|
4941
|
-
return this.visitParameters[parameterName];
|
|
4942
|
-
}
|
|
4943
|
-
// @Trace()
|
|
4944
|
-
hasParameter(parameterName) {
|
|
4945
|
-
return Object.keys(this.visitParameters).includes(parameterName);
|
|
4946
|
-
}
|
|
4947
|
-
replace(parameter, value) {
|
|
4948
|
-
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
4949
|
-
}
|
|
4950
|
-
mergeRouteParameters(routeParams) {
|
|
4951
|
-
// todo: whitelist parameters.
|
|
4952
|
-
const routeParameterKeys = Object.keys(routeParams);
|
|
4953
|
-
const params = {};
|
|
4954
|
-
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
4955
|
-
if (def.isRouteId || def.isRouteParameter) {
|
|
4956
|
-
if (routeParameterKeys.includes(def.name)) {
|
|
4957
|
-
params[def.name] = routeParams[def.name];
|
|
4958
|
-
}
|
|
4959
|
-
}
|
|
4960
|
-
else {
|
|
4961
|
-
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
4962
|
-
// defaults and remember sanitisation process.
|
|
4963
|
-
const value = this.getParameter(def.name);
|
|
4964
|
-
if (this.hasParameter(def.name)) {
|
|
4965
|
-
params[def.name] = value;
|
|
4966
|
-
}
|
|
4967
|
-
}
|
|
4968
|
-
});
|
|
4969
|
-
return new Visit(this.placeDefinition, params);
|
|
4970
|
-
}
|
|
4971
|
-
hasRoutingChangedFrom(other) {
|
|
4972
|
-
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
4973
|
-
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
4974
|
-
return !samePlace || !sameRouteParameters;
|
|
4975
|
-
}
|
|
4976
|
-
hasChangedFrom(other) {
|
|
4977
|
-
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
4978
|
-
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
4979
|
-
}
|
|
4980
|
-
toDebugString() {
|
|
4981
|
-
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
|
|
4985
4918
|
let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
4986
4919
|
constructor(angularRouter, angularLocation, interactionService, urlService, placeHistory) {
|
|
4987
4920
|
super();
|
|
@@ -5143,6 +5076,7 @@ let PlaceRouter = class PlaceRouter extends GarbageCollector {
|
|
|
5143
5076
|
get activeVisits() {
|
|
5144
5077
|
return this._activeVisits.readonly;
|
|
5145
5078
|
}
|
|
5079
|
+
// @Trace()
|
|
5146
5080
|
pushVisitChangesToRoute(previous, next) {
|
|
5147
5081
|
return __awaiter(this, void 0, void 0, function* () {
|
|
5148
5082
|
this.placeHistory.updateVisit(next);
|
|
@@ -5239,12 +5173,6 @@ PlaceRouter.ctorParameters = () => [
|
|
|
5239
5173
|
{ type: PlaceHistory }
|
|
5240
5174
|
];
|
|
5241
5175
|
PlaceRouter.ɵprov = ɵɵdefineInjectable({ factory: function PlaceRouter_Factory() { return new PlaceRouter(ɵɵinject(Router), ɵɵinject(Location), ɵɵinject(InteractionService), ɵɵinject(UrlService), ɵɵinject(PlaceHistory)); }, token: PlaceRouter, providedIn: "root" });
|
|
5242
|
-
__decorate([
|
|
5243
|
-
Trace(),
|
|
5244
|
-
__metadata("design:type", Function),
|
|
5245
|
-
__metadata("design:paramtypes", [Visit, Visit]),
|
|
5246
|
-
__metadata("design:returntype", Promise)
|
|
5247
|
-
], PlaceRouter.prototype, "pushVisitChangesToRoute", null);
|
|
5248
5176
|
PlaceRouter = __decorate([
|
|
5249
5177
|
Injectable({
|
|
5250
5178
|
providedIn: 'root'
|
|
@@ -5256,6 +5184,70 @@ PlaceRouter = __decorate([
|
|
|
5256
5184
|
PlaceHistory])
|
|
5257
5185
|
], PlaceRouter);
|
|
5258
5186
|
|
|
5187
|
+
class Visit {
|
|
5188
|
+
constructor(placeDefinition, visitParameters = {}) {
|
|
5189
|
+
this.placeDefinition = placeDefinition;
|
|
5190
|
+
this.visitParameters = visitParameters;
|
|
5191
|
+
}
|
|
5192
|
+
// @Trace()
|
|
5193
|
+
getRouteId() {
|
|
5194
|
+
return this.placeDefinition.getRouteIdFrom(this);
|
|
5195
|
+
}
|
|
5196
|
+
// @Trace()
|
|
5197
|
+
hasRouteId() {
|
|
5198
|
+
return !isNil(this.getRouteId());
|
|
5199
|
+
}
|
|
5200
|
+
/**
|
|
5201
|
+
* Returns the value of the place parameter with the specified name. The parameter
|
|
5202
|
+
* name is taken from the `as` option, e.g. {as: 'aCustomName'} otherwise it is the
|
|
5203
|
+
* same as the the ValueModel property name.
|
|
5204
|
+
* @param parameterName the field name of the property model or the `as` option if specified.
|
|
5205
|
+
*/
|
|
5206
|
+
getParameter(parameterName) {
|
|
5207
|
+
return this.visitParameters[parameterName];
|
|
5208
|
+
}
|
|
5209
|
+
// @Trace()
|
|
5210
|
+
hasParameter(parameterName) {
|
|
5211
|
+
return Object.keys(this.visitParameters).includes(parameterName);
|
|
5212
|
+
}
|
|
5213
|
+
replace(parameter, value) {
|
|
5214
|
+
return new Visit(this.placeDefinition, Object.assign(Object.assign({}, this.visitParameters), { [parameter.name]: value }));
|
|
5215
|
+
}
|
|
5216
|
+
mergeRouteParameters(routeParams) {
|
|
5217
|
+
// todo: whitelist parameters.
|
|
5218
|
+
const routeParameterKeys = Object.keys(routeParams);
|
|
5219
|
+
const params = {};
|
|
5220
|
+
this.placeDefinition.getVisitParameterDefs().forEach(def => {
|
|
5221
|
+
if (def.isRouteId || def.isRouteParameter) {
|
|
5222
|
+
if (routeParameterKeys.includes(def.name)) {
|
|
5223
|
+
params[def.name] = routeParams[def.name];
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
else {
|
|
5227
|
+
// copy non route params as is, but only if they already exist otherwise we'll inject nil values and break the
|
|
5228
|
+
// defaults and remember sanitisation process.
|
|
5229
|
+
const value = this.getParameter(def.name);
|
|
5230
|
+
if (this.hasParameter(def.name)) {
|
|
5231
|
+
params[def.name] = value;
|
|
5232
|
+
}
|
|
5233
|
+
}
|
|
5234
|
+
});
|
|
5235
|
+
return new Visit(this.placeDefinition, params);
|
|
5236
|
+
}
|
|
5237
|
+
hasRoutingChangedFrom(other) {
|
|
5238
|
+
const samePlace = other.placeDefinition === this.placeDefinition;
|
|
5239
|
+
const sameRouteParameters = isEqual(this.placeDefinition.getFormattedRouteParameters(this, true), this.placeDefinition.getFormattedRouteParameters(other, true));
|
|
5240
|
+
return !samePlace || !sameRouteParameters;
|
|
5241
|
+
}
|
|
5242
|
+
hasChangedFrom(other) {
|
|
5243
|
+
const sameNonRouteParameters = isEqual(this.placeDefinition.getNonRouteParameters(this), this.placeDefinition.getNonRouteParameters(other));
|
|
5244
|
+
return !sameNonRouteParameters || this.hasRoutingChangedFrom(other);
|
|
5245
|
+
}
|
|
5246
|
+
toDebugString() {
|
|
5247
|
+
return Object.keys(this.visitParameters).map(k => `${k}=${this.visitParameters[k]}`).join(",");
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
|
|
5259
5251
|
const AUP_PLACE_CONFIG = new InjectionToken('AUP_PLACE_CONFIG');
|
|
5260
5252
|
|
|
5261
5253
|
// Freezes the state of the components at the start of the animation.
|
|
@@ -6141,8 +6133,7 @@ function installMechanics(prototype, propertyKey, backingModel, tagPrefix, isEmp
|
|
|
6141
6133
|
binding: null
|
|
6142
6134
|
};
|
|
6143
6135
|
const tag = `${tagPrefix}(${prototype.constructor.name}.${propertyKey.toString()})`;
|
|
6144
|
-
DebugContext.
|
|
6145
|
-
Logger.get(mechanics.backingModel).tag(tag);
|
|
6136
|
+
DebugContext.getOrCreate(mechanics.backingModel).tag(tag);
|
|
6146
6137
|
Object.defineProperty(prototype, propertyKey, {
|
|
6147
6138
|
get: function () {
|
|
6148
6139
|
return mechanics.backingModel;
|