@coolon/angular-ui-powerups 14.42.0 → 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
  },
@@ -9330,8 +9333,8 @@ class InputActivity extends Activity {
9330
9333
  super();
9331
9334
  this.class = 'aup-input-activity';
9332
9335
  const form = new DirtyTrackingForm();
9333
- this.valueModel = form.valueModel(this.activityData.initialValue);
9334
- this.valueModel.validateUsing(this.activityData.validators || []);
9336
+ this.value$ = form.valueModel(this.activityData.initialValue);
9337
+ this.value$.validateUsing(this.activityData.validators || []);
9335
9338
  // TODO: move to global configuration
9336
9339
  this.confirmFace = this.activityData.confirmFace ?? {
9337
9340
  icon: () => 'mat:check'
@@ -9340,19 +9343,19 @@ class InputActivity extends Activity {
9340
9343
  icon: () => 'mat:clear'
9341
9344
  };
9342
9345
  this.confirmCommand = Command.create(async () => {
9343
- if (this.valueModel.validate()) {
9346
+ if (this.value$.validate()) {
9344
9347
  if (this.activityData.save) {
9345
9348
  const self = this;
9346
9349
  try {
9347
9350
  let allGood = true;
9348
- const result = await this.activityData.save(this.valueModel.value, {
9351
+ const result = await this.activityData.save(this.value$.value, {
9349
9352
  injectError(error) {
9350
9353
  allGood = false;
9351
- self.valueModel.injectErrors([error]);
9354
+ self.value$.injectErrors([error]);
9352
9355
  }
9353
9356
  });
9354
9357
  if (allGood) {
9355
- this.done(this.valueModel.value);
9358
+ this.done(this.value$.value);
9356
9359
  }
9357
9360
  }
9358
9361
  catch (e) {
@@ -9360,7 +9363,7 @@ class InputActivity extends Activity {
9360
9363
  }
9361
9364
  }
9362
9365
  else {
9363
- this.done(this.valueModel.value);
9366
+ this.done(this.value$.value);
9364
9367
  }
9365
9368
  }
9366
9369
  });
@@ -9368,7 +9371,7 @@ class InputActivity extends Activity {
9368
9371
  this.cancel();
9369
9372
  });
9370
9373
  this.busyWhile(this.confirmCommand.busy$);
9371
- this.onActivityReady(() => this.valueModel.focusContext.requestFocus());
9374
+ this.onActivityReady(() => this.value$.focusContext.requestFocus());
9372
9375
  }
9373
9376
  get layout() {
9374
9377
  return this.activityData?.layout ?? InputActivity.Layout.BLOCK;
@@ -9417,30 +9420,30 @@ class StringInputActivity extends InputActivity {
9417
9420
  }
9418
9421
  StringInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9419
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: `
9420
- <aup-string-input [value$]="valueModel"
9421
- [label]="activityData.label"
9422
- [placeholder]="activityData.placeholder"
9423
- [command.enter]="confirmCommand"
9424
- [command.escape]="cancelCommand"></aup-string-input>
9425
- <aup-activity-actions [layout]="layout" align="end"
9426
- [confirmFace]="confirmFace"
9427
- [cancelFace]="cancelFace"
9428
- ></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>
9429
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"] }] });
9430
9433
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: StringInputActivity, decorators: [{
9431
9434
  type: Component,
9432
9435
  args: [{
9433
9436
  selector: 'aup-string-input-activity',
9434
9437
  template: `
9435
- <aup-string-input [value$]="valueModel"
9436
- [label]="activityData.label"
9437
- [placeholder]="activityData.placeholder"
9438
- [command.enter]="confirmCommand"
9439
- [command.escape]="cancelCommand"></aup-string-input>
9440
- <aup-activity-actions [layout]="layout" align="end"
9441
- [confirmFace]="confirmFace"
9442
- [cancelFace]="cancelFace"
9443
- ></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>
9444
9447
  `
9445
9448
  }]
9446
9449
  }] });
@@ -9449,7 +9452,11 @@ class SelectInputActivity extends InputActivity {
9449
9452
  constructor() {
9450
9453
  super(...arguments);
9451
9454
  this.defaultOptionLabelFormat = (option) => {
9452
- return this.activityData.optionLabel ? option[this.activityData.optionLabel] : option;
9455
+ return option ?
9456
+ this.activityData.optionLabel ?
9457
+ option[this.activityData.optionLabel]
9458
+ : option
9459
+ : "";
9453
9460
  };
9454
9461
  }
9455
9462
  get optionLabelFormat() {
@@ -9461,14 +9468,17 @@ class SelectInputActivity extends InputActivity {
9461
9468
  }
9462
9469
  SelectInputActivity.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: SelectInputActivity, deps: null, target: i0.ɵɵFactoryTarget.Component });
9463
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: `
9464
- <aup-select-input [value$]="valueModel"
9471
+ <aup-select-input [value$]="value$"
9465
9472
  [label]="activityData.label"
9466
9473
  [placeholder]="activityData.placeholder"
9467
9474
  [command.enter]="confirmCommand"
9468
9475
  [command.escape]="cancelCommand"
9469
9476
  [options]="options"
9470
9477
  [optionLabelFormat]="optionLabelFormat"
9471
- ></aup-select-input>
9478
+ [allowNil]="activityData.allowNil"
9479
+ >
9480
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9481
+ </aup-select-input>
9472
9482
  <aup-activity-actions [layout]="layout" align="end"
9473
9483
  [confirmFace]="confirmFace"
9474
9484
  [cancelFace]="cancelFace"
@@ -9479,14 +9489,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
9479
9489
  args: [{
9480
9490
  selector: 'aup-select-input-activity',
9481
9491
  template: `
9482
- <aup-select-input [value$]="valueModel"
9492
+ <aup-select-input [value$]="value$"
9483
9493
  [label]="activityData.label"
9484
9494
  [placeholder]="activityData.placeholder"
9485
9495
  [command.enter]="confirmCommand"
9486
9496
  [command.escape]="cancelCommand"
9487
9497
  [options]="options"
9488
9498
  [optionLabelFormat]="optionLabelFormat"
9489
- ></aup-select-input>
9499
+ [allowNil]="activityData.allowNil"
9500
+ >
9501
+ <ng-template #nilOptionTemplate>{{activityData.nilLabel}}</ng-template>
9502
+ </aup-select-input>
9490
9503
  <aup-activity-actions [layout]="layout" align="end"
9491
9504
  [confirmFace]="confirmFace"
9492
9505
  [cancelFace]="cancelFace"