@valtimo/components 13.45.0 → 13.46.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.
- package/fesm2022/valtimo-components.mjs +234 -186
- package/fesm2022/valtimo-components.mjs.map +1 -1
- package/lib/components/auto-key-input/auto-key-input.component.d.ts +9 -1
- package/lib/components/auto-key-input/auto-key-input.component.d.ts.map +1 -1
- package/lib/components/form/form.component.d.ts +3 -1
- package/lib/components/form/form.component.d.ts.map +1 -1
- package/lib/components/form-io/components/form-io/form-io.component.d.ts +3 -0
- package/lib/components/form-io/components/form-io/form-io.component.d.ts.map +1 -1
- package/lib/components/form-io/components/form-io-builder/form-io-builder.component.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { combineLatest, map, BehaviorSubject, switchMap, catchError, of, shareRe
|
|
|
4
4
|
import * as i1 from '@ngx-translate/core';
|
|
5
5
|
import { TranslateModule, TranslateLoader, TranslateService, TranslatePipe } from '@ngx-translate/core';
|
|
6
6
|
import * as i1$2 from '@valtimo/shared';
|
|
7
|
-
import { BaseApiService, VERSIONS, HttpLoaderFactory, getContextObservable, getCaseManagementRouteParams, getBuildingBlockManagementRouteParams } from '@valtimo/shared';
|
|
7
|
+
import { BaseApiService, VERSIONS, HttpLoaderFactory, getContextObservable, getCaseManagementRouteParams, getBuildingBlockManagementRouteParams, sanitizeKey, toKebabCase } from '@valtimo/shared';
|
|
8
8
|
import * as i1$1 from '@angular/common/http';
|
|
9
9
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
10
10
|
import { filter, map as map$1, take, tap as tap$1, debounceTime, distinctUntilChanged, takeUntil as takeUntil$1, startWith as startWith$1, switchMap as switchMap$1, delay } from 'rxjs/operators';
|
|
@@ -9661,7 +9661,7 @@ class FormioComponent {
|
|
|
9661
9661
|
const formioTranslations = this.translateService.instant('formioTranslations');
|
|
9662
9662
|
const defaultOptions = {
|
|
9663
9663
|
...options,
|
|
9664
|
-
...(formioTranslations === 'object' && {
|
|
9664
|
+
...(typeof formioTranslations === 'object' && {
|
|
9665
9665
|
i18n: {
|
|
9666
9666
|
[language]: this.stateService.flattenTranslationsObject(formioTranslations),
|
|
9667
9667
|
},
|
|
@@ -9669,6 +9669,8 @@ class FormioComponent {
|
|
|
9669
9669
|
};
|
|
9670
9670
|
return deepmerge(defaultOptions, overrideOptions);
|
|
9671
9671
|
}), distinctUntilChanged((prev, curr) => isEqual(prev, curr)), tap$1(options => this.logger.debug('Form.IO options used', options)));
|
|
9672
|
+
// Only renderOptions reaches form.io itself; getRendererOptions() drops everything else.
|
|
9673
|
+
this.renderOptions$ = this.currentLanguage$.pipe(map$1(language => ({ language })));
|
|
9672
9674
|
this._storeTokenInLocalStorage = !this.configService.getFeatureToggle('disableFormioTokenInLocalStorage');
|
|
9673
9675
|
this._inMemoryTokenSet$ = new BehaviorSubject(false);
|
|
9674
9676
|
// The form is only rendered once a token is available. In the default (legacy) mode the token
|
|
@@ -9807,11 +9809,11 @@ class FormioComponent {
|
|
|
9807
9809
|
this._overrideOptions$.next(config.formioOptions);
|
|
9808
9810
|
}
|
|
9809
9811
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormioComponent, deps: [{ token: i6$1.UserProviderService }, { token: i4.NGXLogger }, { token: FormIoStateService }, { token: i1$3.ActivatedRoute }, { token: i1.TranslateService }, { token: FormIoLocalStorageService }, { token: ValtimoModalService }, { token: i1$2.ConfigService }, { token: FormIoTagsService }, { token: i0.Injector }, { token: FormioTranslationService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
9810
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormioComponent, isStandalone: false, selector: "valtimo-form-io", inputs: { options: "options", submission: "submission", form: "form", readOnly: "readOnly", errors: "errors", formRefresh$: "formRefresh$" }, outputs: { submit: "submit", change: "change", event: "event" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [FormIoLocalStorageService], 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\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i9.FormioComponent, selector: "formio" }, { kind: "directive", type: i2$3.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }] }); }
|
|
9812
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormioComponent, isStandalone: false, selector: "valtimo-form-io", inputs: { options: "options", submission: "submission", form: "form", readOnly: "readOnly", errors: "errors", formRefresh$: "formRefresh$" }, outputs: { submit: "submit", change: "change", event: "event" }, host: { listeners: { "window:beforeunload": "handleBeforeUnload($event)" } }, providers: [FormIoLocalStorageService], 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\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n renderOptions: renderOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [renderOptions]=\"obs.renderOptions\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: i1$4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i9.FormioComponent, selector: "formio" }, { kind: "directive", type: i2$3.LayerDirective, selector: "[cdsLayer], [ibmLayer]", inputs: ["ibmLayer", "cdsLayer"], exportAs: ["layer"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }] }); }
|
|
9811
9813
|
}
|
|
9812
9814
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormioComponent, decorators: [{
|
|
9813
9815
|
type: Component,
|
|
9814
|
-
args: [{ selector: 'valtimo-form-io', providers: [FormIoLocalStorageService], standalone: false, 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\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n" }]
|
|
9816
|
+
args: [{ selector: 'valtimo-form-io', providers: [FormIoLocalStorageService], standalone: false, 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\n class=\"formio-carbon\"\n cdsLayer=\"1\"\n *ngIf=\"{\n currentLanguage: currentLanguage$ | async,\n formioOptions: formioOptions$ | async,\n renderOptions: renderOptions$ | async,\n submission: submission$ | async,\n readOnly: readOnly$ | async,\n form: form$ | async,\n errors: errors$ | async,\n tokenReady: tokenReady$ | async,\n } as obs\"\n>\n <div *ngIf=\"obs.errors.length > 0\" class=\"alert alert-danger pt-5 pb-5 mb-2\">\n <ol>\n <li *ngFor=\"let error of obs.errors\">\n {{ error }}\n </li>\n </ol>\n </div>\n\n <formio\n *ngIf=\"obs.formioOptions && obs.form && obs.tokenReady\"\n [form]=\"obs.form\"\n [language]=\"languageEventEmitter\"\n [options]=\"obs.formioOptions\"\n [readOnly]=\"obs.readOnly\"\n [refresh]=\"refreshForm\"\n [renderOptions]=\"obs.renderOptions\"\n [submission]=\"obs.submission\"\n (change)=\"onChange($event)\"\n (nextPage)=\"nextPage()\"\n (prevPage)=\"prevPage()\"\n (ready)=\"formReady($event)\"\n (submit)=\"onSubmit($event)\"\n (customEvent)=\"onCustomEvent($event)\"\n ></formio>\n</div>\n" }]
|
|
9815
9817
|
}], ctorParameters: () => [{ type: i6$1.UserProviderService }, { type: i4.NGXLogger }, { type: FormIoStateService }, { type: i1$3.ActivatedRoute }, { type: i1.TranslateService }, { type: FormIoLocalStorageService }, { type: ValtimoModalService }, { type: i1$2.ConfigService }, { type: FormIoTagsService }, { type: i0.Injector }, { type: FormioTranslationService }], propDecorators: { options: [{
|
|
9816
9818
|
type: Input
|
|
9817
9819
|
}], submission: [{
|
|
@@ -9952,7 +9954,8 @@ class FormioBuilderComponent {
|
|
|
9952
9954
|
const formioTranslations = this.translateService.instant('formioTranslations');
|
|
9953
9955
|
const defaultOptions = {
|
|
9954
9956
|
...options,
|
|
9955
|
-
|
|
9957
|
+
language,
|
|
9958
|
+
...(typeof formioTranslations === 'object' && {
|
|
9956
9959
|
i18n: {
|
|
9957
9960
|
[language]: this.stateService.flattenTranslationsObject(formioTranslations),
|
|
9958
9961
|
},
|
|
@@ -15806,6 +15809,226 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
15806
15809
|
type: Output
|
|
15807
15810
|
}] } });
|
|
15808
15811
|
|
|
15812
|
+
/*
|
|
15813
|
+
* Copyright 2015-2026 Ritense BV, the Netherlands.
|
|
15814
|
+
*
|
|
15815
|
+
* Licensed under EUPL, Version 1.2 (the "License");
|
|
15816
|
+
* you may not use this file except in compliance with the License.
|
|
15817
|
+
* You may obtain a copy of the License at
|
|
15818
|
+
*
|
|
15819
|
+
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
15820
|
+
*
|
|
15821
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15822
|
+
* distributed under the License is distributed on an "AS IS" basis,
|
|
15823
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15824
|
+
* See the License for the specific language governing permissions and
|
|
15825
|
+
* limitations under the License.
|
|
15826
|
+
*/
|
|
15827
|
+
class AutoKeyInputComponent {
|
|
15828
|
+
set disabled(value) {
|
|
15829
|
+
this.$disabled.set(value);
|
|
15830
|
+
}
|
|
15831
|
+
// Seeds the value outside reactive forms, where writeValue is never called
|
|
15832
|
+
set defaultValue(value) {
|
|
15833
|
+
if (value)
|
|
15834
|
+
this.setValue(value);
|
|
15835
|
+
}
|
|
15836
|
+
set mode(value) {
|
|
15837
|
+
this._mode$.next(value);
|
|
15838
|
+
}
|
|
15839
|
+
get mode$() {
|
|
15840
|
+
return this._mode$.pipe(filter(mode => !!mode));
|
|
15841
|
+
}
|
|
15842
|
+
set usedKeys(value) {
|
|
15843
|
+
this._usedKeys$.next(value || []);
|
|
15844
|
+
}
|
|
15845
|
+
set sourceText(value) {
|
|
15846
|
+
this._sourceText$.next(value || '');
|
|
15847
|
+
}
|
|
15848
|
+
constructor(iconService) {
|
|
15849
|
+
this.iconService = iconService;
|
|
15850
|
+
this.labelTranslationKey = 'Key';
|
|
15851
|
+
this.placeholderTranslationKey = '';
|
|
15852
|
+
this.dataTestId = AUTO_KEY_INPUT_TEST_IDS.input;
|
|
15853
|
+
// Read by the legacy v-form, which keys its output by component name
|
|
15854
|
+
this.name = '';
|
|
15855
|
+
this.margin = false;
|
|
15856
|
+
this.testIds = AUTO_KEY_INPUT_TEST_IDS;
|
|
15857
|
+
// Value stream the legacy v-form collects; the reactive-forms path uses onChange
|
|
15858
|
+
this.inputValue$ = new BehaviorSubject('');
|
|
15859
|
+
this._mode$ = new BehaviorSubject(null);
|
|
15860
|
+
this._usedKeys$ = new BehaviorSubject([]);
|
|
15861
|
+
this._sourceText$ = new BehaviorSubject('');
|
|
15862
|
+
this.$disabled = signal(false);
|
|
15863
|
+
this.value = '';
|
|
15864
|
+
this.editingKey$ = new BehaviorSubject(true);
|
|
15865
|
+
this.duplicateInitialized = false;
|
|
15866
|
+
this.idError$ = new BehaviorSubject(null);
|
|
15867
|
+
this.onChange = (_) => { };
|
|
15868
|
+
this.onTouched = () => { };
|
|
15869
|
+
this.onValidatorChange = () => { };
|
|
15870
|
+
this.validate = (control) => this.idError$.getValue() ? { idError: { value: this.idError$.getValue() } } : null;
|
|
15871
|
+
this.subscription = new Subscription();
|
|
15872
|
+
this.iconService.registerAll([Edit16, Close16]);
|
|
15873
|
+
this.subscription.add(this.mode$.subscribe(mode => {
|
|
15874
|
+
this.editingKey$.next(mode === 'edit');
|
|
15875
|
+
if (mode === 'duplicate') {
|
|
15876
|
+
this.duplicateInitialized = false;
|
|
15877
|
+
}
|
|
15878
|
+
}));
|
|
15879
|
+
this.subscription.add(combineLatest([this.mode$, this.editingKey$, this._usedKeys$, this._sourceText$]).subscribe(([mode, editingKey, usedKeys, sourceText]) => {
|
|
15880
|
+
if (mode === 'add' || mode === 'duplicate') {
|
|
15881
|
+
this.updateKey(mode, editingKey, usedKeys, sourceText);
|
|
15882
|
+
}
|
|
15883
|
+
}));
|
|
15884
|
+
}
|
|
15885
|
+
ngOnChanges() {
|
|
15886
|
+
this.onValidatorChange();
|
|
15887
|
+
}
|
|
15888
|
+
ngOnDestroy() {
|
|
15889
|
+
this.subscription.unsubscribe();
|
|
15890
|
+
this.duplicateInitialized = false;
|
|
15891
|
+
this.idError$.next(null);
|
|
15892
|
+
}
|
|
15893
|
+
setDisabledState(disabled) {
|
|
15894
|
+
this.$disabled.set(disabled);
|
|
15895
|
+
}
|
|
15896
|
+
writeValue(value) {
|
|
15897
|
+
if (value === null || value === '') {
|
|
15898
|
+
this.resetInternalState();
|
|
15899
|
+
return;
|
|
15900
|
+
}
|
|
15901
|
+
this.setValue(value ?? '');
|
|
15902
|
+
}
|
|
15903
|
+
registerOnChange(fn) {
|
|
15904
|
+
this.onChange = fn;
|
|
15905
|
+
}
|
|
15906
|
+
registerOnTouched(fn) {
|
|
15907
|
+
this.onTouched = fn;
|
|
15908
|
+
}
|
|
15909
|
+
registerOnValidatorChange(fn) {
|
|
15910
|
+
this.onValidatorChange = fn;
|
|
15911
|
+
}
|
|
15912
|
+
onInputChange(event) {
|
|
15913
|
+
const input = event.target;
|
|
15914
|
+
const key = sanitizeKey(input.value);
|
|
15915
|
+
if (input.value !== key)
|
|
15916
|
+
this.reflectSanitizedKey(input, key);
|
|
15917
|
+
const usedKeys = this._usedKeys$.getValue();
|
|
15918
|
+
this.idError$.next(usedKeys.includes(key) ? 'caseManagement.statuses.keyDuplicated' : null);
|
|
15919
|
+
this.setValue(key);
|
|
15920
|
+
this.onChange(this.value);
|
|
15921
|
+
}
|
|
15922
|
+
enableKeyEditing() {
|
|
15923
|
+
this.editingKey$.next(true);
|
|
15924
|
+
}
|
|
15925
|
+
disableKeyEditing() {
|
|
15926
|
+
this.editingKey$.next(false);
|
|
15927
|
+
}
|
|
15928
|
+
getUniqueKey(sourceText, usedKeys) {
|
|
15929
|
+
const baseKey = toKebabCase(sourceText);
|
|
15930
|
+
if (!usedKeys.includes(baseKey) || this._mode$.getValue() === 'edit') {
|
|
15931
|
+
return baseKey;
|
|
15932
|
+
}
|
|
15933
|
+
return this.getUniqueKeyWithNumber(baseKey, usedKeys);
|
|
15934
|
+
}
|
|
15935
|
+
// Stripping a character leaves the model unchanged, so Angular skips the [value] binding
|
|
15936
|
+
reflectSanitizedKey(input, key) {
|
|
15937
|
+
const removed = input.value.length - key.length;
|
|
15938
|
+
const caret = Math.max((input.selectionStart ?? input.value.length) - removed, 0);
|
|
15939
|
+
input.value = key;
|
|
15940
|
+
input.setSelectionRange(caret, caret);
|
|
15941
|
+
}
|
|
15942
|
+
setValue(value) {
|
|
15943
|
+
this.value = value;
|
|
15944
|
+
if (this.inputValue$.getValue() !== value)
|
|
15945
|
+
this.inputValue$.next(value);
|
|
15946
|
+
}
|
|
15947
|
+
resetInternalState() {
|
|
15948
|
+
this.setValue('');
|
|
15949
|
+
this.idError$.next(null);
|
|
15950
|
+
this.disableKeyEditing();
|
|
15951
|
+
this.duplicateInitialized = false;
|
|
15952
|
+
}
|
|
15953
|
+
updateKey(mode, editingKey, usedKeys, sourceText) {
|
|
15954
|
+
if (editingKey) {
|
|
15955
|
+
return;
|
|
15956
|
+
}
|
|
15957
|
+
let newKey = sourceText ? this.getUniqueKey(sourceText, usedKeys) : '';
|
|
15958
|
+
if (mode === 'duplicate' && !this.duplicateInitialized && newKey) {
|
|
15959
|
+
newKey = `${newKey}-duplicate`;
|
|
15960
|
+
this.duplicateInitialized = true;
|
|
15961
|
+
}
|
|
15962
|
+
this.setValue(newKey);
|
|
15963
|
+
this.onChange(newKey);
|
|
15964
|
+
}
|
|
15965
|
+
getUniqueKeyWithNumber(base, usedKeys, suffix = 1) {
|
|
15966
|
+
const newKey = `${base}-${suffix}`;
|
|
15967
|
+
if (usedKeys.includes(newKey)) {
|
|
15968
|
+
return this.getUniqueKeyWithNumber(base, usedKeys, suffix + 1);
|
|
15969
|
+
}
|
|
15970
|
+
return newKey;
|
|
15971
|
+
}
|
|
15972
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoKeyInputComponent, deps: [{ token: i2$3.IconService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15973
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: AutoKeyInputComponent, isStandalone: true, selector: "valtimo-auto-key-input", inputs: { labelTranslationKey: "labelTranslationKey", placeholderTranslationKey: "placeholderTranslationKey", dataTestId: "dataTestId", name: "name", disabled: "disabled", defaultValue: "defaultValue", margin: "margin", mode: "mode", usedKeys: "usedKeys", sourceText: "sourceText" }, host: { properties: { "class.auto-key-input--margin": "this.margin" } }, providers: [
|
|
15974
|
+
{
|
|
15975
|
+
provide: NG_VALUE_ACCESSOR,
|
|
15976
|
+
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
15977
|
+
multi: true,
|
|
15978
|
+
},
|
|
15979
|
+
{
|
|
15980
|
+
provide: NG_VALIDATORS,
|
|
15981
|
+
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
15982
|
+
multi: true,
|
|
15983
|
+
},
|
|
15984
|
+
], usesOnChanges: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2026 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<cds-label\n *ngIf=\"{\n mode: mode$ | async,\n idError: idError$ | async,\n editingKey: editingKey$ | async,\n } as obs\"\n [invalid]=\"!!obs.idError\"\n [invalidText]=\"obs.idError | translate\"\n>\n <span class=\"auto-key-label\">\n {{ labelTranslationKey | translate }}\n\n <ng-content></ng-content>\n </span>\n\n <div class=\"edit-key-input\">\n <input\n cdsText\n type=\"text\"\n [value]=\"value\"\n [placeholder]=\"\n obs.mode === 'add' && !obs.editingKey\n ? ('caseManagement.statuses.keyAutoGenerated' | translate)\n : (placeholderTranslationKey | translate)\n \"\n [readOnly]=\"!obs.editingKey || obs.mode === 'edit'\"\n [invalid]=\"!!obs.idError\"\n [attr.data-test-id]=\"dataTestId\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onTouched()\"\n />\n\n <cds-icon-button\n *ngIf=\"(obs.mode === 'add' || obs.mode === 'duplicate') && !obs.editingKey\"\n [disabled]=\"$disabled()\"\n [attr.data-test-id]=\"testIds.editButton\"\n (click)=\"enableKeyEditing()\"\n kind=\"secondary\"\n size=\"md\"\n >\n <svg cdsIcon=\"edit\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n\n <cds-icon-button\n *ngIf=\"obs.mode === 'add' && obs.editingKey\"\n [disabled]=\"$disabled()\"\n (click)=\"disableKeyEditing()\"\n kind=\"secondary\"\n size=\"md\"\n >\n <svg cdsIcon=\"close\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n </div>\n</cds-label>\n", styles: [".auto-key-label{display:flex;align-items:center}:host(.auto-key-input--margin){display:block;margin-block-end:var(--v-input-margin)}.edit-key-input{display:flex;align-items:center;gap:8px;width:100%}.edit-key-input input[cdsText]{flex:1 1 auto}.edit-key-input cds-icon-button{flex-shrink:0;margin-left:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: InputModule$1 }, { kind: "component", type: i2$3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i2$3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2$3.IconButton, selector: "cds-icon-button, ibm-icon-button", inputs: ["buttonNgClass", "buttonAttributes", "buttonId", "kind", "size", "type", "isExpressive", "disabled", "description", "showTooltipWhenDisabled"], outputs: ["click", "focus", "blur", "tooltipClick"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i2$3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
15985
|
+
}
|
|
15986
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoKeyInputComponent, decorators: [{
|
|
15987
|
+
type: Component,
|
|
15988
|
+
args: [{ selector: 'valtimo-auto-key-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
15989
|
+
CommonModule,
|
|
15990
|
+
ReactiveFormsModule,
|
|
15991
|
+
TranslateModule,
|
|
15992
|
+
InputModule$1,
|
|
15993
|
+
ButtonModule,
|
|
15994
|
+
IconModule,
|
|
15995
|
+
], providers: [
|
|
15996
|
+
{
|
|
15997
|
+
provide: NG_VALUE_ACCESSOR,
|
|
15998
|
+
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
15999
|
+
multi: true,
|
|
16000
|
+
},
|
|
16001
|
+
{
|
|
16002
|
+
provide: NG_VALIDATORS,
|
|
16003
|
+
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
16004
|
+
multi: true,
|
|
16005
|
+
},
|
|
16006
|
+
], template: "<!--\n ~ Copyright 2015-2026 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<cds-label\n *ngIf=\"{\n mode: mode$ | async,\n idError: idError$ | async,\n editingKey: editingKey$ | async,\n } as obs\"\n [invalid]=\"!!obs.idError\"\n [invalidText]=\"obs.idError | translate\"\n>\n <span class=\"auto-key-label\">\n {{ labelTranslationKey | translate }}\n\n <ng-content></ng-content>\n </span>\n\n <div class=\"edit-key-input\">\n <input\n cdsText\n type=\"text\"\n [value]=\"value\"\n [placeholder]=\"\n obs.mode === 'add' && !obs.editingKey\n ? ('caseManagement.statuses.keyAutoGenerated' | translate)\n : (placeholderTranslationKey | translate)\n \"\n [readOnly]=\"!obs.editingKey || obs.mode === 'edit'\"\n [invalid]=\"!!obs.idError\"\n [attr.data-test-id]=\"dataTestId\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onTouched()\"\n />\n\n <cds-icon-button\n *ngIf=\"(obs.mode === 'add' || obs.mode === 'duplicate') && !obs.editingKey\"\n [disabled]=\"$disabled()\"\n [attr.data-test-id]=\"testIds.editButton\"\n (click)=\"enableKeyEditing()\"\n kind=\"secondary\"\n size=\"md\"\n >\n <svg cdsIcon=\"edit\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n\n <cds-icon-button\n *ngIf=\"obs.mode === 'add' && obs.editingKey\"\n [disabled]=\"$disabled()\"\n (click)=\"disableKeyEditing()\"\n kind=\"secondary\"\n size=\"md\"\n >\n <svg cdsIcon=\"close\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n </div>\n</cds-label>\n", styles: [".auto-key-label{display:flex;align-items:center}:host(.auto-key-input--margin){display:block;margin-block-end:var(--v-input-margin)}.edit-key-input{display:flex;align-items:center;gap:8px;width:100%}.edit-key-input input[cdsText]{flex:1 1 auto}.edit-key-input cds-icon-button{flex-shrink:0;margin-left:4px}\n"] }]
|
|
16007
|
+
}], ctorParameters: () => [{ type: i2$3.IconService }], propDecorators: { labelTranslationKey: [{
|
|
16008
|
+
type: Input
|
|
16009
|
+
}], placeholderTranslationKey: [{
|
|
16010
|
+
type: Input
|
|
16011
|
+
}], dataTestId: [{
|
|
16012
|
+
type: Input
|
|
16013
|
+
}], name: [{
|
|
16014
|
+
type: Input
|
|
16015
|
+
}], disabled: [{
|
|
16016
|
+
type: Input
|
|
16017
|
+
}], defaultValue: [{
|
|
16018
|
+
type: Input
|
|
16019
|
+
}], margin: [{
|
|
16020
|
+
type: HostBinding,
|
|
16021
|
+
args: ['class.auto-key-input--margin']
|
|
16022
|
+
}, {
|
|
16023
|
+
type: Input
|
|
16024
|
+
}], mode: [{
|
|
16025
|
+
type: Input
|
|
16026
|
+
}], usedKeys: [{
|
|
16027
|
+
type: Input
|
|
16028
|
+
}], sourceText: [{
|
|
16029
|
+
type: Input
|
|
16030
|
+
}] } });
|
|
16031
|
+
|
|
15809
16032
|
/*
|
|
15810
16033
|
* Copyright 2015-2025 Ritense BV, the Netherlands.
|
|
15811
16034
|
*
|
|
@@ -15846,6 +16069,7 @@ class FormComponent {
|
|
|
15846
16069
|
...this.multiInputFormComponents?.toArray(),
|
|
15847
16070
|
...this.radioComponents?.toArray(),
|
|
15848
16071
|
...this.valuePathSelectorComponents?.toArray(),
|
|
16072
|
+
...this.autoKeyInputComponents?.toArray(),
|
|
15849
16073
|
];
|
|
15850
16074
|
this.componentValuesSubscription = combineLatest(valueComponents.map(component => {
|
|
15851
16075
|
const inputComponent = component;
|
|
@@ -15902,13 +16126,14 @@ class FormComponent {
|
|
|
15902
16126
|
this.multiInputFormComponents.changes.pipe(startWith(null)),
|
|
15903
16127
|
this.radioComponents.changes.pipe(startWith(null)),
|
|
15904
16128
|
this.valuePathSelectorComponents.changes.pipe(startWith(null)),
|
|
16129
|
+
this.autoKeyInputComponents.changes.pipe(startWith(null)),
|
|
15905
16130
|
]).subscribe(() => {
|
|
15906
16131
|
this.closeComponentValuesSubscription();
|
|
15907
16132
|
this.openComponentValuesSubscription();
|
|
15908
16133
|
});
|
|
15909
16134
|
}
|
|
15910
16135
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15911
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormComponent, isStandalone: false, selector: "v-form", inputs: { className: "className" }, outputs: { valueChange: "valueChange" }, queries: [{ propertyName: "inputComponents", predicate: InputComponent }, { propertyName: "selectComponents", predicate: SelectComponent }, { propertyName: "multiInputComponents", predicate: CarbonMultiInputComponent }, { propertyName: "datePickerComponents", predicate: DatePickerComponent }, { propertyName: "multiInputFormComponents", predicate: MultiInputFormComponent }, { propertyName: "radioComponents", predicate: RadioComponent }, { propertyName: "valuePathSelectorComponents", predicate: ValuePathSelectorComponent }], 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<form [ngClass]=\"'v-form ' + className\" onsubmit=\"return false;\">\n <ng-content></ng-content>\n</form>\n", styles: [".v-form{display:flex;flex-direction:column}\n/*!\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"], dependencies: [{ kind: "directive", type: i1$4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
16136
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: FormComponent, isStandalone: false, selector: "v-form", inputs: { className: "className" }, outputs: { valueChange: "valueChange" }, queries: [{ propertyName: "inputComponents", predicate: InputComponent }, { propertyName: "selectComponents", predicate: SelectComponent }, { propertyName: "multiInputComponents", predicate: CarbonMultiInputComponent }, { propertyName: "datePickerComponents", predicate: DatePickerComponent }, { propertyName: "multiInputFormComponents", predicate: MultiInputFormComponent }, { propertyName: "radioComponents", predicate: RadioComponent }, { propertyName: "valuePathSelectorComponents", predicate: ValuePathSelectorComponent }, { propertyName: "autoKeyInputComponents", predicate: AutoKeyInputComponent }], 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<form [ngClass]=\"'v-form ' + className\" onsubmit=\"return false;\">\n <ng-content></ng-content>\n</form>\n", styles: [".v-form{display:flex;flex-direction:column}\n/*!\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"], dependencies: [{ kind: "directive", type: i1$4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
15912
16137
|
}
|
|
15913
16138
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: FormComponent, decorators: [{
|
|
15914
16139
|
type: Component,
|
|
@@ -15934,6 +16159,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
15934
16159
|
}], valuePathSelectorComponents: [{
|
|
15935
16160
|
type: ContentChildren,
|
|
15936
16161
|
args: [ValuePathSelectorComponent]
|
|
16162
|
+
}], autoKeyInputComponents: [{
|
|
16163
|
+
type: ContentChildren,
|
|
16164
|
+
args: [AutoKeyInputComponent]
|
|
15937
16165
|
}], className: [{
|
|
15938
16166
|
type: Input
|
|
15939
16167
|
}], valueChange: [{
|
|
@@ -18698,186 +18926,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
18698
18926
|
type: Output
|
|
18699
18927
|
}] } });
|
|
18700
18928
|
|
|
18701
|
-
/*
|
|
18702
|
-
* Copyright 2015-2026 Ritense BV, the Netherlands.
|
|
18703
|
-
*
|
|
18704
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
18705
|
-
* you may not use this file except in compliance with the License.
|
|
18706
|
-
* You may obtain a copy of the License at
|
|
18707
|
-
*
|
|
18708
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
18709
|
-
*
|
|
18710
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18711
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
18712
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18713
|
-
* See the License for the specific language governing permissions and
|
|
18714
|
-
* limitations under the License.
|
|
18715
|
-
*/
|
|
18716
|
-
class AutoKeyInputComponent {
|
|
18717
|
-
set mode(value) {
|
|
18718
|
-
this._mode$.next(value);
|
|
18719
|
-
}
|
|
18720
|
-
get mode$() {
|
|
18721
|
-
return this._mode$.pipe(filter(mode => !!mode));
|
|
18722
|
-
}
|
|
18723
|
-
set usedKeys(value) {
|
|
18724
|
-
this._usedKeys$.next(value || []);
|
|
18725
|
-
}
|
|
18726
|
-
set sourceText(value) {
|
|
18727
|
-
this._sourceText$.next(value || '');
|
|
18728
|
-
}
|
|
18729
|
-
constructor(iconService) {
|
|
18730
|
-
this.iconService = iconService;
|
|
18731
|
-
this.labelTranslationKey = 'Key';
|
|
18732
|
-
this.placeholderTranslationKey = '';
|
|
18733
|
-
this.testIds = AUTO_KEY_INPUT_TEST_IDS;
|
|
18734
|
-
this._mode$ = new BehaviorSubject(null);
|
|
18735
|
-
this._usedKeys$ = new BehaviorSubject([]);
|
|
18736
|
-
this._sourceText$ = new BehaviorSubject('');
|
|
18737
|
-
this.$disabled = signal(false);
|
|
18738
|
-
this.value = '';
|
|
18739
|
-
this.editingKey$ = new BehaviorSubject(true);
|
|
18740
|
-
this.duplicateInitialized = false;
|
|
18741
|
-
this.idError$ = new BehaviorSubject(null);
|
|
18742
|
-
this.onChange = (_) => { };
|
|
18743
|
-
this.onTouched = () => { };
|
|
18744
|
-
this.onValidatorChange = () => { };
|
|
18745
|
-
this.validate = (control) => this.idError$.getValue() ? { idError: { value: this.idError$.getValue() } } : null;
|
|
18746
|
-
this.subscription = new Subscription();
|
|
18747
|
-
this.iconService.registerAll([Edit16, Close16]);
|
|
18748
|
-
this.subscription.add(this.mode$.subscribe(mode => {
|
|
18749
|
-
this.editingKey$.next(mode === 'edit');
|
|
18750
|
-
if (mode === 'duplicate') {
|
|
18751
|
-
this.duplicateInitialized = false;
|
|
18752
|
-
}
|
|
18753
|
-
}));
|
|
18754
|
-
this.subscription.add(combineLatest([this.mode$, this.editingKey$, this._usedKeys$, this._sourceText$]).subscribe(([mode, editingKey, usedKeys, sourceText]) => {
|
|
18755
|
-
if (mode === 'add' || mode === 'duplicate') {
|
|
18756
|
-
this.updateKey(mode, editingKey, usedKeys, sourceText);
|
|
18757
|
-
}
|
|
18758
|
-
}));
|
|
18759
|
-
}
|
|
18760
|
-
ngOnChanges() {
|
|
18761
|
-
this.onValidatorChange();
|
|
18762
|
-
}
|
|
18763
|
-
ngOnDestroy() {
|
|
18764
|
-
this.subscription.unsubscribe();
|
|
18765
|
-
this.duplicateInitialized = false;
|
|
18766
|
-
this.idError$.next(null);
|
|
18767
|
-
}
|
|
18768
|
-
setDisabledState(disabled) {
|
|
18769
|
-
this.$disabled.set(disabled);
|
|
18770
|
-
}
|
|
18771
|
-
writeValue(value) {
|
|
18772
|
-
if (value === null || value === '') {
|
|
18773
|
-
this.resetInternalState();
|
|
18774
|
-
return;
|
|
18775
|
-
}
|
|
18776
|
-
this.value = value ?? '';
|
|
18777
|
-
}
|
|
18778
|
-
registerOnChange(fn) {
|
|
18779
|
-
this.onChange = fn;
|
|
18780
|
-
}
|
|
18781
|
-
registerOnTouched(fn) {
|
|
18782
|
-
this.onTouched = fn;
|
|
18783
|
-
}
|
|
18784
|
-
registerOnValidatorChange(fn) {
|
|
18785
|
-
this.onValidatorChange = fn;
|
|
18786
|
-
}
|
|
18787
|
-
onInputChange(event) {
|
|
18788
|
-
const usedKeys = this._usedKeys$.getValue();
|
|
18789
|
-
this.idError$.next(usedKeys.includes(event.target.value) ? 'caseManagement.statuses.keyDuplicated' : null);
|
|
18790
|
-
this.onChange((this.value = event.target.value));
|
|
18791
|
-
}
|
|
18792
|
-
enableKeyEditing() {
|
|
18793
|
-
this.editingKey$.next(true);
|
|
18794
|
-
}
|
|
18795
|
-
disableKeyEditing() {
|
|
18796
|
-
this.editingKey$.next(false);
|
|
18797
|
-
}
|
|
18798
|
-
getUniqueKey(sourceText, usedKeys) {
|
|
18799
|
-
const baseKey = sourceText
|
|
18800
|
-
.toLowerCase()
|
|
18801
|
-
.replace(/[^a-z0-9-_]+|-[^a-z0-9]+/g, '-')
|
|
18802
|
-
.replace(/_[-_]+/g, '_')
|
|
18803
|
-
.replace(/^[^a-z]+/g, '');
|
|
18804
|
-
if (!usedKeys.includes(baseKey) || this._mode$.getValue() === 'edit') {
|
|
18805
|
-
return baseKey;
|
|
18806
|
-
}
|
|
18807
|
-
return this.getUniqueKeyWithNumber(baseKey, usedKeys);
|
|
18808
|
-
}
|
|
18809
|
-
resetInternalState() {
|
|
18810
|
-
this.value = '';
|
|
18811
|
-
this.idError$.next(null);
|
|
18812
|
-
this.disableKeyEditing();
|
|
18813
|
-
this.duplicateInitialized = false;
|
|
18814
|
-
}
|
|
18815
|
-
updateKey(mode, editingKey, usedKeys, sourceText) {
|
|
18816
|
-
if (editingKey) {
|
|
18817
|
-
return;
|
|
18818
|
-
}
|
|
18819
|
-
let newKey = sourceText ? this.getUniqueKey(sourceText, usedKeys) : '';
|
|
18820
|
-
if (mode === 'duplicate' && !this.duplicateInitialized && newKey) {
|
|
18821
|
-
newKey = `${newKey}-duplicate`;
|
|
18822
|
-
this.duplicateInitialized = true;
|
|
18823
|
-
}
|
|
18824
|
-
this.value = newKey;
|
|
18825
|
-
this.onChange(newKey);
|
|
18826
|
-
}
|
|
18827
|
-
getUniqueKeyWithNumber(base, usedKeys, suffix = 1) {
|
|
18828
|
-
const newKey = `${base}-${suffix}`;
|
|
18829
|
-
if (usedKeys.includes(newKey)) {
|
|
18830
|
-
return this.getUniqueKeyWithNumber(base, usedKeys, suffix + 1);
|
|
18831
|
-
}
|
|
18832
|
-
return newKey;
|
|
18833
|
-
}
|
|
18834
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoKeyInputComponent, deps: [{ token: i2$3.IconService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18835
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: AutoKeyInputComponent, isStandalone: true, selector: "valtimo-auto-key-input", inputs: { labelTranslationKey: "labelTranslationKey", placeholderTranslationKey: "placeholderTranslationKey", mode: "mode", usedKeys: "usedKeys", sourceText: "sourceText" }, providers: [
|
|
18836
|
-
{
|
|
18837
|
-
provide: NG_VALUE_ACCESSOR,
|
|
18838
|
-
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
18839
|
-
multi: true,
|
|
18840
|
-
},
|
|
18841
|
-
{
|
|
18842
|
-
provide: NG_VALIDATORS,
|
|
18843
|
-
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
18844
|
-
multi: true,
|
|
18845
|
-
},
|
|
18846
|
-
], usesOnChanges: true, ngImport: i0, template: "<!--\n ~ Copyright 2015-2026 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<cds-label\n *ngIf=\"{\n mode: mode$ | async,\n idError: idError$ | async,\n editingKey: editingKey$ | async,\n } as obs\"\n [invalid]=\"!!obs.idError\"\n [invalidText]=\"obs.idError | translate\"\n>\n {{ labelTranslationKey | translate }}\n\n <div class=\"edit-key-input\">\n <input\n cdsText\n type=\"text\"\n [value]=\"value\"\n [placeholder]=\"\n obs.mode === 'add' && !obs.editingKey\n ? ('caseManagement.statuses.keyAutoGenerated' | translate)\n : (placeholderTranslationKey | translate)\n \"\n [readOnly]=\"!obs.editingKey || obs.mode === 'edit'\"\n [invalid]=\"!!obs.idError\"\n [attr.data-test-id]=\"testIds.input\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onTouched()\"\n />\n\n <cds-icon-button\n *ngIf=\"(obs.mode === 'add' || obs.mode === 'duplicate') && !obs.editingKey\"\n [disabled]=\"$disabled()\"\n [attr.data-test-id]=\"testIds.editButton\"\n (click)=\"enableKeyEditing()\"\n kind=\"secondary\"\n >\n <svg cdsIcon=\"edit\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n\n <cds-icon-button\n *ngIf=\"obs.mode === 'add' && obs.editingKey\"\n [disabled]=\"$disabled()\"\n (click)=\"disableKeyEditing()\"\n kind=\"secondary\"\n >\n <svg cdsIcon=\"close\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n </div>\n</cds-label>\n", styles: [".edit-key-input{display:flex;align-items:center;gap:8px;width:100%}.edit-key-input input[cdsText]{flex:1 1 auto}.edit-key-input cds-icon-button{flex-shrink:0;margin-left:4px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1$4.AsyncPipe, name: "async" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "ngmodule", type: InputModule$1 }, { kind: "component", type: i2$3.Label, selector: "cds-label, ibm-label", inputs: ["labelInputID", "disabled", "skeleton", "helperText", "invalidText", "invalid", "warn", "warnText", "ariaLabel"] }, { kind: "directive", type: i2$3.TextInput, selector: "[cdsText], [ibmText]", inputs: ["theme", "size", "invalid", "warn", "skeleton"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2$3.IconButton, selector: "cds-icon-button, ibm-icon-button", inputs: ["buttonNgClass", "buttonAttributes", "buttonId", "kind", "size", "type", "isExpressive", "disabled", "description", "showTooltipWhenDisabled"], outputs: ["click", "focus", "blur", "tooltipClick"] }, { kind: "ngmodule", type: IconModule }, { kind: "directive", type: i2$3.IconDirective, selector: "[cdsIcon], [ibmIcon]", inputs: ["ibmIcon", "cdsIcon", "size", "title", "ariaLabel", "ariaLabelledBy", "ariaHidden", "isFocusable"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
18847
|
-
}
|
|
18848
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: AutoKeyInputComponent, decorators: [{
|
|
18849
|
-
type: Component,
|
|
18850
|
-
args: [{ selector: 'valtimo-auto-key-input', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
18851
|
-
CommonModule,
|
|
18852
|
-
ReactiveFormsModule,
|
|
18853
|
-
TranslateModule,
|
|
18854
|
-
InputModule$1,
|
|
18855
|
-
ButtonModule,
|
|
18856
|
-
IconModule,
|
|
18857
|
-
], providers: [
|
|
18858
|
-
{
|
|
18859
|
-
provide: NG_VALUE_ACCESSOR,
|
|
18860
|
-
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
18861
|
-
multi: true,
|
|
18862
|
-
},
|
|
18863
|
-
{
|
|
18864
|
-
provide: NG_VALIDATORS,
|
|
18865
|
-
useExisting: forwardRef(() => AutoKeyInputComponent),
|
|
18866
|
-
multi: true,
|
|
18867
|
-
},
|
|
18868
|
-
], template: "<!--\n ~ Copyright 2015-2026 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<cds-label\n *ngIf=\"{\n mode: mode$ | async,\n idError: idError$ | async,\n editingKey: editingKey$ | async,\n } as obs\"\n [invalid]=\"!!obs.idError\"\n [invalidText]=\"obs.idError | translate\"\n>\n {{ labelTranslationKey | translate }}\n\n <div class=\"edit-key-input\">\n <input\n cdsText\n type=\"text\"\n [value]=\"value\"\n [placeholder]=\"\n obs.mode === 'add' && !obs.editingKey\n ? ('caseManagement.statuses.keyAutoGenerated' | translate)\n : (placeholderTranslationKey | translate)\n \"\n [readOnly]=\"!obs.editingKey || obs.mode === 'edit'\"\n [invalid]=\"!!obs.idError\"\n [attr.data-test-id]=\"testIds.input\"\n (input)=\"onInputChange($event)\"\n (blur)=\"onTouched()\"\n />\n\n <cds-icon-button\n *ngIf=\"(obs.mode === 'add' || obs.mode === 'duplicate') && !obs.editingKey\"\n [disabled]=\"$disabled()\"\n [attr.data-test-id]=\"testIds.editButton\"\n (click)=\"enableKeyEditing()\"\n kind=\"secondary\"\n >\n <svg cdsIcon=\"edit\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n\n <cds-icon-button\n *ngIf=\"obs.mode === 'add' && obs.editingKey\"\n [disabled]=\"$disabled()\"\n (click)=\"disableKeyEditing()\"\n kind=\"secondary\"\n >\n <svg cdsIcon=\"close\" size=\"16\" class=\"cds--btn__icon\"></svg>\n </cds-icon-button>\n </div>\n</cds-label>\n", styles: [".edit-key-input{display:flex;align-items:center;gap:8px;width:100%}.edit-key-input input[cdsText]{flex:1 1 auto}.edit-key-input cds-icon-button{flex-shrink:0;margin-left:4px}\n"] }]
|
|
18869
|
-
}], ctorParameters: () => [{ type: i2$3.IconService }], propDecorators: { labelTranslationKey: [{
|
|
18870
|
-
type: Input
|
|
18871
|
-
}], placeholderTranslationKey: [{
|
|
18872
|
-
type: Input
|
|
18873
|
-
}], mode: [{
|
|
18874
|
-
type: Input
|
|
18875
|
-
}], usedKeys: [{
|
|
18876
|
-
type: Input
|
|
18877
|
-
}], sourceText: [{
|
|
18878
|
-
type: Input
|
|
18879
|
-
}] } });
|
|
18880
|
-
|
|
18881
18929
|
/*
|
|
18882
18930
|
* Copyright 2015-2025 Ritense BV, the Netherlands.
|
|
18883
18931
|
*
|