@3kles/kles-material-dynamicforms 21.4.0 → 21.4.2

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.
@@ -224,6 +224,7 @@ class KlesFormUiControl extends KlesAbstractFormUiControl {
224
224
  hint: this.field.hint,
225
225
  placeholder: this.field.placeholder,
226
226
  tooltip: this.field.tooltip,
227
+ currencyOptions: this.field.currencyOptions,
227
228
  });
228
229
  }
229
230
  }
@@ -5879,6 +5880,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
5879
5880
  }] });
5880
5881
 
5881
5882
  class KlesFormTileComponent extends KlesFieldAbstract {
5883
+ constructor() {
5884
+ super(...arguments);
5885
+ this.control = this.group.controls[this.field.name];
5886
+ this.controlValue = toSignal(this.control.valueChanges, {
5887
+ initialValue: this.control.value,
5888
+ });
5889
+ this.formattedValue = computed(() => {
5890
+ const value = this.controlValue();
5891
+ if (value == null) {
5892
+ return '';
5893
+ }
5894
+ if (this.field.displayWith) {
5895
+ return this.field.displayWith(value) ?? '';
5896
+ }
5897
+ if (this.field.property && typeof value === 'object') {
5898
+ return String(value[this.field.property] ?? '');
5899
+ }
5900
+ return String(value);
5901
+ }, ...(ngDevMode ? [{ debugName: "formattedValue" }] : /* istanbul ignore next */ []));
5902
+ this.displayValue = computed(() => this.formattedValue() || this.label() || '', ...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
5903
+ }
5882
5904
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormTileComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
5883
5905
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: KlesFormTileComponent, isStandalone: true, selector: "app-kles-form-tile", usesInheritance: true, ngImport: i0, template: `
5884
5906
  <div class="kles-tile" [ngClass]="ngClass()" [ngStyle]="ngStyle()" [matTooltip]="tooltip()">
@@ -5887,9 +5909,9 @@ class KlesFormTileComponent extends KlesFieldAbstract {
5887
5909
  }
5888
5910
 
5889
5911
  <div class="kles-tile__content">
5890
- @if (label()) {
5912
+ @if (displayValue(); as value) {
5891
5913
  <div class="kles-tile__label">
5892
- {{ label() }}
5914
+ {{ value }}
5893
5915
  </div>
5894
5916
  }
5895
5917
 
@@ -5911,9 +5933,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
5911
5933
  }
5912
5934
 
5913
5935
  <div class="kles-tile__content">
5914
- @if (label()) {
5936
+ @if (displayValue(); as value) {
5915
5937
  <div class="kles-tile__label">
5916
- {{ label() }}
5938
+ {{ value }}
5917
5939
  </div>
5918
5940
  }
5919
5941
 
@@ -6147,6 +6169,7 @@ let KlesFormCurrencyComponent = class KlesFormCurrencyComponent extends KlesFiel
6147
6169
  constructor() {
6148
6170
  super(...arguments);
6149
6171
  this.localeId = inject(LOCALE_ID);
6172
+ this.currencyOptions = computed(() => this.resolvedFieldUi()?.currencyOptions, ...(ngDevMode ? [{ debugName: "currencyOptions" }] : /* istanbul ignore next */ []));
6150
6173
  this.defaultCurrencyCode = inject(DEFAULT_CURRENCY_CODE);
6151
6174
  }
6152
6175
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: KlesFormCurrencyComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
@@ -6177,13 +6200,13 @@ let KlesFormCurrencyComponent = class KlesFormCurrencyComponent extends KlesFiel
6177
6200
  [matTooltip]="tooltip()"
6178
6201
  [formControlName]="field.name"
6179
6202
  [placeholder]="placeholder()"
6180
- [currency]="field.currencyOptions?.code || defaultCurrencyCode"
6181
- [locale]="field.currencyOptions?.locale || localeId"
6182
- [currencyDisplay]="field.currencyOptions?.display || 'symbol'"
6183
- [minimumFractionDigits]="field.currencyOptions?.minimumFractionDigits"
6184
- [maximumFractionDigits]="field.currencyOptions?.maximumFractionDigits"
6185
- [useGrouping]="field.currencyOptions?.useGrouping !== false"
6186
- [allowNegative]="field.currencyOptions?.allowNegative !== false"
6203
+ [currency]="currencyOptions()?.code || defaultCurrencyCode"
6204
+ [locale]="currencyOptions()?.locale || localeId"
6205
+ [currencyDisplay]="currencyOptions()?.display || 'symbol'"
6206
+ [minimumFractionDigits]="currencyOptions()?.minimumFractionDigits"
6207
+ [maximumFractionDigits]="currencyOptions()?.maximumFractionDigits"
6208
+ [useGrouping]="currencyOptions()?.useGrouping !== false"
6209
+ [allowNegative]="currencyOptions()?.allowNegative !== false"
6187
6210
  (focus)="onFocus()"
6188
6211
  (blur)="onBlur()"
6189
6212
  />
@@ -6244,13 +6267,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
6244
6267
  [matTooltip]="tooltip()"
6245
6268
  [formControlName]="field.name"
6246
6269
  [placeholder]="placeholder()"
6247
- [currency]="field.currencyOptions?.code || defaultCurrencyCode"
6248
- [locale]="field.currencyOptions?.locale || localeId"
6249
- [currencyDisplay]="field.currencyOptions?.display || 'symbol'"
6250
- [minimumFractionDigits]="field.currencyOptions?.minimumFractionDigits"
6251
- [maximumFractionDigits]="field.currencyOptions?.maximumFractionDigits"
6252
- [useGrouping]="field.currencyOptions?.useGrouping !== false"
6253
- [allowNegative]="field.currencyOptions?.allowNegative !== false"
6270
+ [currency]="currencyOptions()?.code || defaultCurrencyCode"
6271
+ [locale]="currencyOptions()?.locale || localeId"
6272
+ [currencyDisplay]="currencyOptions()?.display || 'symbol'"
6273
+ [minimumFractionDigits]="currencyOptions()?.minimumFractionDigits"
6274
+ [maximumFractionDigits]="currencyOptions()?.maximumFractionDigits"
6275
+ [useGrouping]="currencyOptions()?.useGrouping !== false"
6276
+ [allowNegative]="currencyOptions()?.allowNegative !== false"
6254
6277
  (focus)="onFocus()"
6255
6278
  (blur)="onBlur()"
6256
6279
  />