@coolon/angular-ui-powerups 14.41.1 → 14.43.0

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.
@@ -2204,6 +2204,9 @@ class SelectInputComponent extends AbstractValueInputComponent {
2204
2204
  const self = this;
2205
2205
  const binding = this.registerDisposable(new Binding(this.componentValue$, this.id$, {
2206
2206
  toLeft(selectedId, currentValue) {
2207
+ if (isNil(selectedId)) {
2208
+ return undefined;
2209
+ }
2207
2210
  const newValue = lookup.get(selectedId); // the list is empty or we're missing form it so don't touch the real value.
2208
2211
  return isNil(newValue) ? currentValue : newValue;
2209
2212
  },
@@ -6592,9 +6595,20 @@ class PlaceComponent extends DisposableComponent {
6592
6595
  this._inVisitUpdate = new Guard();
6593
6596
  this._active = new MutableValueModel(false);
6594
6597
  this._parameterChangeInterceptors = [];
6598
+ this.placeRouter = inject(PlaceRouter);
6595
6599
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
6596
6600
  when(this._active).becomesTruthy(() => this._notifyPlaceReady());
6597
- this.childPlaces = this.placeDefinition.children.map(d => d.component);
6601
+ this.childPlaces$ = ListModel.constant(this.placeDefinition.children.map(d => d.component));
6602
+ this.authorisedChildPlaces$ = chain(this.childPlaces$)
6603
+ .select(placeType => {
6604
+ var _a;
6605
+ const definition = PlaceComponent.getDefinition(placeType);
6606
+ const guard = this.placeRouter.accessGuard$.value;
6607
+ return guard.isAuthorised(definition) || ((_a = this.placeRouter.activeVisit$.value) === null || _a === void 0 ? void 0 : _a.isPlaceActive(definition));
6608
+ }, {
6609
+ postponeWhile: this.placeRouter.navigationInProgress$,
6610
+ dependsOn: [this.placeRouter.accessGuard$, this.placeRouter.activeVisit$]
6611
+ });
6598
6612
  }
6599
6613
  initialiseVisit(visit, notifyVisitChanged) {
6600
6614
  assert.isNil(this.visitModel.value);
@@ -6618,6 +6632,12 @@ class PlaceComponent extends DisposableComponent {
6618
6632
  // notifyVisitChanged(this.visitModel.value, visit)
6619
6633
  // }
6620
6634
  }
6635
+ /**
6636
+ * @deprecated use authorisedChildPlaces$ instead
6637
+ */
6638
+ get childPlaces() {
6639
+ return this.authorisedChildPlaces$.value;
6640
+ }
6621
6641
  updateVisit(visit) {
6622
6642
  assert.isTruthy(this.isInitialised());
6623
6643
  assert.notNil(visit);
@@ -9425,8 +9445,8 @@ class InputActivity extends Activity {
9425
9445
  super();
9426
9446
  this.class = 'aup-input-activity';
9427
9447
  const form = new DirtyTrackingForm();
9428
- this.valueModel = form.valueModel(this.activityData.initialValue);
9429
- this.valueModel.validateUsing(this.activityData.validators || []);
9448
+ this.value$ = form.valueModel(this.activityData.initialValue);
9449
+ this.value$.validateUsing(this.activityData.validators || []);
9430
9450
  // TODO: move to global configuration
9431
9451
  this.confirmFace = (_a = this.activityData.confirmFace) !== null && _a !== void 0 ? _a : {
9432
9452
  icon: () => 'mat:check'
@@ -9435,19 +9455,19 @@ class InputActivity extends Activity {
9435
9455
  icon: () => 'mat:clear'
9436
9456
  };
9437
9457
  this.confirmCommand = Command.create(() => __awaiter(this, void 0, void 0, function* () {
9438
- if (this.valueModel.validate()) {
9458
+ if (this.value$.validate()) {
9439
9459
  if (this.activityData.save) {
9440
9460
  const self = this;
9441
9461
  try {
9442
9462
  let allGood = true;
9443
- const result = yield this.activityData.save(this.valueModel.value, {
9463
+ const result = yield this.activityData.save(this.value$.value, {
9444
9464
  injectError(error) {
9445
9465
  allGood = false;
9446
- self.valueModel.injectErrors([error]);
9466
+ self.value$.injectErrors([error]);
9447
9467
  }
9448
9468
  });
9449
9469
  if (allGood) {
9450
- this.done(this.valueModel.value);
9470
+ this.done(this.value$.value);
9451
9471
  }
9452
9472
  }
9453
9473
  catch (e) {
@@ -9455,7 +9475,7 @@ class InputActivity extends Activity {
9455
9475
  }
9456
9476
  }
9457
9477
  else {
9458
- this.done(this.valueModel.value);
9478
+ this.done(this.value$.value);
9459
9479
  }
9460
9480
  }
9461
9481
  }));
@@ -9463,7 +9483,7 @@ class InputActivity extends Activity {
9463
9483
  this.cancel();
9464
9484
  });
9465
9485
  this.busyWhile(this.confirmCommand.busy$);
9466
- this.onActivityReady(() => this.valueModel.focusContext.requestFocus());
9486
+ this.onActivityReady(() => this.value$.focusContext.requestFocus());
9467
9487
  }
9468
9488
  get layout() {
9469
9489
  var _a, _b;
@@ -9514,30 +9534,30 @@ class StringInputActivity extends InputActivity {
9514
9534
  }
9515
9535
  StringInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9516
9536
  StringInputActivity.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: StringInputActivity, selector: "aup-string-input-activity", usesInheritance: true, ngImport: i0, template: `
9517
- <aup-string-input [value$]="valueModel"
9518
- [label]="activityData.label"
9519
- [placeholder]="activityData.placeholder"
9520
- [command.enter]="confirmCommand"
9521
- [command.escape]="cancelCommand"></aup-string-input>
9522
- <aup-activity-actions [layout]="layout" align="end"
9523
- [confirmFace]="confirmFace"
9524
- [cancelFace]="cancelFace"
9525
- ></aup-activity-actions>
9537
+ <aup-string-input [value$]="value$"
9538
+ [label]="activityData.label"
9539
+ [placeholder]="activityData.placeholder"
9540
+ [command.enter]="confirmCommand"
9541
+ [command.escape]="cancelCommand"></aup-string-input>
9542
+ <aup-activity-actions [layout]="layout" align="end"
9543
+ [confirmFace]="confirmFace"
9544
+ [cancelFace]="cancelFace"
9545
+ ></aup-activity-actions>
9526
9546
  `, isInline: true, dependencies: [{ kind: "component", type: StringInputComponent, selector: "aup-string-input", inputs: ["autocomplete", "enableClear$", "enableClear", "iconPrefix"] }, { kind: "component", type: ActivityActionsComponent, selector: "aup-activity-actions", inputs: ["confirmCommand", "cancelCommand", "faces", "confirmFace", "cancelFace", "style", "layout", "align"] }] });
9527
9547
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, decorators: [{
9528
9548
  type: Component,
9529
9549
  args: [{
9530
9550
  selector: 'aup-string-input-activity',
9531
9551
  template: `
9532
- <aup-string-input [value$]="valueModel"
9533
- [label]="activityData.label"
9534
- [placeholder]="activityData.placeholder"
9535
- [command.enter]="confirmCommand"
9536
- [command.escape]="cancelCommand"></aup-string-input>
9537
- <aup-activity-actions [layout]="layout" align="end"
9538
- [confirmFace]="confirmFace"
9539
- [cancelFace]="cancelFace"
9540
- ></aup-activity-actions>
9552
+ <aup-string-input [value$]="value$"
9553
+ [label]="activityData.label"
9554
+ [placeholder]="activityData.placeholder"
9555
+ [command.enter]="confirmCommand"
9556
+ [command.escape]="cancelCommand"></aup-string-input>
9557
+ <aup-activity-actions [layout]="layout" align="end"
9558
+ [confirmFace]="confirmFace"
9559
+ [cancelFace]="cancelFace"
9560
+ ></aup-activity-actions>
9541
9561
  `
9542
9562
  }]
9543
9563
  }] });
@@ -9546,7 +9566,11 @@ class SelectInputActivity extends InputActivity {
9546
9566
  constructor() {
9547
9567
  super(...arguments);
9548
9568
  this.defaultOptionLabelFormat = (option) => {
9549
- return this.activityData.optionLabel ? option[this.activityData.optionLabel] : option;
9569
+ return option ?
9570
+ this.activityData.optionLabel ?
9571
+ option[this.activityData.optionLabel]
9572
+ : option
9573
+ : "";
9550
9574
  };
9551
9575
  }
9552
9576
  get optionLabelFormat() {
@@ -9560,14 +9584,17 @@ class SelectInputActivity extends InputActivity {
9560
9584
  }
9561
9585
  SelectInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SelectInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9562
9586
  SelectInputActivity.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: SelectInputActivity, selector: "aup-select-input-activity", usesInheritance: true, ngImport: i0, template: `
9563
- <aup-select-input [value$]="valueModel"
9587
+ <aup-select-input [value$]="value$"
9564
9588
  [label]="activityData.label"
9565
9589
  [placeholder]="activityData.placeholder"
9566
9590
  [command.enter]="confirmCommand"
9567
9591
  [command.escape]="cancelCommand"
9568
9592
  [options]="options"
9569
9593
  [optionLabelFormat]="optionLabelFormat"
9570
- ></aup-select-input>
9594
+ [allowNil]="activityData.allowNil"
9595
+ >
9596
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9597
+ </aup-select-input>
9571
9598
  <aup-activity-actions [layout]="layout" align="end"
9572
9599
  [confirmFace]="confirmFace"
9573
9600
  [cancelFace]="cancelFace"
@@ -9578,14 +9605,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
9578
9605
  args: [{
9579
9606
  selector: 'aup-select-input-activity',
9580
9607
  template: `
9581
- <aup-select-input [value$]="valueModel"
9608
+ <aup-select-input [value$]="value$"
9582
9609
  [label]="activityData.label"
9583
9610
  [placeholder]="activityData.placeholder"
9584
9611
  [command.enter]="confirmCommand"
9585
9612
  [command.escape]="cancelCommand"
9586
9613
  [options]="options"
9587
9614
  [optionLabelFormat]="optionLabelFormat"
9588
- ></aup-select-input>
9615
+ [allowNil]="activityData.allowNil"
9616
+ >
9617
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9618
+ </aup-select-input>
9589
9619
  <aup-activity-actions [layout]="layout" align="end"
9590
9620
  [confirmFace]="confirmFace"
9591
9621
  [cancelFace]="cancelFace"
@@ -10292,20 +10322,11 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
10292
10322
  this.placeFaces = new Map();
10293
10323
  this.trackByPlaceDef = (index, data) => data.place;
10294
10324
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
10295
- this.placeDefinitions = chain(this.placesModel)
10296
- .map(c => PlaceComponent.getDefinition(c))
10297
- .select(d => {
10298
- var _a;
10299
- const guard = placeRouter.accessGuard$.value;
10300
- return guard.isAuthorised(d) || ((_a = placeRouter.activeVisit$.value) === null || _a === void 0 ? void 0 : _a.isPlaceActive(d));
10301
- }, {
10302
- postponeWhile: placeRouter.navigationInProgress$,
10303
- dependsOn: [placeRouter.accessGuard$, placeRouter.activeVisit$]
10304
- });
10325
+ this.placeDefinitions = chain(this.places$).map(c => PlaceComponent.getDefinition(c));
10305
10326
  this.commandFactory = Command.createFactory((placeDefinition) => {
10306
10327
  this.placeRouter.navigate(placeDefinition.component);
10307
10328
  });
10308
- when(this.placeOutletModel).changes(outlet => this.handlePlaceOutLetChanged(outlet), { initialValue: "triggerChange" });
10329
+ when(this.placeOutlet$).changes(outlet => this.handlePlaceOutLetChanged(outlet), { initialValue: "triggerChange" });
10309
10330
  this.activePlaceDefinition = chain(this._activePlaceComponent).pluck('placeDefinition');
10310
10331
  this.menuItems = chain(this.placeDefinitions).map(d => {
10311
10332
  return {
@@ -10344,23 +10365,23 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
10344
10365
  }
10345
10366
  }
10346
10367
  AbstractPlaceNavigationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractPlaceNavigationComponent, deps: [{ token: PlaceRouter }], target: i0.ɵɵFactoryTarget.Component });
10347
- AbstractPlaceNavigationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: AbstractPlaceNavigationComponent, selector: "ng-component", inputs: { places: "places", placesModel: "placesModel", placeOutlet: "placeOutlet", placeOutletModel: "placeOutletModel" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
10368
+ AbstractPlaceNavigationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: AbstractPlaceNavigationComponent, selector: "ng-component", inputs: { places: "places", places$: "places$", placeOutlet: "placeOutlet", placeOutlet$: "placeOutlet$" }, usesInheritance: true, ngImport: i0, template: '', isInline: true });
10348
10369
  __decorate([
10349
- StoreInListModel('placesModel'),
10370
+ StoreInListModel('places$'),
10350
10371
  __metadata("design:type", Array)
10351
10372
  ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
10352
10373
  __decorate([
10353
10374
  TrackExternal(),
10354
10375
  __metadata("design:type", ListModel)
10355
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
10376
+ ], AbstractPlaceNavigationComponent.prototype, "places$", void 0);
10356
10377
  __decorate([
10357
- StoreInValueModel('placeOutletModel'),
10378
+ StoreInValueModel('placeOutlet$'),
10358
10379
  __metadata("design:type", PlaceOutletComponent)
10359
10380
  ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
10360
10381
  __decorate([
10361
10382
  TrackExternal(),
10362
10383
  __metadata("design:type", ValueModel)
10363
- ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
10384
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutlet$", void 0);
10364
10385
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractPlaceNavigationComponent, decorators: [{
10365
10386
  type: Component,
10366
10387
  args: [{
@@ -10368,11 +10389,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
10368
10389
  }]
10369
10390
  }], ctorParameters: function () { return [{ type: PlaceRouter }]; }, propDecorators: { places: [{
10370
10391
  type: Input
10371
- }], placesModel: [{
10392
+ }], places$: [{
10372
10393
  type: Input
10373
10394
  }], placeOutlet: [{
10374
10395
  type: Input
10375
- }], placeOutletModel: [{
10396
+ }], placeOutlet$: [{
10376
10397
  type: Input
10377
10398
  }] } });
10378
10399