@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.
@@ -2177,6 +2177,9 @@ class SelectInputComponent extends AbstractValueInputComponent {
2177
2177
  const self = this;
2178
2178
  const binding = this.registerDisposable(new Binding(this.componentValue$, this.id$, {
2179
2179
  toLeft(selectedId, currentValue) {
2180
+ if (isNil(selectedId)) {
2181
+ return undefined;
2182
+ }
2180
2183
  const newValue = lookup.get(selectedId); // the list is empty or we're missing form it so don't touch the real value.
2181
2184
  return isNil(newValue) ? currentValue : newValue;
2182
2185
  },
@@ -6403,9 +6406,19 @@ class PlaceComponent extends DisposableComponent {
6403
6406
  this._inVisitUpdate = new Guard();
6404
6407
  this._active = new MutableValueModel(false);
6405
6408
  this._parameterChangeInterceptors = [];
6409
+ this.placeRouter = inject(PlaceRouter);
6406
6410
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
6407
6411
  when(this._active).becomesTruthy(() => this._notifyPlaceReady());
6408
- this.childPlaces = this.placeDefinition.children.map(d => d.component);
6412
+ this.childPlaces$ = ListModel.constant(this.placeDefinition.children.map(d => d.component));
6413
+ this.authorisedChildPlaces$ = chain(this.childPlaces$)
6414
+ .select(placeType => {
6415
+ const definition = PlaceComponent.getDefinition(placeType);
6416
+ const guard = this.placeRouter.accessGuard$.value;
6417
+ return guard.isAuthorised(definition) || this.placeRouter.activeVisit$.value?.isPlaceActive(definition);
6418
+ }, {
6419
+ postponeWhile: this.placeRouter.navigationInProgress$,
6420
+ dependsOn: [this.placeRouter.accessGuard$, this.placeRouter.activeVisit$]
6421
+ });
6409
6422
  }
6410
6423
  initialiseVisit(visit, notifyVisitChanged) {
6411
6424
  assert.isNil(this.visitModel.value);
@@ -6429,6 +6442,12 @@ class PlaceComponent extends DisposableComponent {
6429
6442
  // notifyVisitChanged(this.visitModel.value, visit)
6430
6443
  // }
6431
6444
  }
6445
+ /**
6446
+ * @deprecated use authorisedChildPlaces$ instead
6447
+ */
6448
+ get childPlaces() {
6449
+ return this.authorisedChildPlaces$.value;
6450
+ }
6432
6451
  updateVisit(visit) {
6433
6452
  assert.isTruthy(this.isInitialised());
6434
6453
  assert.notNil(visit);
@@ -9314,8 +9333,8 @@ class InputActivity extends Activity {
9314
9333
  super();
9315
9334
  this.class = 'aup-input-activity';
9316
9335
  const form = new DirtyTrackingForm();
9317
- this.valueModel = form.valueModel(this.activityData.initialValue);
9318
- this.valueModel.validateUsing(this.activityData.validators || []);
9336
+ this.value$ = form.valueModel(this.activityData.initialValue);
9337
+ this.value$.validateUsing(this.activityData.validators || []);
9319
9338
  // TODO: move to global configuration
9320
9339
  this.confirmFace = this.activityData.confirmFace ?? {
9321
9340
  icon: () => 'mat:check'
@@ -9324,19 +9343,19 @@ class InputActivity extends Activity {
9324
9343
  icon: () => 'mat:clear'
9325
9344
  };
9326
9345
  this.confirmCommand = Command.create(async () => {
9327
- if (this.valueModel.validate()) {
9346
+ if (this.value$.validate()) {
9328
9347
  if (this.activityData.save) {
9329
9348
  const self = this;
9330
9349
  try {
9331
9350
  let allGood = true;
9332
- const result = await this.activityData.save(this.valueModel.value, {
9351
+ const result = await this.activityData.save(this.value$.value, {
9333
9352
  injectError(error) {
9334
9353
  allGood = false;
9335
- self.valueModel.injectErrors([error]);
9354
+ self.value$.injectErrors([error]);
9336
9355
  }
9337
9356
  });
9338
9357
  if (allGood) {
9339
- this.done(this.valueModel.value);
9358
+ this.done(this.value$.value);
9340
9359
  }
9341
9360
  }
9342
9361
  catch (e) {
@@ -9344,7 +9363,7 @@ class InputActivity extends Activity {
9344
9363
  }
9345
9364
  }
9346
9365
  else {
9347
- this.done(this.valueModel.value);
9366
+ this.done(this.value$.value);
9348
9367
  }
9349
9368
  }
9350
9369
  });
@@ -9352,7 +9371,7 @@ class InputActivity extends Activity {
9352
9371
  this.cancel();
9353
9372
  });
9354
9373
  this.busyWhile(this.confirmCommand.busy$);
9355
- this.onActivityReady(() => this.valueModel.focusContext.requestFocus());
9374
+ this.onActivityReady(() => this.value$.focusContext.requestFocus());
9356
9375
  }
9357
9376
  get layout() {
9358
9377
  return this.activityData?.layout ?? InputActivity.Layout.BLOCK;
@@ -9401,30 +9420,30 @@ class StringInputActivity extends InputActivity {
9401
9420
  }
9402
9421
  StringInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9403
9422
  StringInputActivity.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: StringInputActivity, selector: "aup-string-input-activity", usesInheritance: true, ngImport: i0, template: `
9404
- <aup-string-input [value$]="valueModel"
9405
- [label]="activityData.label"
9406
- [placeholder]="activityData.placeholder"
9407
- [command.enter]="confirmCommand"
9408
- [command.escape]="cancelCommand"></aup-string-input>
9409
- <aup-activity-actions [layout]="layout" align="end"
9410
- [confirmFace]="confirmFace"
9411
- [cancelFace]="cancelFace"
9412
- ></aup-activity-actions>
9423
+ <aup-string-input [value$]="value$"
9424
+ [label]="activityData.label"
9425
+ [placeholder]="activityData.placeholder"
9426
+ [command.enter]="confirmCommand"
9427
+ [command.escape]="cancelCommand"></aup-string-input>
9428
+ <aup-activity-actions [layout]="layout" align="end"
9429
+ [confirmFace]="confirmFace"
9430
+ [cancelFace]="cancelFace"
9431
+ ></aup-activity-actions>
9413
9432
  `, 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"] }] });
9414
9433
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, decorators: [{
9415
9434
  type: Component,
9416
9435
  args: [{
9417
9436
  selector: 'aup-string-input-activity',
9418
9437
  template: `
9419
- <aup-string-input [value$]="valueModel"
9420
- [label]="activityData.label"
9421
- [placeholder]="activityData.placeholder"
9422
- [command.enter]="confirmCommand"
9423
- [command.escape]="cancelCommand"></aup-string-input>
9424
- <aup-activity-actions [layout]="layout" align="end"
9425
- [confirmFace]="confirmFace"
9426
- [cancelFace]="cancelFace"
9427
- ></aup-activity-actions>
9438
+ <aup-string-input [value$]="value$"
9439
+ [label]="activityData.label"
9440
+ [placeholder]="activityData.placeholder"
9441
+ [command.enter]="confirmCommand"
9442
+ [command.escape]="cancelCommand"></aup-string-input>
9443
+ <aup-activity-actions [layout]="layout" align="end"
9444
+ [confirmFace]="confirmFace"
9445
+ [cancelFace]="cancelFace"
9446
+ ></aup-activity-actions>
9428
9447
  `
9429
9448
  }]
9430
9449
  }] });
@@ -9433,7 +9452,11 @@ class SelectInputActivity extends InputActivity {
9433
9452
  constructor() {
9434
9453
  super(...arguments);
9435
9454
  this.defaultOptionLabelFormat = (option) => {
9436
- return this.activityData.optionLabel ? option[this.activityData.optionLabel] : option;
9455
+ return option ?
9456
+ this.activityData.optionLabel ?
9457
+ option[this.activityData.optionLabel]
9458
+ : option
9459
+ : "";
9437
9460
  };
9438
9461
  }
9439
9462
  get optionLabelFormat() {
@@ -9445,14 +9468,17 @@ class SelectInputActivity extends InputActivity {
9445
9468
  }
9446
9469
  SelectInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SelectInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9447
9470
  SelectInputActivity.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: SelectInputActivity, selector: "aup-select-input-activity", usesInheritance: true, ngImport: i0, template: `
9448
- <aup-select-input [value$]="valueModel"
9471
+ <aup-select-input [value$]="value$"
9449
9472
  [label]="activityData.label"
9450
9473
  [placeholder]="activityData.placeholder"
9451
9474
  [command.enter]="confirmCommand"
9452
9475
  [command.escape]="cancelCommand"
9453
9476
  [options]="options"
9454
9477
  [optionLabelFormat]="optionLabelFormat"
9455
- ></aup-select-input>
9478
+ [allowNil]="activityData.allowNil"
9479
+ >
9480
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9481
+ </aup-select-input>
9456
9482
  <aup-activity-actions [layout]="layout" align="end"
9457
9483
  [confirmFace]="confirmFace"
9458
9484
  [cancelFace]="cancelFace"
@@ -9463,14 +9489,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
9463
9489
  args: [{
9464
9490
  selector: 'aup-select-input-activity',
9465
9491
  template: `
9466
- <aup-select-input [value$]="valueModel"
9492
+ <aup-select-input [value$]="value$"
9467
9493
  [label]="activityData.label"
9468
9494
  [placeholder]="activityData.placeholder"
9469
9495
  [command.enter]="confirmCommand"
9470
9496
  [command.escape]="cancelCommand"
9471
9497
  [options]="options"
9472
9498
  [optionLabelFormat]="optionLabelFormat"
9473
- ></aup-select-input>
9499
+ [allowNil]="activityData.allowNil"
9500
+ >
9501
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9502
+ </aup-select-input>
9474
9503
  <aup-activity-actions [layout]="layout" align="end"
9475
9504
  [confirmFace]="confirmFace"
9476
9505
  [cancelFace]="cancelFace"
@@ -10174,19 +10203,11 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
10174
10203
  this.placeFaces = new Map();
10175
10204
  this.trackByPlaceDef = (index, data) => data.place;
10176
10205
  const { chain, valueOf, before, when, after, observe, switchOn } = Dsl.disposeWith(this);
10177
- this.placeDefinitions = chain(this.placesModel)
10178
- .map(c => PlaceComponent.getDefinition(c))
10179
- .select(d => {
10180
- const guard = placeRouter.accessGuard$.value;
10181
- return guard.isAuthorised(d) || placeRouter.activeVisit$.value?.isPlaceActive(d);
10182
- }, {
10183
- postponeWhile: placeRouter.navigationInProgress$,
10184
- dependsOn: [placeRouter.accessGuard$, placeRouter.activeVisit$]
10185
- });
10206
+ this.placeDefinitions = chain(this.places$).map(c => PlaceComponent.getDefinition(c));
10186
10207
  this.commandFactory = Command.createFactory((placeDefinition) => {
10187
10208
  this.placeRouter.navigate(placeDefinition.component);
10188
10209
  });
10189
- when(this.placeOutletModel).changes(outlet => this.handlePlaceOutLetChanged(outlet), { initialValue: "triggerChange" });
10210
+ when(this.placeOutlet$).changes(outlet => this.handlePlaceOutLetChanged(outlet), { initialValue: "triggerChange" });
10190
10211
  this.activePlaceDefinition = chain(this._activePlaceComponent).pluck('placeDefinition');
10191
10212
  this.menuItems = chain(this.placeDefinitions).map(d => {
10192
10213
  return {
@@ -10225,23 +10246,23 @@ class AbstractPlaceNavigationComponent extends DisposableComponent {
10225
10246
  }
10226
10247
  }
10227
10248
  AbstractPlaceNavigationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractPlaceNavigationComponent, deps: [{ token: PlaceRouter }], target: i0.ɵɵFactoryTarget.Component });
10228
- 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 });
10249
+ 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 });
10229
10250
  __decorate([
10230
- StoreInListModel('placesModel'),
10251
+ StoreInListModel('places$'),
10231
10252
  __metadata("design:type", Array)
10232
10253
  ], AbstractPlaceNavigationComponent.prototype, "places", void 0);
10233
10254
  __decorate([
10234
10255
  TrackExternal(),
10235
10256
  __metadata("design:type", ListModel)
10236
- ], AbstractPlaceNavigationComponent.prototype, "placesModel", void 0);
10257
+ ], AbstractPlaceNavigationComponent.prototype, "places$", void 0);
10237
10258
  __decorate([
10238
- StoreInValueModel('placeOutletModel'),
10259
+ StoreInValueModel('placeOutlet$'),
10239
10260
  __metadata("design:type", PlaceOutletComponent)
10240
10261
  ], AbstractPlaceNavigationComponent.prototype, "placeOutlet", void 0);
10241
10262
  __decorate([
10242
10263
  TrackExternal(),
10243
10264
  __metadata("design:type", ValueModel)
10244
- ], AbstractPlaceNavigationComponent.prototype, "placeOutletModel", void 0);
10265
+ ], AbstractPlaceNavigationComponent.prototype, "placeOutlet$", void 0);
10245
10266
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: AbstractPlaceNavigationComponent, decorators: [{
10246
10267
  type: Component,
10247
10268
  args: [{
@@ -10249,11 +10270,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
10249
10270
  }]
10250
10271
  }], ctorParameters: function () { return [{ type: PlaceRouter }]; }, propDecorators: { places: [{
10251
10272
  type: Input
10252
- }], placesModel: [{
10273
+ }], places$: [{
10253
10274
  type: Input
10254
10275
  }], placeOutlet: [{
10255
10276
  type: Input
10256
- }], placeOutletModel: [{
10277
+ }], placeOutlet$: [{
10257
10278
  type: Input
10258
10279
  }] } });
10259
10280