@valtimo/components 13.44.0 → 13.45.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.
@@ -109,6 +109,8 @@ $darkThemeOverwriteVariables: (
109
109
 
110
110
  @use '@carbon/styles';
111
111
  @use '@carbon/grid';
112
+ /* @use so the path resolves here, not in the consuming app; aliased to avoid a namespace clash */
113
+ @use '@carbon/charts-angular/styles.min.css' as chart-styles;
112
114
  @include grid.flex-grid();
113
115
 
114
116
  /* Extended tag colours, beyond the ten colours Carbon ships for tags. They follow Carbon's own tag
@@ -201,8 +203,6 @@ $extendedTagColors: (
201
203
  }
202
204
  }
203
205
 
204
- @import 'node_modules/@carbon/charts-angular/styles.min.css';
205
-
206
206
  /* default Valtimo colors */
207
207
 
208
208
  :root {
@@ -61,7 +61,6 @@ import { english } from 'flatpickr/dist/l10n/default';
61
61
  import * as i2$5 from 'ng-multiselect-dropdown';
62
62
  import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';
63
63
  import { v4 } from 'uuid';
64
- import { createJSONEditor } from 'vanilla-jsoneditor';
65
64
  import Ajv from 'ajv';
66
65
  import Muuri from 'muuri';
67
66
  import Pickr from '@simonwep/pickr';
@@ -11538,18 +11537,21 @@ class FormIoCurrencyComponent {
11538
11537
  }
11539
11538
  set value(value) {
11540
11539
  this._value = value;
11540
+ // Rendering only — emitting here would write the rendered value back over the one form.io
11541
+ // is about to hand a freshly redrawn component.
11541
11542
  this.currencyForm.setValue({
11542
11543
  currencyValue: Currency.masking(value, this.maskOpts),
11543
- });
11544
+ }, { emitEvent: false });
11544
11545
  }
11545
11546
  set disabled(value) {
11546
11547
  if (value) {
11547
- this.currencyForm.disable();
11548
+ this.currencyForm.disable({ emitEvent: false });
11548
11549
  }
11549
11550
  else {
11550
- this.currencyForm.enable();
11551
+ this.currencyForm.enable({ emitEvent: false });
11551
11552
  }
11552
11553
  }
