@kms-ngx-ui/presentational 20.3.4 → 20.4.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.
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Pipe, NgModule, EventEmitter, Output, Input, Directive, HostListener, PLATFORM_ID, DOCUMENT, Inject, Injectable, input, VERSION, forwardRef, InjectionToken, inject, Injector, ViewChild, computed, HostBinding, output, signal, effect, ChangeDetectionStrategy, model, ViewContainerRef, untracked, DestroyRef, ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { Component, Pipe, NgModule, EventEmitter, Output, Input, Directive, HostListener, PLATFORM_ID, DOCUMENT, Inject, Injectable, input, VERSION, forwardRef, InjectionToken, inject, Injector, ViewChild, computed, HostBinding, output, signal, effect, ChangeDetectionStrategy, model, ChangeDetectorRef, ViewContainerRef, untracked, DestroyRef, ElementRef, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, CurrencyPipe, isPlatformBrowser, NgClass, NgStyle } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
|
-
import { NG_VALUE_ACCESSOR, NgControl,
|
|
6
|
+
import { FormControl, NG_VALUE_ACCESSOR, NgControl, UntypedFormGroup, UntypedFormControl, FormGroup, ReactiveFormsModule, NG_VALIDATORS, ValueChangeEvent, FormsModule } from '@angular/forms';
|
|
7
7
|
import * as i1$2 from '@angular/material/checkbox';
|
|
8
8
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
9
9
|
import * as i1$5 from '@angular/material/radio';
|
|
@@ -54,7 +54,7 @@ import { trigger, state, style } from '@angular/animations';
|
|
|
54
54
|
import { register } from 'swiper/element/bundle';
|
|
55
55
|
import { isEmpty } from 'lodash';
|
|
56
56
|
import moment from 'moment';
|
|
57
|
-
import { takeUntil } from 'rxjs/operators';
|
|
57
|
+
import { takeUntil, filter } from 'rxjs/operators';
|
|
58
58
|
|
|
59
59
|
class KmsUiPresentationalComponent {
|
|
60
60
|
constructor() { }
|
|
@@ -1197,7 +1197,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1197
1197
|
class CheckboxComponent {
|
|
1198
1198
|
constructor() {
|
|
1199
1199
|
this.infoText = '';
|
|
1200
|
-
this.checked = false;
|
|
1201
1200
|
this.disabled = false;
|
|
1202
1201
|
/**
|
|
1203
1202
|
* Internal description name. All checkboxes with the same name belong to the same group.
|
|
@@ -1205,17 +1204,24 @@ class CheckboxComponent {
|
|
|
1205
1204
|
*/
|
|
1206
1205
|
this.name = '';
|
|
1207
1206
|
this.change = new EventEmitter();
|
|
1207
|
+
this.innerControl = new FormControl(false);
|
|
1208
1208
|
this.onChange = () => { };
|
|
1209
1209
|
this.onTouched = () => { };
|
|
1210
1210
|
}
|
|
1211
|
+
set checked(value) {
|
|
1212
|
+
this.innerControl.setValue(value, { emitEvent: false });
|
|
1213
|
+
}
|
|
1214
|
+
get checked() {
|
|
1215
|
+
return this.innerControl.value ?? false;
|
|
1216
|
+
}
|
|
1211
1217
|
valueChanged(value) {
|
|
1212
1218
|
this.onChange(value);
|
|
1213
|
-
this.
|
|
1219
|
+
this.innerControl.setValue(value, { emitEvent: false });
|
|
1214
1220
|
this.change.emit(value);
|
|
1215
1221
|
this.onTouched();
|
|
1216
1222
|
}
|
|
1217
1223
|
writeValue(value) {
|
|
1218
|
-
this.
|
|
1224
|
+
this.innerControl.setValue(value ?? false, { emitEvent: false });
|
|
1219
1225
|
}
|
|
1220
1226
|
registerOnChange(fn) {
|
|
1221
1227
|
this.onChange = fn;
|
|
@@ -1223,6 +1229,14 @@ class CheckboxComponent {
|
|
|
1223
1229
|
registerOnTouched(fn) {
|
|
1224
1230
|
this.onTouched = fn;
|
|
1225
1231
|
}
|
|
1232
|
+
setDisabledState(isDisabled) {
|
|
1233
|
+
if (isDisabled) {
|
|
1234
|
+
this.innerControl.disable({ emitEvent: false });
|
|
1235
|
+
}
|
|
1236
|
+
else {
|
|
1237
|
+
this.innerControl.enable({ emitEvent: false });
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1226
1240
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1227
1241
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.16", type: CheckboxComponent, isStandalone: false, selector: "kms-checkbox", inputs: { infoText: "infoText", checked: "checked", disabled: "disabled", name: "name" }, outputs: { change: "change" }, providers: [
|
|
1228
1242
|
{
|
|
@@ -1230,7 +1244,7 @@ class CheckboxComponent {
|
|
|
1230
1244
|
useExisting: forwardRef(() => CheckboxComponent),
|
|
1231
1245
|
multi: true,
|
|
1232
1246
|
},
|
|
1233
|
-
], ngImport: i0, template: "<div class=\"checkbox-container\" [class.disabled]=\"disabled\">\n <mat-checkbox\n [disabled]=\"disabled\"\n [name]=\"name\"\n [
|
|
1247
|
+
], ngImport: i0, template: "<div class=\"checkbox-container\" [class.disabled]=\"disabled\">\n <mat-checkbox\n [disabled]=\"disabled\"\n [name]=\"name\"\n [formControl]=\"innerControl\"\n (change)=\"valueChanged($event.checked)\"\n color=\"primary\"\n >\n <span [innerHTML]=\"infoText | kmsSafeHtml\"></span>\n </mat-checkbox>\n</div>\n", styles: [""], dependencies: [{ kind: "component", type: i1$2.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: SafeHtmlPipe, name: "kmsSafeHtml" }] }); }
|
|
1234
1248
|
}
|
|
1235
1249
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
1236
1250
|
type: Component,
|
|
@@ -1240,7 +1254,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
1240
1254
|
useExisting: forwardRef(() => CheckboxComponent),
|
|
1241
1255
|
multi: true,
|
|
1242
1256
|
},
|
|
1243
|
-
], standalone: false, template: "<div class=\"checkbox-container\" [class.disabled]=\"disabled\">\n <mat-checkbox\n [disabled]=\"disabled\"\n [name]=\"name\"\n [
|
|
1257
|
+
], standalone: false, template: "<div class=\"checkbox-container\" [class.disabled]=\"disabled\">\n <mat-checkbox\n [disabled]=\"disabled\"\n [name]=\"name\"\n [formControl]=\"innerControl\"\n (change)=\"valueChanged($event.checked)\"\n color=\"primary\"\n >\n <span [innerHTML]=\"infoText | kmsSafeHtml\"></span>\n </mat-checkbox>\n</div>\n" }]
|
|
1244
1258
|
}], propDecorators: { infoText: [{
|
|
1245
1259
|
type: Input
|
|
1246
1260
|
}], checked: [{
|
|
@@ -2537,6 +2551,168 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
2537
2551
|
type: Output
|
|
2538
2552
|
}] } });
|
|
2539
2553
|
|
|
2554
|
+
const DEFAULT_MAX_SIZE_BYTES = 2097152; // 2MB
|
|
2555
|
+
class ImageUploadComponent {
|
|
2556
|
+
constructor(cd) {
|
|
2557
|
+
this.cd = cd;
|
|
2558
|
+
this.label = 'Upload';
|
|
2559
|
+
this.icon = 'ic_edit';
|
|
2560
|
+
this.accept = 'image/jpeg, image/jpg, image/png';
|
|
2561
|
+
this.maxSizeBytes = DEFAULT_MAX_SIZE_BYTES;
|
|
2562
|
+
this.resizePixels = 0;
|
|
2563
|
+
this.imagePosition = 'top';
|
|
2564
|
+
this.imageMaxHeight = '128px';
|
|
2565
|
+
this.removeLabel = '';
|
|
2566
|
+
this.removeIcon = 'trash';
|
|
2567
|
+
this.disabled = false;
|
|
2568
|
+
this.ButtonAppearance = ButtonAppearance;
|
|
2569
|
+
this.IconSizePx = IconSizePx;
|
|
2570
|
+
this.imageValue = null;
|
|
2571
|
+
this.onChange = () => { };
|
|
2572
|
+
this.onTouched = () => { };
|
|
2573
|
+
}
|
|
2574
|
+
get hasImage() {
|
|
2575
|
+
return !!(this.imageValue?.ImageLink || this.imageValue?.ImageAsDataURL);
|
|
2576
|
+
}
|
|
2577
|
+
get imageSrc() {
|
|
2578
|
+
return this.imageValue?.ImageAsDataURL || this.imageValue?.ImageLink || '';
|
|
2579
|
+
}
|
|
2580
|
+
get layoutClass() {
|
|
2581
|
+
return `kms-image-upload--${this.imagePosition}`;
|
|
2582
|
+
}
|
|
2583
|
+
get actionsClass() {
|
|
2584
|
+
const isVertical = this.imagePosition === 'left' || this.imagePosition === 'right';
|
|
2585
|
+
return isVertical
|
|
2586
|
+
? 'kms-image-upload__actions--vertical'
|
|
2587
|
+
: 'kms-image-upload__actions--horizontal';
|
|
2588
|
+
}
|
|
2589
|
+
openFileDialog() {
|
|
2590
|
+
if (this.disabled)
|
|
2591
|
+
return;
|
|
2592
|
+
this.fileInput.nativeElement.click();
|
|
2593
|
+
}
|
|
2594
|
+
onFileSelected(event) {
|
|
2595
|
+
const input = event.target;
|
|
2596
|
+
const file = input.files?.[0];
|
|
2597
|
+
if (!file)
|
|
2598
|
+
return;
|
|
2599
|
+
if (file.size > this.maxSizeBytes) {
|
|
2600
|
+
this.clearInput();
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
if (this.resizePixels > 0) {
|
|
2604
|
+
const url = URL.createObjectURL(file);
|
|
2605
|
+
const img = document.createElement('img');
|
|
2606
|
+
img.addEventListener('load', () => {
|
|
2607
|
+
const dataUrl = this.resizeImage(img, this.resizePixels);
|
|
2608
|
+
URL.revokeObjectURL(url);
|
|
2609
|
+
this.setValue({
|
|
2610
|
+
Filename: file.name,
|
|
2611
|
+
ImageAsDataURL: dataUrl,
|
|
2612
|
+
ImageLink: this.imageValue?.ImageLink ?? '',
|
|
2613
|
+
ImageIdent: this.imageValue?.ImageIdent ?? '',
|
|
2614
|
+
Text: this.imageValue?.Text ?? '',
|
|
2615
|
+
});
|
|
2616
|
+
this.cd.markForCheck();
|
|
2617
|
+
});
|
|
2618
|
+
img.src = url;
|
|
2619
|
+
}
|
|
2620
|
+
else {
|
|
2621
|
+
const reader = new FileReader();
|
|
2622
|
+
reader.onload = (e) => {
|
|
2623
|
+
this.setValue({
|
|
2624
|
+
Filename: file.name,
|
|
2625
|
+
ImageAsDataURL: e.target?.result ?? '',
|
|
2626
|
+
ImageLink: this.imageValue?.ImageLink ?? '',
|
|
2627
|
+
ImageIdent: this.imageValue?.ImageIdent ?? '',
|
|
2628
|
+
Text: this.imageValue?.Text ?? '',
|
|
2629
|
+
});
|
|
2630
|
+
this.cd.markForCheck();
|
|
2631
|
+
};
|
|
2632
|
+
reader.readAsDataURL(file);
|
|
2633
|
+
}
|
|
2634
|
+
this.clearInput();
|
|
2635
|
+
}
|
|
2636
|
+
removeImage() {
|
|
2637
|
+
this.setValue(null);
|
|
2638
|
+
}
|
|
2639
|
+
// --- CVA ---
|
|
2640
|
+
writeValue(value) {
|
|
2641
|
+
this.imageValue = value;
|
|
2642
|
+
}
|
|
2643
|
+
registerOnChange(fn) {
|
|
2644
|
+
this.onChange = fn;
|
|
2645
|
+
}
|
|
2646
|
+
registerOnTouched(fn) {
|
|
2647
|
+
this.onTouched = fn;
|
|
2648
|
+
}
|
|
2649
|
+
setDisabledState(isDisabled) {
|
|
2650
|
+
this.disabled = isDisabled;
|
|
2651
|
+
}
|
|
2652
|
+
// --- Private ---
|
|
2653
|
+
setValue(value) {
|
|
2654
|
+
this.imageValue = value;
|
|
2655
|
+
this.onChange(value);
|
|
2656
|
+
this.onTouched();
|
|
2657
|
+
}
|
|
2658
|
+
clearInput() {
|
|
2659
|
+
if (this.fileInput) {
|
|
2660
|
+
this.fileInput.nativeElement.value = '';
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
resizeImage(imgEl, wantedWidth) {
|
|
2664
|
+
const canvas = document.createElement('canvas');
|
|
2665
|
+
const ctx = canvas.getContext('2d');
|
|
2666
|
+
const aspect = imgEl.width / imgEl.height;
|
|
2667
|
+
canvas.width = wantedWidth;
|
|
2668
|
+
canvas.height = wantedWidth / aspect;
|
|
2669
|
+
if (isValue(ctx))
|
|
2670
|
+
ctx.drawImage(imgEl, 0, 0, canvas.width, canvas.height);
|
|
2671
|
+
return canvas.toDataURL();
|
|
2672
|
+
}
|
|
2673
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageUploadComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2674
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ImageUploadComponent, isStandalone: false, selector: "kms-image-upload", inputs: { label: "label", icon: "icon", accept: "accept", maxSizeBytes: "maxSizeBytes", resizePixels: "resizePixels", imagePosition: "imagePosition", imageMaxHeight: "imageMaxHeight", removeLabel: "removeLabel", removeIcon: "removeIcon", disabled: "disabled" }, providers: [
|
|
2675
|
+
{
|
|
2676
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2677
|
+
useExisting: forwardRef(() => ImageUploadComponent),
|
|
2678
|
+
multi: true,
|
|
2679
|
+
},
|
|
2680
|
+
], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], ngImport: i0, template: "<div class=\"kms-image-upload\" [ngClass]=\"layoutClass\">\n @if (hasImage) {\n <img\n class=\"kms-image-upload__image\"\n [src]=\"imageSrc\"\n [style.max-height]=\"imageMaxHeight\"\n [attr.alt]=\"imageValue?.Filename || 'Uploaded image'\"\n />\n }\n\n <div class=\"kms-image-upload__actions\" [ngClass]=\"actionsClass\">\n <kms-button\n [appearance]=\"ButtonAppearance.BASIC\"\n [icon]=\"icon\"\n [label]=\"label\"\n [disabled]=\"disabled\"\n (buttonClick)=\"openFileDialog()\"\n ></kms-button>\n\n @if (hasImage && !disabled) {\n <kms-button\n [appearance]=\"ButtonAppearance.BASIC\"\n [icon]=\"removeIcon\"\n [label]=\"removeLabel\"\n (buttonClick)=\"removeImage()\"\n ></kms-button>\n }\n </div>\n\n <input\n type=\"file\"\n [accept]=\"accept\"\n style=\"display: none\"\n #fileInput\n (change)=\"onFileSelected($event)\"\n />\n</div>\n", styles: [":host{display:block}.kms-image-upload{display:flex;flex-direction:row;align-items:flex-start;gap:12px}.kms-image-upload--top{flex-direction:column;align-items:center}.kms-image-upload--bottom{flex-direction:column-reverse;align-items:center}.kms-image-upload--left{flex-direction:row;align-items:center}.kms-image-upload--right{flex-direction:row-reverse;align-items:center}.kms-image-upload__image{display:block;max-width:100%;object-fit:contain;border-radius:4px;border:1px solid var(--kms-tertiary-20, #e0e0e0)}.kms-image-upload__actions{display:flex;gap:4px}.kms-image-upload__actions--horizontal{flex-direction:row;align-items:center}.kms-image-upload__actions--vertical{flex-direction:column;align-items:flex-start}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ButtonComponent, selector: "kms-button", inputs: ["color", "type", "appearance", "loading", "label", "icon", "disabled", "rounded"], outputs: ["buttonClick"] }] }); }
|
|
2681
|
+
}
|
|
2682
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageUploadComponent, decorators: [{
|
|
2683
|
+
type: Component,
|
|
2684
|
+
args: [{ selector: 'kms-image-upload', providers: [
|
|
2685
|
+
{
|
|
2686
|
+
provide: NG_VALUE_ACCESSOR,
|
|
2687
|
+
useExisting: forwardRef(() => ImageUploadComponent),
|
|
2688
|
+
multi: true,
|
|
2689
|
+
},
|
|
2690
|
+
], standalone: false, template: "<div class=\"kms-image-upload\" [ngClass]=\"layoutClass\">\n @if (hasImage) {\n <img\n class=\"kms-image-upload__image\"\n [src]=\"imageSrc\"\n [style.max-height]=\"imageMaxHeight\"\n [attr.alt]=\"imageValue?.Filename || 'Uploaded image'\"\n />\n }\n\n <div class=\"kms-image-upload__actions\" [ngClass]=\"actionsClass\">\n <kms-button\n [appearance]=\"ButtonAppearance.BASIC\"\n [icon]=\"icon\"\n [label]=\"label\"\n [disabled]=\"disabled\"\n (buttonClick)=\"openFileDialog()\"\n ></kms-button>\n\n @if (hasImage && !disabled) {\n <kms-button\n [appearance]=\"ButtonAppearance.BASIC\"\n [icon]=\"removeIcon\"\n [label]=\"removeLabel\"\n (buttonClick)=\"removeImage()\"\n ></kms-button>\n }\n </div>\n\n <input\n type=\"file\"\n [accept]=\"accept\"\n style=\"display: none\"\n #fileInput\n (change)=\"onFileSelected($event)\"\n />\n</div>\n", styles: [":host{display:block}.kms-image-upload{display:flex;flex-direction:row;align-items:flex-start;gap:12px}.kms-image-upload--top{flex-direction:column;align-items:center}.kms-image-upload--bottom{flex-direction:column-reverse;align-items:center}.kms-image-upload--left{flex-direction:row;align-items:center}.kms-image-upload--right{flex-direction:row-reverse;align-items:center}.kms-image-upload__image{display:block;max-width:100%;object-fit:contain;border-radius:4px;border:1px solid var(--kms-tertiary-20, #e0e0e0)}.kms-image-upload__actions{display:flex;gap:4px}.kms-image-upload__actions--horizontal{flex-direction:row;align-items:center}.kms-image-upload__actions--vertical{flex-direction:column;align-items:flex-start}\n"] }]
|
|
2691
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { fileInput: [{
|
|
2692
|
+
type: ViewChild,
|
|
2693
|
+
args: ['fileInput']
|
|
2694
|
+
}], label: [{
|
|
2695
|
+
type: Input
|
|
2696
|
+
}], icon: [{
|
|
2697
|
+
type: Input
|
|
2698
|
+
}], accept: [{
|
|
2699
|
+
type: Input
|
|
2700
|
+
}], maxSizeBytes: [{
|
|
2701
|
+
type: Input
|
|
2702
|
+
}], resizePixels: [{
|
|
2703
|
+
type: Input
|
|
2704
|
+
}], imagePosition: [{
|
|
2705
|
+
type: Input
|
|
2706
|
+
}], imageMaxHeight: [{
|
|
2707
|
+
type: Input
|
|
2708
|
+
}], removeLabel: [{
|
|
2709
|
+
type: Input
|
|
2710
|
+
}], removeIcon: [{
|
|
2711
|
+
type: Input
|
|
2712
|
+
}], disabled: [{
|
|
2713
|
+
type: Input
|
|
2714
|
+
}] } });
|
|
2715
|
+
|
|
2540
2716
|
/**
|
|
2541
2717
|
* @copyright KMS GmbH
|
|
2542
2718
|
*/
|
|
@@ -3228,6 +3404,7 @@ class TextInputComponent {
|
|
|
3228
3404
|
this.errorStateMatcher = {
|
|
3229
3405
|
isErrorState: () => !!this.errorMessage(),
|
|
3230
3406
|
};
|
|
3407
|
+
this.cd = inject(ChangeDetectorRef);
|
|
3231
3408
|
this.onChange = () => { };
|
|
3232
3409
|
this.onTouched = () => { };
|
|
3233
3410
|
}
|
|
@@ -3247,6 +3424,7 @@ class TextInputComponent {
|
|
|
3247
3424
|
const val = value ?? '';
|
|
3248
3425
|
this.value.set(val);
|
|
3249
3426
|
this.innerControl.setValue(val, { emitEvent: false });
|
|
3427
|
+
this.cd.markForCheck();
|
|
3250
3428
|
}
|
|
3251
3429
|
registerOnChange(fn) {
|
|
3252
3430
|
this.onChange = fn;
|
|
@@ -3496,6 +3674,7 @@ var FieldType;
|
|
|
3496
3674
|
FieldType["MONTH_PICKER"] = "monthPicker";
|
|
3497
3675
|
FieldType["TEMPLATE"] = "template";
|
|
3498
3676
|
FieldType["OFFSET"] = "offset";
|
|
3677
|
+
FieldType["IMAGE_UPLOAD"] = "imageUpload";
|
|
3499
3678
|
})(FieldType || (FieldType = {}));
|
|
3500
3679
|
|
|
3501
3680
|
/** Component-scoped service managing the full internal form lifecycle. No UI. */
|
|
@@ -3758,6 +3937,7 @@ const DEFAULT_REGISTRY = new Map([
|
|
|
3758
3937
|
[FieldType.RADIO_GROUP, RadioGroupComponent],
|
|
3759
3938
|
[FieldType.SLIDE_TOGGLE, SlideToggleComponent],
|
|
3760
3939
|
[FieldType.COLOR, ColorInputComponent],
|
|
3940
|
+
[FieldType.IMAGE_UPLOAD, ImageUploadComponent],
|
|
3761
3941
|
]);
|
|
3762
3942
|
class FieldRegistryService {
|
|
3763
3943
|
constructor() {
|
|
@@ -3829,13 +4009,15 @@ class DynamicFieldDirective {
|
|
|
3829
4009
|
this.fieldTouched.emit();
|
|
3830
4010
|
});
|
|
3831
4011
|
}
|
|
3832
|
-
// Sync control → component on external value changes
|
|
3833
|
-
control.
|
|
4012
|
+
// Sync control → component on external value changes.
|
|
4013
|
+
// Uses control.events (fires even with emitEvent: false from silent patchValue)
|
|
4014
|
+
// instead of control.valueChanges (suppressed by emitEvent: false).
|
|
4015
|
+
control.events.pipe(filter((e) => e instanceof ValueChangeEvent), takeUntil$1(this.destroy$)).subscribe(() => {
|
|
3834
4016
|
if (syncing)
|
|
3835
4017
|
return;
|
|
3836
4018
|
syncing = true;
|
|
3837
4019
|
if (typeof inst.writeValue === 'function')
|
|
3838
|
-
inst.writeValue(
|
|
4020
|
+
inst.writeValue(control.value);
|
|
3839
4021
|
// Reset after microtask to cover async onChange triggers (e.g. ngModel two-way binding)
|
|
3840
4022
|
Promise.resolve().then(() => { syncing = false; });
|
|
3841
4023
|
});
|
|
@@ -3880,6 +4062,9 @@ class DynamicFieldDirective {
|
|
|
3880
4062
|
case FieldType.PASSWORD:
|
|
3881
4063
|
this.mapPassword(config, ref);
|
|
3882
4064
|
break;
|
|
4065
|
+
case FieldType.IMAGE_UPLOAD:
|
|
4066
|
+
this.mapImageUpload(config, ref);
|
|
4067
|
+
break;
|
|
3883
4068
|
default: // TIME, COLOR
|
|
3884
4069
|
this.trySetInput(ref, 'label', config.label ?? '');
|
|
3885
4070
|
break;
|
|
@@ -3976,6 +4161,26 @@ class DynamicFieldDirective {
|
|
|
3976
4161
|
if (opts?.withStrength)
|
|
3977
4162
|
ref.setInput('withStrength', true);
|
|
3978
4163
|
}
|
|
4164
|
+
mapImageUpload(config, ref) {
|
|
4165
|
+
const opts = config.options;
|
|
4166
|
+
ref.setInput('label', opts?.buttonLabel ?? config.label ?? 'Upload');
|
|
4167
|
+
if (opts?.buttonIcon)
|
|
4168
|
+
ref.setInput('icon', opts.buttonIcon);
|
|
4169
|
+
if (opts?.removeLabel !== undefined)
|
|
4170
|
+
ref.setInput('removeLabel', opts.removeLabel);
|
|
4171
|
+
if (opts?.removeIcon)
|
|
4172
|
+
ref.setInput('removeIcon', opts.removeIcon);
|
|
4173
|
+
if (opts?.accept)
|
|
4174
|
+
ref.setInput('accept', opts.accept);
|
|
4175
|
+
if (opts?.maxSizeBytes)
|
|
4176
|
+
ref.setInput('maxSizeBytes', opts.maxSizeBytes);
|
|
4177
|
+
if (opts?.resizePixels)
|
|
4178
|
+
ref.setInput('resizePixels', opts.resizePixels);
|
|
4179
|
+
if (opts?.imagePosition)
|
|
4180
|
+
ref.setInput('imagePosition', opts.imagePosition);
|
|
4181
|
+
if (opts?.imageMaxHeight)
|
|
4182
|
+
ref.setInput('imageMaxHeight', opts.imageMaxHeight);
|
|
4183
|
+
}
|
|
3979
4184
|
mapCounter(config, ref) {
|
|
3980
4185
|
this.trySetInput(ref, 'label', config.label ?? '');
|
|
3981
4186
|
const opts = config.options;
|
|
@@ -4600,6 +4805,7 @@ class KmsUiPresentationalModule {
|
|
|
4600
4805
|
DropdownFromDataComponent,
|
|
4601
4806
|
EnumRadiogroupComponent,
|
|
4602
4807
|
FileInputComponent,
|
|
4808
|
+
ImageUploadComponent,
|
|
4603
4809
|
FlyoutComponent,
|
|
4604
4810
|
ConfirmationDialogComponent,
|
|
4605
4811
|
ImageSliderComponent,
|
|
@@ -4661,6 +4867,7 @@ class KmsUiPresentationalModule {
|
|
|
4661
4867
|
EnumRadiogroupComponent,
|
|
4662
4868
|
RadioGroupComponent,
|
|
4663
4869
|
FileInputComponent,
|
|
4870
|
+
ImageUploadComponent,
|
|
4664
4871
|
FlyoutComponent,
|
|
4665
4872
|
ConfirmationDialogComponent,
|
|
4666
4873
|
IconComponent,
|
|
@@ -4727,6 +4934,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
4727
4934
|
DropdownFromDataComponent,
|
|
4728
4935
|
EnumRadiogroupComponent,
|
|
4729
4936
|
FileInputComponent,
|
|
4937
|
+
ImageUploadComponent,
|
|
4730
4938
|
FlyoutComponent,
|
|
4731
4939
|
ConfirmationDialogComponent,
|
|
4732
4940
|
ImageSliderComponent,
|
|
@@ -4794,6 +5002,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
|
|
|
4794
5002
|
EnumRadiogroupComponent,
|
|
4795
5003
|
RadioGroupComponent,
|
|
4796
5004
|
FileInputComponent,
|
|
5005
|
+
ImageUploadComponent,
|
|
4797
5006
|
FlyoutComponent,
|
|
4798
5007
|
ConfirmationDialogComponent,
|
|
4799
5008
|
IconComponent,
|
|
@@ -5003,5 +5212,5 @@ var FormLayout;
|
|
|
5003
5212
|
* Generated bundle index. Do not edit.
|
|
5004
5213
|
*/
|
|
5005
5214
|
|
|
5006
|
-
export { BackToTopComponent, Breakpoint, ButtonAppearance, ButtonComponent, ButtonResponseType, CardComponent, CheckboxComponent, Color, ColorInputComponent, ConfirmationDialogComponent, CustomPipesModule, DateInputComponent, DirectivesModule, DropdownFromDataComponent, DynamicFieldDirective, EnumRadiogroupComponent, FieldRegistryService, FieldType, FileInputComponent, FlyoutComponent, FormActionsComponent, FormFieldComponent, FormLayout, FormParentComponent, FormSectionComponent, GenericFormComponent, GenericFormModule, GenericFormService, GetMaxHeightDirective, IconComponent, IconSizePx, IconSizesArr, ImageSliderComponent, ImageSnippet, ImageSourceType, InlineAlertComponent, IntegerCurrency, KMSAccordionItemComponent, KeyValuePair, KmsUiPresentationalComponent, KmsUiPresentationalModule, KmsUiPresentationalService, LabelValuePair, LoaderComponent, MapComponent, Marker, MarkerLabel, MarkerOptions, NumericInputComponent, PasswordComponent, RadioButtonComponent, RadioButtonSize, RadioGroupComponent, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SalutationDropdownComponent, SalutationEnum, SalutationRadiogroupComponent, SanitizeNullPipe, SimpleBreakpoint, SlideToggleComponent, SliderComponent, StylingTheme, SwipeDirective, TextInputComponent, TextValuePair, TextValuePairArray, TimeDirective, TimeInputComponent, TooltipDirective, TooltipIconComponent, TrimPipe, TypeofPipe, ViewportService, WindowDimensions, YesNoRadiogroupComponent, noSpecialCharsOnly, noWhitespaceOnly };
|
|
5215
|
+
export { BackToTopComponent, Breakpoint, ButtonAppearance, ButtonComponent, ButtonResponseType, CardComponent, CheckboxComponent, Color, ColorInputComponent, ConfirmationDialogComponent, CustomPipesModule, DateInputComponent, DirectivesModule, DropdownFromDataComponent, DynamicFieldDirective, EnumRadiogroupComponent, FieldRegistryService, FieldType, FileInputComponent, FlyoutComponent, FormActionsComponent, FormFieldComponent, FormLayout, FormParentComponent, FormSectionComponent, GenericFormComponent, GenericFormModule, GenericFormService, GetMaxHeightDirective, IconComponent, IconSizePx, IconSizesArr, ImageSliderComponent, ImageSnippet, ImageSourceType, ImageUploadComponent, InlineAlertComponent, IntegerCurrency, KMSAccordionItemComponent, KeyValuePair, KmsUiPresentationalComponent, KmsUiPresentationalModule, KmsUiPresentationalService, LabelValuePair, LoaderComponent, MapComponent, Marker, MarkerLabel, MarkerOptions, NumericInputComponent, PasswordComponent, RadioButtonComponent, RadioButtonSize, RadioGroupComponent, SafeHtmlPipe, SafeResourceUrlPipe, SafeUrlPipe, SalutationDropdownComponent, SalutationEnum, SalutationRadiogroupComponent, SanitizeNullPipe, SimpleBreakpoint, SlideToggleComponent, SliderComponent, StylingTheme, SwipeDirective, TextInputComponent, TextValuePair, TextValuePairArray, TimeDirective, TimeInputComponent, TooltipDirective, TooltipIconComponent, TrimPipe, TypeofPipe, ViewportService, WindowDimensions, YesNoRadiogroupComponent, noSpecialCharsOnly, noWhitespaceOnly };
|
|
5007
5216
|
//# sourceMappingURL=kms-ngx-ui-presentational.mjs.map
|