@mediusinc/mng-commons 0.10.0 → 0.10.1

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.
@@ -2149,6 +2149,7 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
2149
2149
  constructor(editor, property) {
2150
2150
  super(editor);
2151
2151
  this._required = false;
2152
+ this._requiredHideLabelMarker = false;
2152
2153
  this._disabled = false;
2153
2154
  this._validations = [];
2154
2155
  this._asyncValidations = [];
@@ -2178,6 +2179,9 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
2178
2179
  get required() {
2179
2180
  return this._required;
2180
2181
  }
2182
+ get requiredHideLabelMarker() {
2183
+ return this._requiredHideLabelMarker;
2184
+ }
2181
2185
  get disabled() {
2182
2186
  return this._disabled;
2183
2187
  }
@@ -2238,11 +2242,12 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
2238
2242
  this._helpText = helpText;
2239
2243
  return this;
2240
2244
  }
2241
- withRequired(required = true, requiredExpression) {
2245
+ withRequired(required = true, requiredExpression, hideLabelMarker = false) {
2242
2246
  this._required = required;
2243
2247
  if (requiredExpression) {
2244
2248
  this._requiredExpression = requiredExpression;
2245
2249
  }
2250
+ this._requiredHideLabelMarker = hideLabelMarker;
2246
2251
  return this;
2247
2252
  }
2248
2253
  withDisabled(disabled = true, disabledExpression) {
@@ -2703,7 +2708,7 @@ class FieldLookupEnumDescriptor extends FieldLookupDescriptor {
2703
2708
  if (defaultOptionValue) {
2704
2709
  const option = this._optionEnumValues.find(o => o.value === defaultOptionValue);
2705
2710
  if (option) {
2706
- this.withDefaultValue(option);
2711
+ this.withDefaultValue(this._itemsValueProperty ? option[this._itemsValueProperty] : option);
2707
2712
  }
2708
2713
  }
2709
2714
  return this;
@@ -3480,6 +3485,9 @@ class EditorFormlyUtil {
3480
3485
  }
3481
3486
  if (descriptor.required) {
3482
3487
  field.templateOptions.required = true;
3488
+ if (descriptor.requiredHideLabelMarker) {
3489
+ field.templateOptions['hideRequiredMarker'] = true;
3490
+ }
3483
3491
  }
3484
3492
  if (descriptor.hiddenExpression) {
3485
3493
  field.expressionProperties['hide'] = descriptor.hiddenExpression;
@@ -6561,10 +6569,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
6561
6569
  class MngFormlyFieldWrapperComponent extends FieldWrapper {
6562
6570
  }
6563
6571
  MngFormlyFieldWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: MngFormlyFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
6564
- MngFormlyFieldWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: MngFormlyFieldWrapperComponent, selector: "mng-formly-field-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"to?.['descriptor']?.['fieldClassName'] ?? 'field'\">\n <label [for]=\"key\" [class]=\"to?.['descriptor']?.['labelClassName'] ?? ''\"\n >{{ $any(to?.label) | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label\n >\n <ng-container #fieldComponent></ng-container>\n <small *ngIf=\"to?.['descriptor']?.['helpText']\">{{ to?.['descriptor']?.['helpText'] | translate }}</small>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n</div>\n", components: [{ type: i3$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1$1.TranslatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
6572
+ MngFormlyFieldWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: MngFormlyFieldWrapperComponent, selector: "mng-formly-field-wrapper", usesInheritance: true, ngImport: i0, template: "<div [class]=\"to?.['descriptor']?.['fieldClassName'] ?? 'field'\">\n <label *ngIf=\"to?.label\" [for]=\"key\" [class]=\"to?.['descriptor']?.['labelClassName'] ?? ''\"\n >{{ to!.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label\n >\n <ng-container #fieldComponent></ng-container>\n <small *ngIf=\"to?.['descriptor']?.['helpText']\">{{ to?.['descriptor']?.['helpText'] | translate }}</small>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n</div>\n", components: [{ type: i3$1.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "translate": i1$1.TranslatePipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
6565
6573
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: MngFormlyFieldWrapperComponent, decorators: [{
6566
6574
  type: Component,
6567
- args: [{ selector: 'mng-formly-field-wrapper', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"to?.['descriptor']?.['fieldClassName'] ?? 'field'\">\n <label [for]=\"key\" [class]=\"to?.['descriptor']?.['labelClassName'] ?? ''\"\n >{{ $any(to?.label) | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label\n >\n <ng-container #fieldComponent></ng-container>\n <small *ngIf=\"to?.['descriptor']?.['helpText']\">{{ to?.['descriptor']?.['helpText'] | translate }}</small>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n</div>\n" }]
6575
+ args: [{ selector: 'mng-formly-field-wrapper', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"to?.['descriptor']?.['fieldClassName'] ?? 'field'\">\n <label *ngIf=\"to?.label\" [for]=\"key\" [class]=\"to?.['descriptor']?.['labelClassName'] ?? ''\"\n >{{ to!.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label\n >\n <ng-container #fieldComponent></ng-container>\n <small *ngIf=\"to?.['descriptor']?.['helpText']\">{{ to?.['descriptor']?.['helpText'] | translate }}</small>\n <small *ngIf=\"showError\" class=\"p-error\">\n <formly-validation-message [field]=\"field\"></formly-validation-message>\n </small>\n</div>\n" }]
6568
6576
  }] });
6569
6577
 
6570
6578
  class MngFormlyTableWrapperComponent extends FieldWrapper {
@@ -7350,13 +7358,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImpor
7350
7358
  args: [LOCALE_ID]
7351
7359
  }] }]; } });
7352
7360
 
7353
- class MngFormlyFieldLabelComponent {
7361
+ class MngFormlyFieldLabelComponent extends FieldType {
7354
7362
  constructor() {
7363
+ super(...arguments);
7355
7364
  this.className = 'hidden';
7356
7365
  }
7366
+ ngOnInit() {
7367
+ this.descriptor = this.to['descriptor'];
7368
+ this.formControl?.patchValue(this.descriptor.label);
7369
+ }
7357
7370
  }
7358
- MngFormlyFieldLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: MngFormlyFieldLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
7359
- MngFormlyFieldLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: MngFormlyFieldLabelComponent, selector: "mng-formly-field-label", host: { properties: { "class": "this.className" } }, ngImport: i0, template: "", changeDetection: i0.ChangeDetectionStrategy.OnPush });
7371
+ MngFormlyFieldLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: MngFormlyFieldLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
7372
+ MngFormlyFieldLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.8", type: MngFormlyFieldLabelComponent, selector: "mng-formly-field-label", host: { properties: { "class": "this.className" } }, usesInheritance: true, ngImport: i0, template: "", changeDetection: i0.ChangeDetectionStrategy.OnPush });
7360
7373
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.8", ngImport: i0, type: MngFormlyFieldLabelComponent, decorators: [{
7361
7374
  type: Component,
7362
7375
  args: [{ selector: 'mng-formly-field-label', changeDetection: ChangeDetectionStrategy.OnPush, template: "" }]