11554
+ // A fresh object every call: Currency's constructor sets viaInput on the options it is handed.
11553
11555
  get maskOpts() {
11554
11556
  return {
11555
11557
  empty: this.allowEmptyValue || false,
@@ -11563,6 +11565,10 @@ class FormIoCurrencyComponent {
11563
11565
  }
11564
11566
  ngOnInit() {
11565
11567
  this._subscriptions.add(this.currencyForm.valueChanges.subscribe(() => {
11568
+ // No mask yet: the value is being rendered, not typed, so there is nothing to write back.
11569
+ if (!this._currencyInstance) {
11570
+ return;
11571
+ }
11566
11572
  const unmasked = this._currencyInstance.getUnmasked(this.currencyForm.value.currencyValue);
11567
11573
  if (unmasked === 0 && this.allowEmptyValue) {
11568
11574
  this._value = null;
@@ -11581,25 +11587,35 @@ class FormIoCurrencyComponent {
11581
11587
  this._currencyInstance = new Currency(this.currencyElement.nativeElement, {
11582
11588
  maskOpts: this.maskOpts,
11583
11589
  });
11590
+ // A value can arrive before the view exists, so its render is redone here with the mask in
11591
+ // place.
11592
+ if (typeof this._value === 'number') {
11593
+ this.renderValue();
11594
+ }
11584
11595
  }
11585
11596
  ngOnChanges(changes) {
11586
11597
  if (changes.currencyLocale || changes.currencyCurrency || changes.allowEmptyValue) {
11587
- if (typeof this.currencyLocale === 'string') {
11588
- this._currencyInstance.opts.maskOpts.locales = this.currencyLocale;
11589
- }
11590
- if (typeof this.currencyCurrency === 'string') {
11591
- this._currencyInstance.opts.maskOpts.options.currency = this.currencyCurrency;
11592
- }
11593
- if (typeof this.allowEmptyValue === 'boolean') {
11594
- this._currencyInstance.opts.maskOpts.empty = this.allowEmptyValue;
11598
+ // ngOnChanges runs before ngAfterViewInit, which is where the mask is created from the
11599
+ // current inputs, so there is nothing to update yet on the first run.
11600
+ if (this._currencyInstance) {
11601
+ if (typeof this.currencyLocale === 'string') {
11602
+ this._currencyInstance.opts.maskOpts.locales = this.currencyLocale;
11603
+ }
11604
+ if (typeof this.currencyCurrency === 'string') {
11605
+ this._currencyInstance.opts.maskOpts.options.currency = this.currencyCurrency;
11606
+ }
11607
+ if (typeof this.allowEmptyValue === 'boolean') {
11608
+ this._currencyInstance.opts.maskOpts.empty = this.allowEmptyValue;
11609
+ }
11595
11610
  }
11596
- this.currencyForm.setValue({
11597
- currencyValue: typeof this._value === 'number'
11598
- ? Currency.masking(this._value, this._currencyInstance.opts.maskOpts)
11599
- : '',
11600
- });
11611
+ this.renderValue();
11601
11612
  }
11602
11613
  }
11614
+ renderValue() {
11615
+ this.currencyForm.setValue({
11616
+ currencyValue: typeof this._value === 'number' ? Currency.masking(this._value, this.maskOpts) : '',
11617
+ }, { emitEvent: false });
11618
+ }
11603
11619
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormIoCurrencyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
11604
11620
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormIoCurrencyComponent, isStandalone: false, selector: "valtimo-currency", inputs: { value: "value", disabled: "disabled", currencyLocale: "currencyLocale", currencyCurrency: "currencyCurrency", allowEmptyValue: "allowEmptyValue" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "currencyElement", first: true, predicate: ["currencyElement"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<div class=\"currencyForm-container\" [formGroup]=\"currencyForm\">\n <div class=\"input-group\">\n <input #currencyElement id=\"currency\" formControlName=\"currencyValue\" class=\"form-control\" />\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }] }); }
11605
11621
  }
@@ -19391,6 +19407,7 @@ class SchemaEditorComponent {
19391
19407
  this.changeEvent = new EventEmitter();
19392
19408
  this.saveEvent = new EventEmitter();
19393
19409
  this.validEvent = new EventEmitter();
19410
+ this._destroyed = false;
19394
19411
  this._ajv = new Ajv();
19395
19412
  this.showSaveConfirmationModal$ = new BehaviorSubject(false);
19396
19413
  this.valid$ = new BehaviorSubject(false);
@@ -19400,10 +19417,15 @@ class SchemaEditorComponent {
19400
19417
  this.showRequiredPanel$ = new BehaviorSubject(false);
19401
19418
  this.iconService.registerAll([DocumentRequirements16]);
19402
19419
  }
19403
- ngAfterViewInit() {
19404
- const initial = { text: this.schemaJson };
19420
+ async ngAfterViewInit() {
19405
19421
  this.setObjectLevels(this.schemaJson);
19406
19422
  this.setRequired(this.schemaJson);
19423
+ // Lazy — keeps vanilla-jsoneditor out of the initial bundle
19424
+ const { createJSONEditor } = await import('vanilla-jsoneditor');
19425
+ if (this._destroyed)
19426
+ return;
19427
+ // Read after the await: inputs may have changed while loading
19428
+ const initial = { text: this.schemaJson };
19407
19429
  this._editor = createJSONEditor({
19408
19430
  target: this.hostEl.nativeElement,
19409
19431
  props: {
@@ -19447,6 +19469,7 @@ class SchemaEditorComponent {
19447
19469
  }
19448
19470
  }
19449
19471
  ngOnDestroy() {
19472
+ this._destroyed = true;
19450
19473
  if (this._editor)
19451
19474
  this._editor.destroy?.();
19452
19475
  }