@xsmusices/ui 1.44.20 → 1.44.24
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/xsmusices-ui.mjs +550 -178
- package/fesm2022/xsmusices-ui.mjs.map +1 -1
- package/index.d.ts +58 -21
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { PLATFORM_ID, Inject, Injectable, inject, Pipe, InjectionToken, NgModule, viewChild, input, output, signal, effect, ChangeDetectionStrategy, Component, computed, DestroyRef, ElementRef, model, Directive, Renderer2, Injector, ViewContainerRef, forwardRef, createComponent, ViewEncapsulation, contentChildren, viewChildren, NgZone, booleanAttribute, contentChild, HostListener } from '@angular/core';
|
|
2
|
+
import { PLATFORM_ID, Inject, Injectable, inject, Pipe, InjectionToken, NgModule, viewChild, input, output, signal, effect, ChangeDetectionStrategy, Component, computed, DestroyRef, ElementRef, model, Directive, ChangeDetectorRef, Renderer2, Injector, ViewContainerRef, forwardRef, createComponent, ViewEncapsulation, contentChildren, viewChildren, NgZone, booleanAttribute, contentChild, HostListener } from '@angular/core';
|
|
3
3
|
import * as i1$1 from '@angular/common';
|
|
4
|
-
import { isPlatformBrowser, formatDate, CommonModule, DatePipe } from '@angular/common';
|
|
4
|
+
import { isPlatformBrowser, formatDate, CommonModule, DOCUMENT, DatePipe } from '@angular/common';
|
|
5
5
|
import * as i1 from '@fortawesome/angular-fontawesome';
|
|
6
6
|
import { FaIconLibrary, FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
|
7
7
|
import { BehaviorSubject, Subject, Subscription, of, from, fromEvent, debounceTime as debounceTime$1, distinctUntilChanged as distinctUntilChanged$1, firstValueFrom, filter as filter$1, switchMap as switchMap$1 } from 'rxjs';
|
|
@@ -3744,32 +3744,59 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
3744
3744
|
|
|
3745
3745
|
class SocialPipe {
|
|
3746
3746
|
transform(url, socialMedia) {
|
|
3747
|
-
if (url
|
|
3748
|
-
const socialMediaHosts = {
|
|
3749
|
-
instagram: 'https://instagram.com/',
|
|
3750
|
-
facebook: 'https://facebook.com/',
|
|
3751
|
-
twitter: 'https://twitter.com/',
|
|
3752
|
-
youtube: 'https://youtube.com/channel/',
|
|
3753
|
-
soundcloud: 'https://soundcloud.com/',
|
|
3754
|
-
spotify: 'https://spotify.com/',
|
|
3755
|
-
mixcloud: 'https://mixcloud.com/',
|
|
3756
|
-
};
|
|
3757
|
-
const hostWithoutWWW = socialMediaHosts[socialMedia];
|
|
3758
|
-
if (!hostWithoutWWW) {
|
|
3759
|
-
return null;
|
|
3760
|
-
}
|
|
3761
|
-
const hostWithWWW = `https://www.${hostWithoutWWW.slice(8)}`;
|
|
3762
|
-
const matchWithWWW = url.match(new RegExp(`${hostWithWWW}(.*?)(\/|$)`));
|
|
3763
|
-
const matchWithoutWWW = url.match(new RegExp(`${hostWithoutWWW}(.*?)(\/|$)`));
|
|
3764
|
-
const match = matchWithWWW || matchWithoutWWW;
|
|
3765
|
-
if (match && match[1]) {
|
|
3766
|
-
return `${match[1].replaceAll(/[\/?]/g, '')}`;
|
|
3767
|
-
}
|
|
3747
|
+
if (!url || !socialMedia) {
|
|
3768
3748
|
return null;
|
|
3769
3749
|
}
|
|
3770
|
-
|
|
3750
|
+
const value = url.trim();
|
|
3751
|
+
if (!value) {
|
|
3752
|
+
return null;
|
|
3753
|
+
}
|
|
3754
|
+
const socialMediaHosts = {
|
|
3755
|
+
instagram: 'https://instagram.com/',
|
|
3756
|
+
facebook: 'https://facebook.com/',
|
|
3757
|
+
twitter: 'https://twitter.com/',
|
|
3758
|
+
youtube: 'https://youtube.com/channel/',
|
|
3759
|
+
soundcloud: 'https://soundcloud.com/',
|
|
3760
|
+
spotify: 'https://spotify.com/',
|
|
3761
|
+
mixcloud: 'https://mixcloud.com/',
|
|
3762
|
+
};
|
|
3763
|
+
const hostWithoutWWW = socialMediaHosts[socialMedia];
|
|
3764
|
+
if (!hostWithoutWWW) {
|
|
3771
3765
|
return null;
|
|
3772
3766
|
}
|
|
3767
|
+
if (socialMedia === 'instagram') {
|
|
3768
|
+
return this.extractInstagramUser(value, hostWithoutWWW);
|
|
3769
|
+
}
|
|
3770
|
+
return SocialPipe.extractFromUrl(value, hostWithoutWWW);
|
|
3771
|
+
}
|
|
3772
|
+
/**
|
|
3773
|
+
* Instagram acepta tres formatos: handle pelado ("technogermany"),
|
|
3774
|
+
* handle con @ ("@technogermany") y URLs con o sin esquema.
|
|
3775
|
+
* Cualquier otro valor devuelve null para no generar enlaces rotos.
|
|
3776
|
+
*/
|
|
3777
|
+
extractInstagramUser(value, hostWithoutWWW) {
|
|
3778
|
+
const lower = value.toLowerCase();
|
|
3779
|
+
const looksLikeUrl = lower.includes('://') ||
|
|
3780
|
+
lower.startsWith('instagram.com') ||
|
|
3781
|
+
lower.startsWith('www.instagram.com');
|
|
3782
|
+
if (!looksLikeUrl) {
|
|
3783
|
+
const handleMatch = value.match(/^@?([A-Za-z0-9._]{1,30})$/);
|
|
3784
|
+
return handleMatch ? handleMatch[1] : null;
|
|
3785
|
+
}
|
|
3786
|
+
const withScheme = /^https?:\/\//i.test(value)
|
|
3787
|
+
? value.replace(/^http:\/\//i, 'https://')
|
|
3788
|
+
: `https://${value}`;
|
|
3789
|
+
return SocialPipe.extractFromUrl(withScheme, hostWithoutWWW);
|
|
3790
|
+
}
|
|
3791
|
+
static extractFromUrl(value, hostWithoutWWW) {
|
|
3792
|
+
const hostWithWWW = `https://www.${hostWithoutWWW.slice(8)}`;
|
|
3793
|
+
const matchWithWWW = value.match(new RegExp(`${hostWithWWW}(.*?)(\/|$)`));
|
|
3794
|
+
const matchWithoutWWW = value.match(new RegExp(`${hostWithoutWWW}(.*?)(\/|$)`));
|
|
3795
|
+
const match = matchWithWWW || matchWithoutWWW;
|
|
3796
|
+
if (match?.[1]) {
|
|
3797
|
+
return `${match[1].replaceAll(/[\/?]/g, '')}`;
|
|
3798
|
+
}
|
|
3799
|
+
return null;
|
|
3773
3800
|
}
|
|
3774
3801
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: SocialPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
3775
3802
|
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.33", ngImport: i0, type: SocialPipe, isStandalone: true, name: "social" });
|
|
@@ -5757,15 +5784,19 @@ const ERROR_TRANSLATION_KEYS = {
|
|
|
5757
5784
|
function getRequiredLength(error) {
|
|
5758
5785
|
return error?.requiredLength ?? 0;
|
|
5759
5786
|
}
|
|
5760
|
-
function getRequiredValue(error) {
|
|
5761
|
-
|
|
5787
|
+
function getRequiredValue(error, key) {
|
|
5788
|
+
const e = error;
|
|
5789
|
+
if (key === 'min') {
|
|
5790
|
+
return e?.min ?? e?.minimum ?? e?.requiredValue ?? 0;
|
|
5791
|
+
}
|
|
5792
|
+
return e?.max ?? e?.maximum ?? e?.requiredValue ?? 0;
|
|
5762
5793
|
}
|
|
5763
5794
|
function formatErrorMessage(key, error, template) {
|
|
5764
5795
|
if (key === 'minlength' || key === 'maxlength') {
|
|
5765
|
-
return template.
|
|
5796
|
+
return template.replaceAll('{{requiredLength}}', String(getRequiredLength(error)));
|
|
5766
5797
|
}
|
|
5767
5798
|
if (key === 'min' || key === 'max') {
|
|
5768
|
-
return template.
|
|
5799
|
+
return template.replaceAll('{{requiredValue}}', String(getRequiredValue(error, key)));
|
|
5769
5800
|
}
|
|
5770
5801
|
return template;
|
|
5771
5802
|
}
|
|
@@ -5782,9 +5813,9 @@ function defaultErrorMessage(key, error) {
|
|
|
5782
5813
|
case 'pattern':
|
|
5783
5814
|
return 'Formato incorrecto';
|
|
5784
5815
|
case 'min':
|
|
5785
|
-
return `Debe ser al menos ${getRequiredValue(error)}`;
|
|
5816
|
+
return `Debe ser al menos ${getRequiredValue(error, 'min')}`;
|
|
5786
5817
|
case 'max':
|
|
5787
|
-
return `Debe ser como máximo ${getRequiredValue(error)}`;
|
|
5818
|
+
return `Debe ser como máximo ${getRequiredValue(error, 'max')}`;
|
|
5788
5819
|
default:
|
|
5789
5820
|
return key;
|
|
5790
5821
|
}
|
|
@@ -5857,11 +5888,34 @@ class XSFormlyBaseComponent extends FieldType {
|
|
|
5857
5888
|
return 'formly-field-wrapper';
|
|
5858
5889
|
}
|
|
5859
5890
|
get errorMessage() {
|
|
5860
|
-
|
|
5891
|
+
const service = this.xsTranslateService ?? this.xsTranslate;
|
|
5892
|
+
if (!service)
|
|
5861
5893
|
return '';
|
|
5862
5894
|
this.formStatusVersion();
|
|
5863
5895
|
this.langVersion();
|
|
5864
|
-
|
|
5896
|
+
// Formly define formControl como propiedad NO enumerable: el spread
|
|
5897
|
+
// la perdería y el mensaje quedaría vacío. Se restaura explícitamente.
|
|
5898
|
+
return getFormlyErrorMessage({
|
|
5899
|
+
...this.field,
|
|
5900
|
+
formControl: this.formControl,
|
|
5901
|
+
showError: this.resolveShowError(),
|
|
5902
|
+
}, service);
|
|
5903
|
+
}
|
|
5904
|
+
resolveShowError() {
|
|
5905
|
+
const explicit = this.field?.showError;
|
|
5906
|
+
if (typeof explicit === 'boolean')
|
|
5907
|
+
return explicit;
|
|
5908
|
+
const showErrorFn = this.field?.options?.showError;
|
|
5909
|
+
if (typeof showErrorFn === 'function') {
|
|
5910
|
+
try {
|
|
5911
|
+
return !!showErrorFn(this);
|
|
5912
|
+
}
|
|
5913
|
+
catch {
|
|
5914
|
+
return false;
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
const control = this.formControl;
|
|
5918
|
+
return !!control && control.invalid && control.touched;
|
|
5865
5919
|
}
|
|
5866
5920
|
translateLabel(label) {
|
|
5867
5921
|
this.langVersion();
|
|
@@ -6009,27 +6063,36 @@ class XSFormlyArrayComponent extends XSFormlyBaseComponent {
|
|
|
6009
6063
|
: [];
|
|
6010
6064
|
}
|
|
6011
6065
|
addItem() {
|
|
6066
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6067
|
+
return;
|
|
6012
6068
|
const next = [...this.items, this.createEmptyItem()];
|
|
6013
6069
|
this.control.setValue(next);
|
|
6070
|
+
this.control.markAsTouched();
|
|
6014
6071
|
}
|
|
6015
6072
|
get removeItemLabel() {
|
|
6016
|
-
return this.
|
|
6073
|
+
return this.translateLabel('FORM.ARRAY.REMOVE');
|
|
6017
6074
|
}
|
|
6018
6075
|
get addItemLabel() {
|
|
6019
|
-
return this.
|
|
6076
|
+
return this.translateLabel('FORM.ARRAY.ADD_ITEM');
|
|
6020
6077
|
}
|
|
6021
6078
|
get itemLabel() {
|
|
6022
|
-
return this.
|
|
6079
|
+
return this.translateLabel('FORM.ARRAY.ITEM');
|
|
6023
6080
|
}
|
|
6024
6081
|
removeItem(index) {
|
|
6082
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6083
|
+
return;
|
|
6025
6084
|
const next = [...this.items];
|
|
6026
6085
|
next.splice(index, 1);
|
|
6027
6086
|
this.control.setValue(next);
|
|
6087
|
+
this.control.markAsTouched();
|
|
6028
6088
|
}
|
|
6029
6089
|
updateItem(index, key, value) {
|
|
6090
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6091
|
+
return;
|
|
6030
6092
|
const next = [...this.items];
|
|
6031
6093
|
next[index] = { ...next[index], [key]: value };
|
|
6032
6094
|
this.control.setValue(next);
|
|
6095
|
+
this.control.markAsTouched();
|
|
6033
6096
|
}
|
|
6034
6097
|
createEmptyItem() {
|
|
6035
6098
|
const subFields = (this.props['subFields'] ?? {});
|
|
@@ -6040,7 +6103,7 @@ class XSFormlyArrayComponent extends XSFormlyBaseComponent {
|
|
|
6040
6103
|
return item;
|
|
6041
6104
|
}
|
|
6042
6105
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyArrayComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6043
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyArrayComponent, isStandalone: true, selector: "xs-formly-array", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-array-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <div class=\"text-sm font-semibold text-white\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </div>\n }\n\n @for (item of items; track
|
|
6106
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyArrayComponent, isStandalone: true, selector: "xs-formly-array", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-array-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <div class=\"text-sm font-semibold text-white\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </div>\n }\n\n @for (item of items; track $index; let i = $index) {\n <div class=\"rounded-xl bg-zinc-900/50 p-4\">\n <div class=\"flex items-center justify-between gap-3\">\n <span class=\"text-sm font-semibold text-white\"\n >{{ itemLabel }}\n {{ i + 1 }}</span\n >\n <button\n type=\"button\"\n class=\"rounded-xl px-3 py-1 text-xs text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"removeItem(i)\"\n >\n {{ removeItemLabel }}\n </button>\n </div>\n\n @for (key of fieldKeys(item); track key) {\n <div class=\"mt-3\">\n <label class=\"block text-xs text-zinc-400\">{{\n key\n }}</label>\n <input\n type=\"text\"\n [value]=\"item[key]\"\n (input)=\"updateItem(i, key, $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-label]=\"key\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n }\n </div>\n }\n\n <button\n type=\"button\"\n class=\"rounded-xl bg-zinc-900/50 px-4 py-2 text-sm font-semibold text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"addItem()\"\n >\n {{ addItemLabel }}\n </button>\n\n @if (errorMessage) {\n <p class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSPopoverInfoComponent, selector: "xs-popover-info", inputs: ["text"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6044
6107
|
}
|
|
6045
6108
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyArrayComponent, decorators: [{
|
|
6046
6109
|
type: Component,
|
|
@@ -6048,7 +6111,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6048
6111
|
CommonModule,
|
|
6049
6112
|
ReactiveFormsModule,
|
|
6050
6113
|
XSPopoverInfoComponent,
|
|
6051
|
-
], template: "<div [id]=\"'xs-formly-array-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <div class=\"text-sm font-semibold text-white\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </div>\n }\n\n @for (item of items; track
|
|
6114
|
+
], template: "<div [id]=\"'xs-formly-array-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <div class=\"text-sm font-semibold text-white\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </div>\n }\n\n @for (item of items; track $index; let i = $index) {\n <div class=\"rounded-xl bg-zinc-900/50 p-4\">\n <div class=\"flex items-center justify-between gap-3\">\n <span class=\"text-sm font-semibold text-white\"\n >{{ itemLabel }}\n {{ i + 1 }}</span\n >\n <button\n type=\"button\"\n class=\"rounded-xl px-3 py-1 text-xs text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"removeItem(i)\"\n >\n {{ removeItemLabel }}\n </button>\n </div>\n\n @for (key of fieldKeys(item); track key) {\n <div class=\"mt-3\">\n <label class=\"block text-xs text-zinc-400\">{{\n key\n }}</label>\n <input\n type=\"text\"\n [value]=\"item[key]\"\n (input)=\"updateItem(i, key, $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-label]=\"key\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n }\n </div>\n }\n\n <button\n type=\"button\"\n class=\"rounded-xl bg-zinc-900/50 px-4 py-2 text-sm font-semibold text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"addItem()\"\n >\n {{ addItemLabel }}\n </button>\n\n @if (errorMessage) {\n <p class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6052
6115
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6053
6116
|
|
|
6054
6117
|
class XSFormlyButtonComponent extends XSFormlyBaseComponent {
|
|
@@ -6057,7 +6120,7 @@ class XSFormlyButtonComponent extends XSFormlyBaseComponent {
|
|
|
6057
6120
|
this.xsTranslateService = translateService;
|
|
6058
6121
|
}
|
|
6059
6122
|
get actionLabel() {
|
|
6060
|
-
return this.
|
|
6123
|
+
return this.translateLabel('FORM.BUTTON.ACTION');
|
|
6061
6124
|
}
|
|
6062
6125
|
handleClick(event) {
|
|
6063
6126
|
const callback = this.props['onClick'];
|
|
@@ -6066,11 +6129,11 @@ class XSFormlyButtonComponent extends XSFormlyBaseComponent {
|
|
|
6066
6129
|
}
|
|
6067
6130
|
}
|
|
6068
6131
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyButtonComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6069
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.33", type: XSFormlyButtonComponent, isStandalone: true, selector: "xs-formly-button", usesInheritance: true, ngImport: i0, template: "<button\n [id]=\"'xs-formly-button-' + id\"\n [type]=\"props['subtype'] || 'button'\"\n class=\"inline-flex items-center justify-center rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] text-sm font-semibold text-white button-interaction\"\n (click)=\"handleClick($event)\"\n>\n {{ props.label || actionLabel }}\n</button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6132
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.33", type: XSFormlyButtonComponent, isStandalone: true, selector: "xs-formly-button", usesInheritance: true, ngImport: i0, template: "<button\n [id]=\"'xs-formly-button-' + id\"\n [type]=\"props['subtype'] || 'button'\"\n class=\"inline-flex items-center justify-center rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] text-sm font-semibold text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"handleClick($event)\"\n>\n {{ translateLabel(props.label) || actionLabel }}\n</button>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6070
6133
|
}
|
|
6071
6134
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyButtonComponent, decorators: [{
|
|
6072
6135
|
type: Component,
|
|
6073
|
-
args: [{ selector: 'xs-formly-button', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule], template: "<button\n [id]=\"'xs-formly-button-' + id\"\n [type]=\"props['subtype'] || 'button'\"\n class=\"inline-flex items-center justify-center rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] text-sm font-semibold text-white button-interaction\"\n (click)=\"handleClick($event)\"\n>\n {{ props.label || actionLabel }}\n</button>\n" }]
|
|
6136
|
+
args: [{ selector: 'xs-formly-button', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [CommonModule], template: "<button\n [id]=\"'xs-formly-button-' + id\"\n [type]=\"props['subtype'] || 'button'\"\n class=\"inline-flex items-center justify-center rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] text-sm font-semibold text-white button-interaction\"\n [disabled]=\"props.disabled || control?.disabled\"\n (click)=\"handleClick($event)\"\n>\n {{ translateLabel(props.label) || actionLabel }}\n</button>\n" }]
|
|
6074
6137
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6075
6138
|
|
|
6076
6139
|
class XSFormlyLabelComponent {
|
|
@@ -6103,6 +6166,11 @@ class XSFormlyLabelComponent {
|
|
|
6103
6166
|
event.preventDefault();
|
|
6104
6167
|
this.toggle();
|
|
6105
6168
|
}
|
|
6169
|
+
onKey(event) {
|
|
6170
|
+
event.stopPropagation();
|
|
6171
|
+
event.preventDefault();
|
|
6172
|
+
this.toggle();
|
|
6173
|
+
}
|
|
6106
6174
|
toggle() {
|
|
6107
6175
|
if (this.isVisible()) {
|
|
6108
6176
|
this.hide();
|
|
@@ -6141,6 +6209,8 @@ class XSFormlyLabelComponent {
|
|
|
6141
6209
|
(mouseenter)="show()"
|
|
6142
6210
|
(mouseleave)="scheduleHide()"
|
|
6143
6211
|
(keydown.escape)="hide()"
|
|
6212
|
+
(keydown.enter)="onKey($event)"
|
|
6213
|
+
(keydown.space)="onKey($event)"
|
|
6144
6214
|
/>
|
|
6145
6215
|
}
|
|
6146
6216
|
</div>
|
|
@@ -6169,6 +6239,8 @@ class XSFormlyLabelComponent {
|
|
|
6169
6239
|
(mouseenter)="show()"
|
|
6170
6240
|
(mouseleave)="scheduleHide()"
|
|
6171
6241
|
(keydown.escape)="hide()"
|
|
6242
|
+
(keydown.enter)="onKey($event)"
|
|
6243
|
+
(keydown.space)="onKey($event)"
|
|
6172
6244
|
/>
|
|
6173
6245
|
}
|
|
6174
6246
|
</label>
|
|
@@ -6222,6 +6294,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6222
6294
|
(mouseenter)="show()"
|
|
6223
6295
|
(mouseleave)="scheduleHide()"
|
|
6224
6296
|
(keydown.escape)="hide()"
|
|
6297
|
+
(keydown.enter)="onKey($event)"
|
|
6298
|
+
(keydown.space)="onKey($event)"
|
|
6225
6299
|
/>
|
|
6226
6300
|
}
|
|
6227
6301
|
</div>
|
|
@@ -6250,6 +6324,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6250
6324
|
(mouseenter)="show()"
|
|
6251
6325
|
(mouseleave)="scheduleHide()"
|
|
6252
6326
|
(keydown.escape)="hide()"
|
|
6327
|
+
(keydown.enter)="onKey($event)"
|
|
6328
|
+
(keydown.space)="onKey($event)"
|
|
6253
6329
|
/>
|
|
6254
6330
|
}
|
|
6255
6331
|
</label>
|
|
@@ -6297,26 +6373,28 @@ class XSFormlyCheckboxComponent extends XSFormlyBaseComponent {
|
|
|
6297
6373
|
isChecked(option) {
|
|
6298
6374
|
const value = this.control?.value;
|
|
6299
6375
|
return Array.isArray(value)
|
|
6300
|
-
? value.
|
|
6376
|
+
? value.some((item) => String(item) === String(option.id))
|
|
6301
6377
|
: false;
|
|
6302
6378
|
}
|
|
6303
6379
|
toggleOption(checked, option) {
|
|
6380
|
+
if (this.control?.disabled)
|
|
6381
|
+
return;
|
|
6304
6382
|
const value = this.control?.value ?? [];
|
|
6305
6383
|
const next = Array.isArray(value) ? [...value] : [];
|
|
6384
|
+
const id = String(option.id);
|
|
6385
|
+
const index = next.findIndex((item) => String(item) === id);
|
|
6306
6386
|
if (checked) {
|
|
6307
|
-
if (
|
|
6387
|
+
if (index === -1)
|
|
6308
6388
|
next.push(option.id);
|
|
6309
6389
|
}
|
|
6310
|
-
else {
|
|
6311
|
-
|
|
6312
|
-
if (index !== -1)
|
|
6313
|
-
next.splice(index, 1);
|
|
6390
|
+
else if (index !== -1) {
|
|
6391
|
+
next.splice(index, 1);
|
|
6314
6392
|
}
|
|
6315
6393
|
this.control?.setValue(next);
|
|
6316
6394
|
this.control?.markAsTouched();
|
|
6317
6395
|
}
|
|
6318
6396
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyCheckboxComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6319
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyCheckboxComponent, isStandalone: true, selector: "xs-formly-checkbox", usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n @if (hasOptions) {\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n <div class=\"h-[1px] flex-1 bg-zinc-800/30\"></div>\n }\n\n <div\n [class.grid]=\"hasOptions\"\n class=\"grid-cols-1 sm:grid-cols-2 gap-2\"\n role=\"group\"\n [attr.aria-label]=\"props.label || ''\"\n >\n @if (hasOptions) {\n @for (option of checkboxOptions; track option.id) {\n <label\n [for]=\"id + '-' + option.id\"\n class=\"group flex items-center gap-3 rounded-xl bg-zinc-900/40 p-4 border border-transparent hover:bg-zinc-900/80 transition-all cursor-pointer select-none\"\n [class.bg-zinc-800/40]=\"isChecked(option)\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n type=\"checkbox\"\n [id]=\"id + '-' + option.id\"\n [checked]=\"isChecked(option)\"\n (change)=\"\n toggleOption($event.target.checked, option)\n \"\n class=\"peer sr-only\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n\n <span\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] transition-colors\"\n [class]=\"\n isChecked(option)\n ? 'text-white'\n : 'text-zinc-400 group-hover:text-zinc-200'\n \"\n >\n {{ option.name }}\n </span>\n </label>\n }\n } @else {\n <label\n [for]=\"id\"\n class=\"group inline-flex items-center gap-4 cursor-pointer select-none py-2 px-1\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n [formControl]=\"control\"\n class=\"peer sr-only\"\n [attr.aria-label]=\"props.description || props.label || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n <span\n class=\"text-sm text-zinc-400 leading-tight group-hover:text-zinc-200 transition-colors\"\n >\n {{ props.description }}\n </span>\n </label>\n }\n </div>\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold uppercase tracking-widest text-red-500/80 px-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6397
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyCheckboxComponent, isStandalone: true, selector: "xs-formly-checkbox", usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n @if (hasOptions) {\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n <div class=\"h-[1px] flex-1 bg-zinc-800/30\"></div>\n }\n\n <div\n [class.grid]=\"hasOptions\"\n class=\"grid-cols-1 sm:grid-cols-2 gap-2\"\n role=\"group\"\n [attr.aria-label]=\"props.label || ''\"\n >\n @if (hasOptions) {\n @for (option of checkboxOptions; track option.id) {\n <label\n [for]=\"id + '-' + option.id\"\n class=\"group flex items-center gap-3 rounded-xl bg-zinc-900/40 p-4 border border-transparent hover:bg-zinc-900/80 transition-all cursor-pointer select-none\"\n [class.bg-zinc-800/40]=\"isChecked(option)\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n type=\"checkbox\"\n [id]=\"id + '-' + option.id\"\n [checked]=\"isChecked(option)\"\n [disabled]=\"props.disabled || control?.disabled\"\n (change)=\"\n toggleOption($event.target.checked, option)\n \"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n class=\"peer sr-only\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white peer-focus-visible:ring-2 peer-focus-visible:ring-white/70 group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n\n <span\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] transition-colors\"\n [class]=\"\n isChecked(option)\n ? 'text-white'\n : 'text-zinc-400 group-hover:text-zinc-200'\n \"\n >\n {{ option.name }}\n </span>\n </label>\n }\n } @else {\n <label\n [for]=\"id\"\n class=\"group inline-flex items-center gap-4 cursor-pointer select-none py-2 px-1\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n [formControl]=\"control\"\n class=\"peer sr-only\"\n [attr.aria-label]=\"props.description || props.label || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white peer-focus-visible:ring-2 peer-focus-visible:ring-white/70 group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n <span\n class=\"text-sm text-zinc-400 leading-tight group-hover:text-zinc-200 transition-colors\"\n >\n {{ props.description }}\n </span>\n </label>\n }\n </div>\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold uppercase tracking-widest text-red-500/80 px-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6320
6398
|
}
|
|
6321
6399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyCheckboxComponent, decorators: [{
|
|
6322
6400
|
type: Component,
|
|
@@ -6324,73 +6402,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6324
6402
|
CommonModule,
|
|
6325
6403
|
ReactiveFormsModule,
|
|
6326
6404
|
XSFormlyLabelComponent,
|
|
6327
|
-
], template: "<div [class]=\"wrapperClass\">\n @if (hasOptions) {\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n <div class=\"h-[1px] flex-1 bg-zinc-800/30\"></div>\n }\n\n <div\n [class.grid]=\"hasOptions\"\n class=\"grid-cols-1 sm:grid-cols-2 gap-2\"\n role=\"group\"\n [attr.aria-label]=\"props.label || ''\"\n >\n @if (hasOptions) {\n @for (option of checkboxOptions; track option.id) {\n <label\n [for]=\"id + '-' + option.id\"\n class=\"group flex items-center gap-3 rounded-xl bg-zinc-900/40 p-4 border border-transparent hover:bg-zinc-900/80 transition-all cursor-pointer select-none\"\n [class.bg-zinc-800/40]=\"isChecked(option)\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n type=\"checkbox\"\n [id]=\"id + '-' + option.id\"\n [checked]=\"isChecked(option)\"\n (change)=\"\n toggleOption($event.target.checked, option)\n \"\n class=\"peer sr-only\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n\n <span\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] transition-colors\"\n [class]=\"\n isChecked(option)\n ? 'text-white'\n : 'text-zinc-400 group-hover:text-zinc-200'\n \"\n >\n {{ option.name }}\n </span>\n </label>\n }\n } @else {\n <label\n [for]=\"id\"\n class=\"group inline-flex items-center gap-4 cursor-pointer select-none py-2 px-1\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n [formControl]=\"control\"\n class=\"peer sr-only\"\n [attr.aria-label]=\"props.description || props.label || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n <span\n class=\"text-sm text-zinc-400 leading-tight group-hover:text-zinc-200 transition-colors\"\n >\n {{ props.description }}\n </span>\n </label>\n }\n </div>\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold uppercase tracking-widest text-red-500/80 px-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n" }]
|
|
6328
|
-
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6329
|
-
|
|
6330
|
-
class XSFormlyDateComponent extends XSFormlyBaseComponent {
|
|
6331
|
-
constructor(translateService) {
|
|
6332
|
-
super();
|
|
6333
|
-
this.xsTranslateService = translateService;
|
|
6334
|
-
}
|
|
6335
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6336
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyDateComponent, isStandalone: true, selector: "xs-formly-date", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-date-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [id]=\"id\"\n [formControl]=\"control\"\n type=\"date\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl h-[54px]\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6337
|
-
}
|
|
6338
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateComponent, decorators: [{
|
|
6339
|
-
type: Component,
|
|
6340
|
-
args: [{ selector: 'xs-formly-date', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
6341
|
-
CommonModule,
|
|
6342
|
-
ReactiveFormsModule,
|
|
6343
|
-
XSFormlyLabelComponent,
|
|
6344
|
-
], template: "<div [id]=\"'xs-formly-date-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [id]=\"id\"\n [formControl]=\"control\"\n type=\"date\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl h-[54px]\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6345
|
-
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6346
|
-
|
|
6347
|
-
class XSFormlyDateRangeComponent extends XSFormlyBaseComponent {
|
|
6348
|
-
constructor(translateService) {
|
|
6349
|
-
super();
|
|
6350
|
-
this.xsTranslateService = translateService;
|
|
6351
|
-
}
|
|
6352
|
-
get currentValue() {
|
|
6353
|
-
return (this.control?.value ?? {});
|
|
6354
|
-
}
|
|
6355
|
-
get startValue() {
|
|
6356
|
-
return this.formatDate(this.currentValue['start']);
|
|
6357
|
-
}
|
|
6358
|
-
get endValue() {
|
|
6359
|
-
return this.formatDate(this.currentValue['end']);
|
|
6360
|
-
}
|
|
6361
|
-
get startLabel() {
|
|
6362
|
-
return this.xsTranslateService.translate('FORM.DATE_RANGE.START_LABEL');
|
|
6363
|
-
}
|
|
6364
|
-
get endLabel() {
|
|
6365
|
-
return this.xsTranslateService.translate('FORM.DATE_RANGE.END_LABEL');
|
|
6366
|
-
}
|
|
6367
|
-
updateRange(key, value) {
|
|
6368
|
-
const next = {
|
|
6369
|
-
...this.currentValue,
|
|
6370
|
-
[key]: value
|
|
6371
|
-
? new Date(value).toISOString().split('T')[0]
|
|
6372
|
-
: null,
|
|
6373
|
-
};
|
|
6374
|
-
this.control.setValue(next);
|
|
6375
|
-
}
|
|
6376
|
-
formatDate(value) {
|
|
6377
|
-
if (!value || typeof value !== 'string') {
|
|
6378
|
-
return '';
|
|
6379
|
-
}
|
|
6380
|
-
const date = new Date(value);
|
|
6381
|
-
const iso = date.toISOString();
|
|
6382
|
-
return iso.split('T')[0];
|
|
6383
|
-
}
|
|
6384
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateRangeComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6385
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyDateRangeComponent, isStandalone: true, selector: "xs-formly-date-range", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-date-range-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <div>\n <label\n [for]=\"id + '-start'\"\n class=\"block text-xs text-zinc-400\"\n >{{ startLabel }}</label\n >\n <input\n [id]=\"id + '-start'\"\n type=\"date\"\n [value]=\"startValue\"\n (change)=\"updateRange('start', $event.target.value)\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n <div>\n <label\n [for]=\"id + '-end'\"\n class=\"block text-xs text-zinc-400\"\n >{{ endLabel }}</label\n >\n <input\n [id]=\"id + '-end'\"\n type=\"date\"\n [value]=\"endValue\"\n (change)=\"updateRange('end', $event.target.value)\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6386
|
-
}
|
|
6387
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateRangeComponent, decorators: [{
|
|
6388
|
-
type: Component,
|
|
6389
|
-
args: [{ selector: 'xs-formly-date-range', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
6390
|
-
CommonModule,
|
|
6391
|
-
ReactiveFormsModule,
|
|
6392
|
-
XSFormlyLabelComponent,
|
|
6393
|
-
], template: "<div [id]=\"'xs-formly-date-range-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <div>\n <label\n [for]=\"id + '-start'\"\n class=\"block text-xs text-zinc-400\"\n >{{ startLabel }}</label\n >\n <input\n [id]=\"id + '-start'\"\n type=\"date\"\n [value]=\"startValue\"\n (change)=\"updateRange('start', $event.target.value)\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n <div>\n <label\n [for]=\"id + '-end'\"\n class=\"block text-xs text-zinc-400\"\n >{{ endLabel }}</label\n >\n <input\n [id]=\"id + '-end'\"\n type=\"date\"\n [value]=\"endValue\"\n (change)=\"updateRange('end', $event.target.value)\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6405
|
+
], template: "<div [class]=\"wrapperClass\">\n @if (hasOptions) {\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n <div class=\"h-[1px] flex-1 bg-zinc-800/30\"></div>\n }\n\n <div\n [class.grid]=\"hasOptions\"\n class=\"grid-cols-1 sm:grid-cols-2 gap-2\"\n role=\"group\"\n [attr.aria-label]=\"props.label || ''\"\n >\n @if (hasOptions) {\n @for (option of checkboxOptions; track option.id) {\n <label\n [for]=\"id + '-' + option.id\"\n class=\"group flex items-center gap-3 rounded-xl bg-zinc-900/40 p-4 border border-transparent hover:bg-zinc-900/80 transition-all cursor-pointer select-none\"\n [class.bg-zinc-800/40]=\"isChecked(option)\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n type=\"checkbox\"\n [id]=\"id + '-' + option.id\"\n [checked]=\"isChecked(option)\"\n [disabled]=\"props.disabled || control?.disabled\"\n (change)=\"\n toggleOption($event.target.checked, option)\n \"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n class=\"peer sr-only\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white peer-focus-visible:ring-2 peer-focus-visible:ring-white/70 group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n\n <span\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] transition-colors\"\n [class]=\"\n isChecked(option)\n ? 'text-white'\n : 'text-zinc-400 group-hover:text-zinc-200'\n \"\n >\n {{ option.name }}\n </span>\n </label>\n }\n } @else {\n <label\n [for]=\"id\"\n class=\"group inline-flex items-center gap-4 cursor-pointer select-none py-2 px-1\"\n >\n <div class=\"relative flex items-center justify-center\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n [formControl]=\"control\"\n class=\"peer sr-only\"\n [attr.aria-label]=\"props.description || props.label || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n />\n <div\n class=\"w-5 h-5 border-2 border-zinc-700 rounded-md bg-zinc-950 transition-all peer-checked:bg-white peer-checked:border-white peer-focus-visible:ring-2 peer-focus-visible:ring-white/70 group-active:scale-90 outline-none\"\n ></div>\n <svg\n class=\"absolute w-3 h-3 text-black opacity-0 peer-checked:opacity-100 transition-opacity pointer-events-none\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n stroke-width=\"4\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M5 13l4 4L19 7\"\n />\n </svg>\n </div>\n <span\n class=\"text-sm text-zinc-400 leading-tight group-hover:text-zinc-200 transition-colors\"\n >\n {{ props.description }}\n </span>\n </label>\n }\n </div>\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold uppercase tracking-widest text-red-500/80 px-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n" }]
|
|
6394
6406
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6395
6407
|
|
|
6396
6408
|
/**
|
|
@@ -6407,6 +6419,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6407
6419
|
*/
|
|
6408
6420
|
/** `YYYY-MM-DDTHH:mm`: el único formato que el input acepta tal cual. */
|
|
6409
6421
|
const NAIVE_DATETIME_LOCAL_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/;
|
|
6422
|
+
/** `YYYY-MM-DD`: el único formato que el input date acepta tal cual. */
|
|
6423
|
+
const NAIVE_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
6410
6424
|
const pad2 = (n) => String(n).padStart(2, '0');
|
|
6411
6425
|
const formatLocal = (d) => `${d.getFullYear()}-${pad2(d.getMonth() + 1)}-${pad2(d.getDate())}T${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
|
6412
6426
|
const isValidDate = (d) => !isNaN(d.getTime());
|
|
@@ -6438,6 +6452,35 @@ function toDatetimeLocalInput(value) {
|
|
|
6438
6452
|
const d = new Date(value);
|
|
6439
6453
|
return isValidDate(d) ? formatLocal(d) : '';
|
|
6440
6454
|
}
|
|
6455
|
+
/**
|
|
6456
|
+
* Normaliza un valor de backend/modelo al formato del input date,
|
|
6457
|
+
* preservando el DÍA en hora local del navegador.
|
|
6458
|
+
*
|
|
6459
|
+
* - `"2026-05-01"` (naive) → intacto. IMPORTANTE: no se reinterpreta
|
|
6460
|
+
* con `new Date()`, que lo parsearía como UTC medianoche y en zonas
|
|
6461
|
+
* negativas podría retroceder el día.
|
|
6462
|
+
* - `"2026-05-01T00:30:00+02:00"` → `"2026-05-01"` (getters locales,
|
|
6463
|
+
* nunca `toISOString()`, que convertiría a UTC y desplazaría el día).
|
|
6464
|
+
* - `Date` válido → su representación local. `null`/`undefined`/`""` o
|
|
6465
|
+
* inválido → `""` (el input queda vacío y `required` puede actuar).
|
|
6466
|
+
*
|
|
6467
|
+
* Idempotente para valores naive: aplicarla dos veces no cambia nada.
|
|
6468
|
+
*/
|
|
6469
|
+
function toDateInput(value) {
|
|
6470
|
+
if (value === null || value === undefined)
|
|
6471
|
+
return '';
|
|
6472
|
+
if (value instanceof Date) {
|
|
6473
|
+
return isValidDate(value)
|
|
6474
|
+
? formatLocal(value).split('T')[0]
|
|
6475
|
+
: '';
|
|
6476
|
+
}
|
|
6477
|
+
if (typeof value !== 'string' || value === '')
|
|
6478
|
+
return '';
|
|
6479
|
+
if (NAIVE_DATE_RE.test(value))
|
|
6480
|
+
return value;
|
|
6481
|
+
const d = new Date(value);
|
|
6482
|
+
return isValidDate(d) ? formatLocal(d).split('T')[0] : '';
|
|
6483
|
+
}
|
|
6441
6484
|
/**
|
|
6442
6485
|
* Conversión inversa para el guardado: un naive `"YYYY-MM-DDTHH:mm"` (lo que
|
|
6443
6486
|
* emite el input) se interpreta como pared horaria LOCAL del navegador y se
|
|
@@ -6466,7 +6509,104 @@ function datetimeLocalToIso(value) {
|
|
|
6466
6509
|
return isValidDate(d) ? d.toISOString() : '';
|
|
6467
6510
|
}
|
|
6468
6511
|
|
|
6512
|
+
class XSFormlyDateComponent extends XSFormlyBaseComponent {
|
|
6513
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
6514
|
+
valueChangesSub = new Subscription();
|
|
6515
|
+
constructor(translateService) {
|
|
6516
|
+
super();
|
|
6517
|
+
this.xsTranslateService = translateService;
|
|
6518
|
+
}
|
|
6519
|
+
ngOnInit() {
|
|
6520
|
+
super.ngOnInit();
|
|
6521
|
+
// El input date solo acepta YYYY-MM-DD; un ISO con hora o un Date
|
|
6522
|
+
// lo sanea a vacío. Se normaliza sin emitir evento para no simular
|
|
6523
|
+
// una edición del usuario (el modelo de Formly conserva su valor).
|
|
6524
|
+
this.normalize();
|
|
6525
|
+
this.valueChangesSub.add(this.control?.valueChanges.subscribe(() => {
|
|
6526
|
+
this.normalize();
|
|
6527
|
+
}));
|
|
6528
|
+
}
|
|
6529
|
+
ngOnDestroy() {
|
|
6530
|
+
this.valueChangesSub.unsubscribe();
|
|
6531
|
+
super.ngOnDestroy();
|
|
6532
|
+
}
|
|
6533
|
+
normalize() {
|
|
6534
|
+
const current = this.control?.value;
|
|
6535
|
+
const normalized = toDateInput(current);
|
|
6536
|
+
if (normalized !== (current ?? '')) {
|
|
6537
|
+
this.control.setValue(normalized, { emitEvent: false });
|
|
6538
|
+
this.changeDetectorRef.markForCheck();
|
|
6539
|
+
}
|
|
6540
|
+
}
|
|
6541
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6542
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyDateComponent, isStandalone: true, selector: "xs-formly-date", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-date-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [id]=\"id\"\n [formControl]=\"control\"\n type=\"date\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl h-[54px]\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6543
|
+
}
|
|
6544
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateComponent, decorators: [{
|
|
6545
|
+
type: Component,
|
|
6546
|
+
args: [{ selector: 'xs-formly-date', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
6547
|
+
CommonModule,
|
|
6548
|
+
ReactiveFormsModule,
|
|
6549
|
+
XSFormlyLabelComponent,
|
|
6550
|
+
], template: "<div [id]=\"'xs-formly-date-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [id]=\"id\"\n [formControl]=\"control\"\n type=\"date\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl h-[54px]\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6551
|
+
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6552
|
+
|
|
6553
|
+
class XSFormlyDateRangeComponent extends XSFormlyBaseComponent {
|
|
6554
|
+
constructor(translateService) {
|
|
6555
|
+
super();
|
|
6556
|
+
this.xsTranslateService = translateService;
|
|
6557
|
+
}
|
|
6558
|
+
get currentValue() {
|
|
6559
|
+
return (this.control?.value ?? {});
|
|
6560
|
+
}
|
|
6561
|
+
get startValue() {
|
|
6562
|
+
return this.formatDate(this.currentValue['start']);
|
|
6563
|
+
}
|
|
6564
|
+
get endValue() {
|
|
6565
|
+
return this.formatDate(this.currentValue['end']);
|
|
6566
|
+
}
|
|
6567
|
+
get startLabel() {
|
|
6568
|
+
return this.translateLabel('FORM.DATE_RANGE.START_LABEL');
|
|
6569
|
+
}
|
|
6570
|
+
get endLabel() {
|
|
6571
|
+
return this.translateLabel('FORM.DATE_RANGE.END_LABEL');
|
|
6572
|
+
}
|
|
6573
|
+
updateRange(key, value) {
|
|
6574
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6575
|
+
return;
|
|
6576
|
+
const next = {
|
|
6577
|
+
...this.currentValue,
|
|
6578
|
+
[key]: value ? toDateInput(value) : null,
|
|
6579
|
+
};
|
|
6580
|
+
this.control.setValue(next);
|
|
6581
|
+
this.control.markAsTouched();
|
|
6582
|
+
}
|
|
6583
|
+
formatDate(value) {
|
|
6584
|
+
if (value == null) {
|
|
6585
|
+
return '';
|
|
6586
|
+
}
|
|
6587
|
+
if (value instanceof Date) {
|
|
6588
|
+
return toDateInput(value);
|
|
6589
|
+
}
|
|
6590
|
+
if (typeof value !== 'string') {
|
|
6591
|
+
return '';
|
|
6592
|
+
}
|
|
6593
|
+
return toDateInput(value);
|
|
6594
|
+
}
|
|
6595
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateRangeComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6596
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyDateRangeComponent, isStandalone: true, selector: "xs-formly-date-range", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-date-range-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <div>\n <label\n [for]=\"id + '-start'\"\n class=\"block text-xs text-zinc-400\"\n >{{ startLabel }}</label\n >\n <input\n [id]=\"id + '-start'\"\n type=\"date\"\n [value]=\"startValue\"\n (change)=\"updateRange('start', $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n <div>\n <label\n [for]=\"id + '-end'\"\n class=\"block text-xs text-zinc-400\"\n >{{ endLabel }}</label\n >\n <input\n [id]=\"id + '-end'\"\n type=\"date\"\n [value]=\"endValue\"\n (change)=\"updateRange('end', $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6597
|
+
}
|
|
6598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDateRangeComponent, decorators: [{
|
|
6599
|
+
type: Component,
|
|
6600
|
+
args: [{ selector: 'xs-formly-date-range', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
6601
|
+
CommonModule,
|
|
6602
|
+
ReactiveFormsModule,
|
|
6603
|
+
XSFormlyLabelComponent,
|
|
6604
|
+
], template: "<div [id]=\"'xs-formly-date-range-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"grid gap-3 md:grid-cols-2\">\n <div>\n <label\n [for]=\"id + '-start'\"\n class=\"block text-xs text-zinc-400\"\n >{{ startLabel }}</label\n >\n <input\n [id]=\"id + '-start'\"\n type=\"date\"\n [value]=\"startValue\"\n (change)=\"updateRange('start', $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n <div>\n <label\n [for]=\"id + '-end'\"\n class=\"block text-xs text-zinc-400\"\n >{{ endLabel }}</label\n >\n <input\n [id]=\"id + '-end'\"\n type=\"date\"\n [value]=\"endValue\"\n (change)=\"updateRange('end', $event.target.value)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"mt-1 w-full input rounded-xl\"\n />\n </div>\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6605
|
+
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6606
|
+
|
|
6469
6607
|
class XSFormlyDatetimeComponent extends XSFormlyBaseComponent {
|
|
6608
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
6609
|
+
valueChangesSub = new Subscription();
|
|
6470
6610
|
constructor(translateService) {
|
|
6471
6611
|
super();
|
|
6472
6612
|
this.xsTranslateService = translateService;
|
|
@@ -6475,13 +6615,24 @@ class XSFormlyDatetimeComponent extends XSFormlyBaseComponent {
|
|
|
6475
6615
|
super.ngOnInit();
|
|
6476
6616
|
// El backend entrega ISO con zona ("...Z") pero el input datetime-local
|
|
6477
6617
|
// solo acepta fecha-hora local sin zona; sin normalizar, el navegador lo
|
|
6478
|
-
// sanea a vacío. Se normaliza
|
|
6479
|
-
// para no simular una edición del usuario (el modelo de Formly
|
|
6480
|
-
// su valor; el submit lee el FormGroup, ya normalizado).
|
|
6618
|
+
// sanea a vacío. Se normaliza al init y ante valores tardíos, sin emitir
|
|
6619
|
+
// evento para no simular una edición del usuario (el modelo de Formly
|
|
6620
|
+
// conserva su valor; el submit lee el FormGroup, ya normalizado).
|
|
6621
|
+
this.normalize();
|
|
6622
|
+
this.valueChangesSub.add(this.control?.valueChanges.subscribe(() => {
|
|
6623
|
+
this.normalize();
|
|
6624
|
+
}));
|
|
6625
|
+
}
|
|
6626
|
+
ngOnDestroy() {
|
|
6627
|
+
this.valueChangesSub.unsubscribe();
|
|
6628
|
+
super.ngOnDestroy();
|
|
6629
|
+
}
|
|
6630
|
+
normalize() {
|
|
6481
6631
|
const current = this.control?.value;
|
|
6482
6632
|
const normalized = toDatetimeLocalInput(current);
|
|
6483
6633
|
if (normalized !== (current ?? '')) {
|
|
6484
6634
|
this.control.setValue(normalized, { emitEvent: false });
|
|
6635
|
+
this.changeDetectorRef.markForCheck();
|
|
6485
6636
|
}
|
|
6486
6637
|
}
|
|
6487
6638
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyDatetimeComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -6511,7 +6662,7 @@ class XSFormlyInputComponent extends XSFormlyBaseComponent {
|
|
|
6511
6662
|
this.xsTranslateService = translateService;
|
|
6512
6663
|
}
|
|
6513
6664
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyInputComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6514
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyInputComponent, isStandalone: true, selector: "xs-formly-input", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-input-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [formControl]=\"control\"\n [id]=\"id\"\n [type]=\"props.type || 'text'\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.inputmode]=\"props['inputmode']\"\n [attr.maxlength]=\"props['maxlength']\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400\">\n {{ props.description }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6665
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyInputComponent, isStandalone: true, selector: "xs-formly-input", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-input-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [formControl]=\"control\"\n [id]=\"id\"\n [type]=\"props.type || 'text'\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.inputmode]=\"props['inputmode']\"\n [attr.maxlength]=\"props['maxlength']\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400\">\n {{ props.description }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6515
6666
|
}
|
|
6516
6667
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyInputComponent, decorators: [{
|
|
6517
6668
|
type: Component,
|
|
@@ -6519,7 +6670,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6519
6670
|
CommonModule,
|
|
6520
6671
|
ReactiveFormsModule,
|
|
6521
6672
|
XSFormlyLabelComponent,
|
|
6522
|
-
], template: "<div [id]=\"'xs-formly-input-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [formControl]=\"control\"\n [id]=\"id\"\n [type]=\"props.type || 'text'\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.inputmode]=\"props['inputmode']\"\n [attr.maxlength]=\"props['maxlength']\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400\">\n {{ props.description }}\n </p>\n }\n</div>\n" }]
|
|
6673
|
+
], template: "<div [id]=\"'xs-formly-input-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <input\n [formControl]=\"control\"\n [id]=\"id\"\n [type]=\"props.type || 'text'\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.inputmode]=\"props['inputmode']\"\n [attr.maxlength]=\"props['maxlength']\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n />\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400\">\n {{ props.description }}\n </p>\n }\n</div>\n" }]
|
|
6523
6674
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6524
6675
|
|
|
6525
6676
|
class XSFormlySelectionListComponent extends XSFormlyBaseComponent {
|
|
@@ -6529,24 +6680,35 @@ class XSFormlySelectionListComponent extends XSFormlyBaseComponent {
|
|
|
6529
6680
|
}
|
|
6530
6681
|
get listOptions() {
|
|
6531
6682
|
return Array.isArray(this.props['options'])
|
|
6532
|
-
? this.props['options'].map((option) => ({
|
|
6683
|
+
? this.props['options'].map((option, index) => ({
|
|
6533
6684
|
id: option.id ??
|
|
6534
6685
|
option._id ??
|
|
6535
6686
|
option.value ??
|
|
6536
|
-
option.key
|
|
6687
|
+
option.key ??
|
|
6688
|
+
option ??
|
|
6689
|
+
index,
|
|
6537
6690
|
name: option.name ?? option.label ?? String(option),
|
|
6538
6691
|
subtitle: option.subtitle,
|
|
6539
6692
|
}))
|
|
6540
6693
|
: [];
|
|
6541
6694
|
}
|
|
6542
6695
|
isSelected(option) {
|
|
6543
|
-
|
|
6696
|
+
const value = this.control?.value;
|
|
6697
|
+
return value != null && String(value) === String(option.id);
|
|
6544
6698
|
}
|
|
6545
6699
|
toggleOption(option) {
|
|
6546
|
-
this.control?.
|
|
6700
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6701
|
+
return;
|
|
6702
|
+
if (this.isSelected(option) && !this.props['required']) {
|
|
6703
|
+
this.control?.setValue(null);
|
|
6704
|
+
}
|
|
6705
|
+
else {
|
|
6706
|
+
this.control?.setValue(option.id);
|
|
6707
|
+
}
|
|
6708
|
+
this.control?.markAsTouched();
|
|
6547
6709
|
}
|
|
6548
6710
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectionListComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectionListComponent, isStandalone: true, selector: "xs-formly-selection-list", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-selection-list-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n\n <div class=\"grid gap-2 md:grid-cols-2\">\n
|
|
6711
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectionListComponent, isStandalone: true, selector: "xs-formly-selection-list", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-selection-list-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n\n <div class=\"grid gap-2 md:grid-cols-2\">\n @for (option of listOptions; track option.id) {\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n class=\"rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] flex items-center text-left uppercase button-interaction\"\n [class.bg-white/10]=\"isSelected(option)\"\n [class.ring-1]=\"isSelected(option)\"\n [class.ring-white/40]=\"isSelected(option)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-pressed]=\"isSelected(option)\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n (click)=\"toggleOption(option)\"\n >\n <div class=\"min-w-0\">\n <div class=\"font-semibold text-white truncate\">\n {{ option.name }}\n </div>\n @if (option.subtitle) {\n <div\n class=\"text-xs text-zinc-400 truncate normal-case\"\n >\n {{ option.subtitle }}\n </div>\n }\n </div>\n </button>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6550
6712
|
}
|
|
6551
6713
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectionListComponent, decorators: [{
|
|
6552
6714
|
type: Component,
|
|
@@ -6554,7 +6716,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6554
6716
|
CommonModule,
|
|
6555
6717
|
ReactiveFormsModule,
|
|
6556
6718
|
XSFormlyLabelComponent,
|
|
6557
|
-
], template: "<div [id]=\"'xs-formly-selection-list-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n\n <div class=\"grid gap-2 md:grid-cols-2\">\n
|
|
6719
|
+
], template: "<div [id]=\"'xs-formly-selection-list-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [asHeading]=\"true\"\n />\n\n <div class=\"grid gap-2 md:grid-cols-2\">\n @for (option of listOptions; track option.id) {\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n class=\"rounded-xl bg-zinc-900/50 px-4 h-[54px] min-h-[54px] flex items-center text-left uppercase button-interaction\"\n [class.bg-white/10]=\"isSelected(option)\"\n [class.ring-1]=\"isSelected(option)\"\n [class.ring-white/40]=\"isSelected(option)\"\n [disabled]=\"props.disabled || control?.disabled\"\n [attr.aria-pressed]=\"isSelected(option)\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n (click)=\"toggleOption(option)\"\n >\n <div class=\"min-w-0\">\n <div class=\"font-semibold text-white truncate\">\n {{ option.name }}\n </div>\n @if (option.subtitle) {\n <div\n class=\"text-xs text-zinc-400 truncate normal-case\"\n >\n {{ option.subtitle }}\n </div>\n }\n </div>\n </button>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
6558
6720
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6559
6721
|
|
|
6560
6722
|
class XSFormlySelectButtonComponent extends XSFormlyBaseComponent {
|
|
@@ -6617,6 +6779,8 @@ class XSFormlySelectButtonComponent extends XSFormlyBaseComponent {
|
|
|
6617
6779
|
: val) === String(option.id));
|
|
6618
6780
|
}
|
|
6619
6781
|
isDisabled(option) {
|
|
6782
|
+
if (this.props['disabled'] || this.control?.disabled)
|
|
6783
|
+
return true;
|
|
6620
6784
|
if (option.disabled)
|
|
6621
6785
|
return true;
|
|
6622
6786
|
const dOps = Array.isArray(this.props['disabledOptions'])
|
|
@@ -6682,6 +6846,8 @@ class XSFormlySelectButtonComponent extends XSFormlyBaseComponent {
|
|
|
6682
6846
|
? option.id
|
|
6683
6847
|
: option);
|
|
6684
6848
|
}
|
|
6849
|
+
this.control?.markAsTouched();
|
|
6850
|
+
this.control?.markAsDirty();
|
|
6685
6851
|
}
|
|
6686
6852
|
toggleExpand() {
|
|
6687
6853
|
this.isExpanded.set(!this.isExpanded());
|
|
@@ -6693,7 +6859,7 @@ class XSFormlySelectButtonComponent extends XSFormlyBaseComponent {
|
|
|
6693
6859
|
return this.xsTranslateService.translate('FORM.SELECT_BUTTON.SHOW_ALL');
|
|
6694
6860
|
}
|
|
6695
6861
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectButtonComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
6696
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectButtonComponent, isStandalone: true, selector: "xs-formly-select-button", usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div [class]=\"gridClass\">\n @for (option of visibleOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n\n @if (isExpanded()) {\n @for (option of hiddenOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n }\n\n @if (isSmall && hasMoreOptions) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-5 py-2.5 rounded-xl bg-zinc-900/50 text-zinc-500 hover:text-zinc-200 transition-all duration-300 text-[11px] font-bold uppercase tracking-widest border-none outline-none active:scale-95 flex items-center justify-center min-h-[40px]\"\n >\n @if (isExpanded()) {\n <span>-{{ buttonOptions.length - showMoreLimit }}</span>\n } @else {\n <span>+{{ buttonOptions.length - showMoreLimit }}</span>\n }\n </button>\n }\n </div>\n\n <ng-template #buttonTemplate let-option>\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n (click)=\"selectOption(option)\"\n [disabled]=\"isDisabled(option)\"\n [class]=\"buttonClass(option)\"\n class=\"group relative transition-all duration-300 outline-none border-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 active:scale-[0.97] overflow-hidden\"\n >\n @if (isSmall) {\n <div\n class=\"flex items-center justify-center h-full transition-all duration-300 ease-out min-h-[40px] px-5\"\n [class.px-4]=\"isSelected(option)\"\n >\n <span\n [class]=\"\n isSelected(option)\n ? 'text-white'\n : 'text-zinc-500 group-hover:text-zinc-300'\n \"\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] truncate transition-colors duration-300 z-10\"\n >\n {{ option.name }}\n </span>\n @if (isSelected(option)) {\n <div\n class=\"ml-2 animate-in fade-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-white text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n } @else {\n <div\n class=\"relative w-full aspect-[16/10] rounded-xl overflow-hidden bg-zinc-900 ring-0 transition-all duration-300\"\n >\n <xs-image\n [src]=\"\n option.image || 'assets/images/default-user.webp'\n \"\n [customClass]=\"'w-full h-full object-cover transition-transform duration-700 group-hover:scale-110'\"\n [class.opacity-40]=\"!isSelected(option)\"\n ></xs-image>\n <div\n class=\"absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent z-20\"\n ></div>\n <div\n class=\"absolute bottom-0 left-0 w-full p-3 text-left z-30\"\n >\n <div\n class=\"text-sm font-black tracking-[0.15em] text-white uppercase\"\n >\n {{ option.name }}\n </div>\n </div>\n @if (isSelected(option)) {\n <div\n class=\"absolute top-3 right-3 bg-white w-5 h-5 rounded-full flex items-center justify-center z-40 animate-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-black text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n }\n </button>\n </ng-template>\n\n @if (!isSmall && hasMoreOptions) {\n <div class=\"flex justify-center mt-6\">\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-8 py-3 rounded-xl bg-zinc-950 text-zinc-400 hover:text-white transition-colors duration-300 text-[10px] font-black uppercase tracking-[0.25em] border border-white/5\"\n >\n {{ isExpanded() ? expandedText : collapsedText }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold text-red-500 uppercase tracking-widest mt-2 ml-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSIconComponent, selector: "xs-icon", inputs: ["icon", "size", "class"] }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6862
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectButtonComponent, isStandalone: true, selector: "xs-formly-select-button", usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div [class]=\"gridClass\">\n @for (option of visibleOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n\n @if (isExpanded()) {\n @for (option of hiddenOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n }\n\n @if (isSmall && hasMoreOptions) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-5 py-2.5 rounded-xl bg-zinc-900/50 text-zinc-500 hover:text-zinc-200 transition-all duration-300 text-[11px] font-bold uppercase tracking-widest border-none outline-none active:scale-95 flex items-center justify-center min-h-[40px]\"\n >\n @if (isExpanded()) {\n <span>-{{ buttonOptions.length - showMoreLimit }}</span>\n } @else {\n <span>+{{ buttonOptions.length - showMoreLimit }}</span>\n }\n </button>\n }\n </div>\n\n <ng-template #buttonTemplate let-option>\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n (click)=\"selectOption(option)\"\n [disabled]=\"isDisabled(option)\"\n [attr.aria-pressed]=\"isSelected(option)\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n [class]=\"buttonClass(option)\"\n class=\"group relative transition-all duration-300 outline-none border-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 active:scale-[0.97] overflow-hidden\"\n >\n @if (isSmall) {\n <div\n class=\"flex items-center justify-center h-full transition-all duration-300 ease-out min-h-[40px] px-5\"\n [class.px-4]=\"isSelected(option)\"\n >\n <span\n [class]=\"\n isSelected(option)\n ? 'text-white'\n : 'text-zinc-500 group-hover:text-zinc-300'\n \"\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] truncate transition-colors duration-300 z-10\"\n >\n {{ option.name }}\n </span>\n @if (isSelected(option)) {\n <div\n class=\"ml-2 animate-in fade-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-white text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n } @else {\n <div\n class=\"relative w-full aspect-[16/10] rounded-xl overflow-hidden bg-zinc-900 ring-0 transition-all duration-300\"\n >\n <xs-image\n [src]=\"\n option.image || 'assets/images/default-user.webp'\n \"\n [customClass]=\"'w-full h-full object-cover transition-transform duration-700 group-hover:scale-110'\"\n [class.opacity-40]=\"!isSelected(option)\"\n ></xs-image>\n <div\n class=\"absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent z-20\"\n ></div>\n <div\n class=\"absolute bottom-0 left-0 w-full p-3 text-left z-30\"\n >\n <div\n class=\"text-sm font-black tracking-[0.15em] text-white uppercase\"\n >\n {{ option.name }}\n </div>\n </div>\n @if (isSelected(option)) {\n <div\n class=\"absolute top-3 right-3 bg-white w-5 h-5 rounded-full flex items-center justify-center z-40 animate-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-black text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n }\n </button>\n </ng-template>\n\n @if (!isSmall && hasMoreOptions) {\n <div class=\"flex justify-center mt-6\">\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-8 py-3 rounded-xl bg-zinc-950 text-zinc-400 hover:text-white transition-colors duration-300 text-[10px] font-black uppercase tracking-[0.25em] border border-white/5\"\n >\n {{ isExpanded() ? expandedText : collapsedText }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold text-red-500 uppercase tracking-widest mt-2 ml-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSIconComponent, selector: "xs-icon", inputs: ["icon", "size", "class"] }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6697
6863
|
}
|
|
6698
6864
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectButtonComponent, decorators: [{
|
|
6699
6865
|
type: Component,
|
|
@@ -6703,7 +6869,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
6703
6869
|
XSIconComponent,
|
|
6704
6870
|
XSImageComponent,
|
|
6705
6871
|
XSFormlyLabelComponent,
|
|
6706
|
-
], template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div [class]=\"gridClass\">\n @for (option of visibleOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n\n @if (isExpanded()) {\n @for (option of hiddenOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n }\n\n @if (isSmall && hasMoreOptions) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-5 py-2.5 rounded-xl bg-zinc-900/50 text-zinc-500 hover:text-zinc-200 transition-all duration-300 text-[11px] font-bold uppercase tracking-widest border-none outline-none active:scale-95 flex items-center justify-center min-h-[40px]\"\n >\n @if (isExpanded()) {\n <span>-{{ buttonOptions.length - showMoreLimit }}</span>\n } @else {\n <span>+{{ buttonOptions.length - showMoreLimit }}</span>\n }\n </button>\n }\n </div>\n\n <ng-template #buttonTemplate let-option>\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n (click)=\"selectOption(option)\"\n [disabled]=\"isDisabled(option)\"\n [class]=\"buttonClass(option)\"\n class=\"group relative transition-all duration-300 outline-none border-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 active:scale-[0.97] overflow-hidden\"\n >\n @if (isSmall) {\n <div\n class=\"flex items-center justify-center h-full transition-all duration-300 ease-out min-h-[40px] px-5\"\n [class.px-4]=\"isSelected(option)\"\n >\n <span\n [class]=\"\n isSelected(option)\n ? 'text-white'\n : 'text-zinc-500 group-hover:text-zinc-300'\n \"\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] truncate transition-colors duration-300 z-10\"\n >\n {{ option.name }}\n </span>\n @if (isSelected(option)) {\n <div\n class=\"ml-2 animate-in fade-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-white text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n } @else {\n <div\n class=\"relative w-full aspect-[16/10] rounded-xl overflow-hidden bg-zinc-900 ring-0 transition-all duration-300\"\n >\n <xs-image\n [src]=\"\n option.image || 'assets/images/default-user.webp'\n \"\n [customClass]=\"'w-full h-full object-cover transition-transform duration-700 group-hover:scale-110'\"\n [class.opacity-40]=\"!isSelected(option)\"\n ></xs-image>\n <div\n class=\"absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent z-20\"\n ></div>\n <div\n class=\"absolute bottom-0 left-0 w-full p-3 text-left z-30\"\n >\n <div\n class=\"text-sm font-black tracking-[0.15em] text-white uppercase\"\n >\n {{ option.name }}\n </div>\n </div>\n @if (isSelected(option)) {\n <div\n class=\"absolute top-3 right-3 bg-white w-5 h-5 rounded-full flex items-center justify-center z-40 animate-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-black text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n }\n </button>\n </ng-template>\n\n @if (!isSmall && hasMoreOptions) {\n <div class=\"flex justify-center mt-6\">\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-8 py-3 rounded-xl bg-zinc-950 text-zinc-400 hover:text-white transition-colors duration-300 text-[10px] font-black uppercase tracking-[0.25em] border border-white/5\"\n >\n {{ isExpanded() ? expandedText : collapsedText }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold text-red-500 uppercase tracking-widest mt-2 ml-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n" }]
|
|
6872
|
+
], template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div [class]=\"gridClass\">\n @for (option of visibleOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n\n @if (isExpanded()) {\n @for (option of hiddenOptions; track option.id) {\n <ng-container\n *ngTemplateOutlet=\"\n buttonTemplate;\n context: { $implicit: option }\n \"\n ></ng-container>\n }\n }\n\n @if (isSmall && hasMoreOptions) {\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-5 py-2.5 rounded-xl bg-zinc-900/50 text-zinc-500 hover:text-zinc-200 transition-all duration-300 text-[11px] font-bold uppercase tracking-widest border-none outline-none active:scale-95 flex items-center justify-center min-h-[40px]\"\n >\n @if (isExpanded()) {\n <span>-{{ buttonOptions.length - showMoreLimit }}</span>\n } @else {\n <span>+{{ buttonOptions.length - showMoreLimit }}</span>\n }\n </button>\n }\n </div>\n\n <ng-template #buttonTemplate let-option>\n <button\n type=\"button\"\n [id]=\"id + '-option-' + option.id\"\n (click)=\"selectOption(option)\"\n [disabled]=\"isDisabled(option)\"\n [attr.aria-pressed]=\"isSelected(option)\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n [class]=\"buttonClass(option)\"\n class=\"group relative transition-all duration-300 outline-none border-none focus:outline-none focus:ring-0 focus-visible:outline-none focus-visible:ring-0 active:scale-[0.97] overflow-hidden\"\n >\n @if (isSmall) {\n <div\n class=\"flex items-center justify-center h-full transition-all duration-300 ease-out min-h-[40px] px-5\"\n [class.px-4]=\"isSelected(option)\"\n >\n <span\n [class]=\"\n isSelected(option)\n ? 'text-white'\n : 'text-zinc-500 group-hover:text-zinc-300'\n \"\n class=\"text-[11px] font-bold uppercase tracking-[0.15em] truncate transition-colors duration-300 z-10\"\n >\n {{ option.name }}\n </span>\n @if (isSelected(option)) {\n <div\n class=\"ml-2 animate-in fade-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-white text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n } @else {\n <div\n class=\"relative w-full aspect-[16/10] rounded-xl overflow-hidden bg-zinc-900 ring-0 transition-all duration-300\"\n >\n <xs-image\n [src]=\"\n option.image || 'assets/images/default-user.webp'\n \"\n [customClass]=\"'w-full h-full object-cover transition-transform duration-700 group-hover:scale-110'\"\n [class.opacity-40]=\"!isSelected(option)\"\n ></xs-image>\n <div\n class=\"absolute inset-0 bg-gradient-to-t from-black via-black/40 to-transparent z-20\"\n ></div>\n <div\n class=\"absolute bottom-0 left-0 w-full p-3 text-left z-30\"\n >\n <div\n class=\"text-sm font-black tracking-[0.15em] text-white uppercase\"\n >\n {{ option.name }}\n </div>\n </div>\n @if (isSelected(option)) {\n <div\n class=\"absolute top-3 right-3 bg-white w-5 h-5 rounded-full flex items-center justify-center z-40 animate-in zoom-in duration-300\"\n >\n <xs-icon\n icon=\"check\"\n class=\"text-black text-[10px]\"\n ></xs-icon>\n </div>\n }\n </div>\n }\n </button>\n </ng-template>\n\n @if (!isSmall && hasMoreOptions) {\n <div class=\"flex justify-center mt-6\">\n <button\n type=\"button\"\n (click)=\"toggleExpand()\"\n class=\"px-8 py-3 rounded-xl bg-zinc-950 text-zinc-400 hover:text-white transition-colors duration-300 text-[10px] font-black uppercase tracking-[0.25em] border border-white/5\"\n >\n {{ isExpanded() ? expandedText : collapsedText }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p\n [id]=\"'error-' + id\"\n class=\"text-[10px] font-bold text-red-500 uppercase tracking-widest mt-2 ml-1\"\n >\n {{ errorMessage }}\n </p>\n }\n</div>\n" }]
|
|
6707
6873
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
6708
6874
|
|
|
6709
6875
|
class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
@@ -6726,6 +6892,19 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
6726
6892
|
return 'formly-field-wrapper relative';
|
|
6727
6893
|
}
|
|
6728
6894
|
isDropdownOpen = signal(false, ...(ngDevMode ? [{ debugName: "isDropdownOpen" }] : []));
|
|
6895
|
+
get isFieldDisabled() {
|
|
6896
|
+
return (!!this.selectProps.disabled || !!this.control?.disabled);
|
|
6897
|
+
}
|
|
6898
|
+
lastOptionsSignature = '';
|
|
6899
|
+
ngDoCheck() {
|
|
6900
|
+
const signature = this.selectOptions
|
|
6901
|
+
.map((option) => String(option.id))
|
|
6902
|
+
.join('|');
|
|
6903
|
+
if (signature !== this.lastOptionsSignature) {
|
|
6904
|
+
this.lastOptionsSignature = signature;
|
|
6905
|
+
this.updateSelectedOptions();
|
|
6906
|
+
}
|
|
6907
|
+
}
|
|
6729
6908
|
dropdownTop = 0;
|
|
6730
6909
|
dropdownLeft = 0;
|
|
6731
6910
|
dropdownWidth = 0;
|
|
@@ -6949,6 +7128,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
6949
7128
|
}
|
|
6950
7129
|
}
|
|
6951
7130
|
openDropdown() {
|
|
7131
|
+
if (this.isFieldDisabled)
|
|
7132
|
+
return;
|
|
6952
7133
|
if (!this.isDropdownOpen()) {
|
|
6953
7134
|
this.isDropdownOpen.set(true);
|
|
6954
7135
|
this.openedAt = Date.now();
|
|
@@ -6959,6 +7140,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
6959
7140
|
}
|
|
6960
7141
|
}
|
|
6961
7142
|
toggleDropdown() {
|
|
7143
|
+
if (this.isFieldDisabled)
|
|
7144
|
+
return;
|
|
6962
7145
|
this.isDropdownOpen.update((v) => !v);
|
|
6963
7146
|
if (this.isDropdownOpen()) {
|
|
6964
7147
|
this.openedAt = Date.now();
|
|
@@ -7019,6 +7202,7 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7019
7202
|
}
|
|
7020
7203
|
const list = this.renderer.createElement('ul');
|
|
7021
7204
|
this.renderer.setAttribute(list, 'role', 'listbox');
|
|
7205
|
+
this.renderer.setAttribute(list, 'id', this.optionsListId);
|
|
7022
7206
|
this.renderer.setStyle(list, 'max-height', '12rem');
|
|
7023
7207
|
this.renderer.setStyle(list, 'overflow-y', 'auto');
|
|
7024
7208
|
this.renderer.setStyle(list, 'overscroll-behavior', 'contain');
|
|
@@ -7077,6 +7261,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7077
7261
|
for (const option of options) {
|
|
7078
7262
|
const li = this.renderer.createElement('li');
|
|
7079
7263
|
this.renderer.setAttribute(li, 'role', 'option');
|
|
7264
|
+
this.renderer.setAttribute(li, 'id', `${this.optionsListId}-${option.id}`);
|
|
7265
|
+
this.renderer.setAttribute(li, 'aria-selected', selectedIds.has(option.id) ? 'true' : 'false');
|
|
7080
7266
|
this.renderer.setStyle(li, 'display', 'flex');
|
|
7081
7267
|
this.renderer.setStyle(li, 'align-items', 'center');
|
|
7082
7268
|
this.renderer.setStyle(li, 'gap', '0.75rem');
|
|
@@ -7207,6 +7393,14 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7207
7393
|
event.stopPropagation();
|
|
7208
7394
|
}
|
|
7209
7395
|
onKeyDown(event) {
|
|
7396
|
+
if (event.key === 'Escape') {
|
|
7397
|
+
if (this.isDropdownOpen()) {
|
|
7398
|
+
event.preventDefault();
|
|
7399
|
+
event.stopPropagation();
|
|
7400
|
+
this.closeDropdown();
|
|
7401
|
+
}
|
|
7402
|
+
return;
|
|
7403
|
+
}
|
|
7210
7404
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
7211
7405
|
event.preventDefault();
|
|
7212
7406
|
this.toggleDropdown();
|
|
@@ -7242,8 +7436,12 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7242
7436
|
return [...selected, ...rest];
|
|
7243
7437
|
}
|
|
7244
7438
|
clearSelection() {
|
|
7439
|
+
if (this.isFieldDisabled)
|
|
7440
|
+
return;
|
|
7245
7441
|
this.control.setValue(null);
|
|
7246
7442
|
this.selectedOptionsInternal.set([]);
|
|
7443
|
+
this.control.markAsTouched();
|
|
7444
|
+
this.control.markAsDirty();
|
|
7247
7445
|
}
|
|
7248
7446
|
isInjectedOption(option) {
|
|
7249
7447
|
const selected = this.selectedOptionsInternal();
|
|
@@ -7253,6 +7451,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7253
7451
|
!this.originalOptionIds.has(option.id));
|
|
7254
7452
|
}
|
|
7255
7453
|
onOptionClick(option) {
|
|
7454
|
+
if (this.isFieldDisabled)
|
|
7455
|
+
return;
|
|
7256
7456
|
if (this.isOptionSelectionDisabled(option)) {
|
|
7257
7457
|
return;
|
|
7258
7458
|
}
|
|
@@ -7280,6 +7480,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7280
7480
|
this.control.setValue(this.returnValue === 'id'
|
|
7281
7481
|
? this.selectedOptionsInternal().map((item) => item.id)
|
|
7282
7482
|
: [...this.selectedOptionsInternal()]);
|
|
7483
|
+
this.control.markAsTouched();
|
|
7484
|
+
this.control.markAsDirty();
|
|
7283
7485
|
}
|
|
7284
7486
|
else {
|
|
7285
7487
|
const isSelected = this.isOptionSelected(option);
|
|
@@ -7293,6 +7495,8 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7293
7495
|
this.selectedOptionsInternal.set([option]);
|
|
7294
7496
|
this.control.setValue(this.returnValue === 'id' ? option.id : option);
|
|
7295
7497
|
}
|
|
7498
|
+
this.control.markAsTouched();
|
|
7499
|
+
this.control.markAsDirty();
|
|
7296
7500
|
this.closeDropdown();
|
|
7297
7501
|
}
|
|
7298
7502
|
}
|
|
@@ -7602,7 +7806,7 @@ class XSFormlySelectComponent extends XSFormlyBaseComponent {
|
|
|
7602
7806
|
});
|
|
7603
7807
|
}
|
|
7604
7808
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7605
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectComponent, isStandalone: true, selector: "xs-formly-select", host: { listeners: { "document:click": "onDocumentClick($event)", "click": "onComponentClick($event)" } }, viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"relative overflow-visible\">\n @if (hasOptionImage && selectedOptionsInternal().length === 1) {\n <div\n class=\"flex items-center gap-3 px-4 !py-1.5 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n }\"\n data-trigger\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n tabindex=\"0\"\n >\n <div class=\"shrink-0 flex items-center justify-center overflow-hidden rounded-full w-10 h-10 bg-zinc-900\">\n @if (isCountryType) {\n <xs-image\n [src]=\"\n (selectedOptionsInternal()[0].code || selectedOptionsInternal()[0].id) | countryFlag\n \"\n [alt]=\"selectedOptionsInternal()[0].name\"\n [customClass]=\"'w-8 h-5 object-cover rounded shadow-sm border border-zinc-800'\"\n ></xs-image>\n } @else if (getOptionImage(selectedOptionsInternal()[0])) {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n } @else {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate text-sm text-white font-medium\">\n {{ selectedOptionsInternal()[0].name }}\n </div>\n @if (getOptionSubLine(selectedOptionsInternal()[0])) {\n <div class=\"truncate text-[11px] text-zinc-400\">\n {{ getOptionSubLine(selectedOptionsInternal()[0]) }}\n </div>\n }\n </div>\n\n <div class=\"shrink-0\">\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n </div>\n } @else {\n <input\n type=\"text\"\n [id]=\"id\"\n [value]=\"displaySelectedText\"\n readonly\n class=\"w-full rounded-xl pr-10 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n '!pl-14': hasOptionImage && selectedOptionsInternal().length === 1,\n }\"\n [attr.placeholder]=\"\n translateLabel(props.placeholder) || this.getTexts().SELECT_OPTION\n \"\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n />\n\n <div\n class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-4\"\n >\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }, { kind: "pipe", type: CountryFlagPipe, name: "countryFlag" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7809
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySelectComponent, isStandalone: true, selector: "xs-formly-select", host: { listeners: { "document:click": "onDocumentClick($event)", "click": "onComponentClick($event)" } }, viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"relative overflow-visible\">\n @if (hasOptionImage && selectedOptionsInternal().length === 1) {\n <div\n class=\"flex items-center gap-3 px-4 !py-1.5 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n }\"\n data-trigger\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n [attr.tabindex]=\"isFieldDisabled ? -1 : 0\"\n [class.opacity-50]=\"isFieldDisabled\"\n [class.cursor-not-allowed]=\"isFieldDisabled\"\n >\n <div class=\"shrink-0 flex items-center justify-center overflow-hidden rounded-full w-10 h-10 bg-zinc-900\">\n @if (isCountryType) {\n <xs-image\n [src]=\"\n (selectedOptionsInternal()[0].code || selectedOptionsInternal()[0].id) | countryFlag\n \"\n [alt]=\"selectedOptionsInternal()[0].name\"\n [customClass]=\"'w-8 h-5 object-cover rounded shadow-sm border border-zinc-800'\"\n ></xs-image>\n } @else if (getOptionImage(selectedOptionsInternal()[0])) {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n } @else {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate text-sm text-white font-medium\">\n {{ selectedOptionsInternal()[0].name }}\n </div>\n @if (getOptionSubLine(selectedOptionsInternal()[0])) {\n <div class=\"truncate text-[11px] text-zinc-400\">\n {{ getOptionSubLine(selectedOptionsInternal()[0]) }}\n </div>\n }\n </div>\n\n <div class=\"shrink-0\">\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n </div>\n } @else {\n <input\n type=\"text\"\n [id]=\"id\"\n [value]=\"displaySelectedText\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-disabled]=\"isFieldDisabled\"\n readonly\n class=\"w-full rounded-xl pr-10 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n '!pl-14': hasOptionImage && selectedOptionsInternal().length === 1,\n }\"\n [attr.placeholder]=\"\n translateLabel(props.placeholder) || this.getTexts().SELECT_OPTION\n \"\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n />\n\n <div\n class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-4\"\n >\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }, { kind: "pipe", type: CountryFlagPipe, name: "countryFlag" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7606
7810
|
}
|
|
7607
7811
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySelectComponent, decorators: [{
|
|
7608
7812
|
type: Component,
|
|
@@ -7615,7 +7819,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7615
7819
|
], host: {
|
|
7616
7820
|
'(document:click)': 'onDocumentClick($event)',
|
|
7617
7821
|
'(click)': 'onComponentClick($event)',
|
|
7618
|
-
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"relative overflow-visible\">\n @if (hasOptionImage && selectedOptionsInternal().length === 1) {\n <div\n class=\"flex items-center gap-3 px-4 !py-1.5 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n }\"\n data-trigger\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n tabindex=\"0\"\n >\n <div class=\"shrink-0 flex items-center justify-center overflow-hidden rounded-full w-10 h-10 bg-zinc-900\">\n @if (isCountryType) {\n <xs-image\n [src]=\"\n (selectedOptionsInternal()[0].code || selectedOptionsInternal()[0].id) | countryFlag\n \"\n [alt]=\"selectedOptionsInternal()[0].name\"\n [customClass]=\"'w-8 h-5 object-cover rounded shadow-sm border border-zinc-800'\"\n ></xs-image>\n } @else if (getOptionImage(selectedOptionsInternal()[0])) {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n } @else {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate text-sm text-white font-medium\">\n {{ selectedOptionsInternal()[0].name }}\n </div>\n @if (getOptionSubLine(selectedOptionsInternal()[0])) {\n <div class=\"truncate text-[11px] text-zinc-400\">\n {{ getOptionSubLine(selectedOptionsInternal()[0]) }}\n </div>\n }\n </div>\n\n <div class=\"shrink-0\">\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n </div>\n } @else {\n <input\n type=\"text\"\n [id]=\"id\"\n [value]=\"displaySelectedText\"\n readonly\n class=\"w-full rounded-xl pr-10 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n '!pl-14': hasOptionImage && selectedOptionsInternal().length === 1,\n }\"\n [attr.placeholder]=\"\n translateLabel(props.placeholder) || this.getTexts().SELECT_OPTION\n \"\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n />\n\n <div\n class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-4\"\n >\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7822
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <div class=\"relative overflow-visible\">\n @if (hasOptionImage && selectedOptionsInternal().length === 1) {\n <div\n class=\"flex items-center gap-3 px-4 !py-1.5 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n }\"\n data-trigger\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n [attr.tabindex]=\"isFieldDisabled ? -1 : 0\"\n [class.opacity-50]=\"isFieldDisabled\"\n [class.cursor-not-allowed]=\"isFieldDisabled\"\n >\n <div class=\"shrink-0 flex items-center justify-center overflow-hidden rounded-full w-10 h-10 bg-zinc-900\">\n @if (isCountryType) {\n <xs-image\n [src]=\"\n (selectedOptionsInternal()[0].code || selectedOptionsInternal()[0].id) | countryFlag\n \"\n [alt]=\"selectedOptionsInternal()[0].name\"\n [customClass]=\"'w-8 h-5 object-cover rounded shadow-sm border border-zinc-800'\"\n ></xs-image>\n } @else if (getOptionImage(selectedOptionsInternal()[0])) {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n } @else {\n <xs-image\n [item]=\"selectedOptionsInternal()[0].item\"\n [typeItem]=\"selectedOptionsInternal()[0].type\"\n [imageType]=\"'small'\"\n [generateAvatar]=\"true\"\n [customClass]=\"'w-10 h-10 rounded-full object-cover shadow-sm border border-zinc-800'\"\n />\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <div class=\"truncate text-sm text-white font-medium\">\n {{ selectedOptionsInternal()[0].name }}\n </div>\n @if (getOptionSubLine(selectedOptionsInternal()[0])) {\n <div class=\"truncate text-[11px] text-zinc-400\">\n {{ getOptionSubLine(selectedOptionsInternal()[0]) }}\n </div>\n }\n </div>\n\n <div class=\"shrink-0\">\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n </div>\n } @else {\n <input\n type=\"text\"\n [id]=\"id\"\n [value]=\"displaySelectedText\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-disabled]=\"isFieldDisabled\"\n readonly\n class=\"w-full rounded-xl pr-10 cursor-pointer\"\n [ngClass]=\"{\n 'input-select': props['variant'] !== 'secondary',\n 'input-select-secondary': props['variant'] === 'secondary',\n '!pl-14': hasOptionImage && selectedOptionsInternal().length === 1,\n }\"\n [attr.placeholder]=\"\n translateLabel(props.placeholder) || this.getTexts().SELECT_OPTION\n \"\n (click)=\"toggleDropdown(); $event.stopPropagation()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"isDropdownOpen() ? optionsListId : null\"\n [attr.aria-activedescendant]=\"\n isDropdownOpen() && filteredOptions().length > 0\n ? optionsListId + '-' + filteredOptions()[0].id\n : null\n \"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n />\n\n <div\n class=\"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-4\"\n >\n <svg\n class=\"w-4 h-4 text-white transition-transform duration-200\"\n [class.rotate-180]=\"isDropdownOpen()\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"2\"\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7619
7823
|
}], ctorParameters: () => [{ type: XSTranslateService }], propDecorators: { searchInputRef: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }] } });
|
|
7620
7824
|
|
|
7621
7825
|
class XSFormlyTextareaComponent extends XSFormlyBaseComponent {
|
|
@@ -7624,7 +7828,7 @@ class XSFormlyTextareaComponent extends XSFormlyBaseComponent {
|
|
|
7624
7828
|
this.xsTranslateService = translateService;
|
|
7625
7829
|
}
|
|
7626
7830
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyTextareaComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7627
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyTextareaComponent, isStandalone: true, selector: "xs-formly-textarea", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-textarea-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7831
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyTextareaComponent, isStandalone: true, selector: "xs-formly-textarea", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-textarea-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7628
7832
|
}
|
|
7629
7833
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyTextareaComponent, decorators: [{
|
|
7630
7834
|
type: Component,
|
|
@@ -7632,7 +7836,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7632
7836
|
CommonModule,
|
|
7633
7837
|
ReactiveFormsModule,
|
|
7634
7838
|
XSFormlyLabelComponent,
|
|
7635
|
-
], template: "<div [id]=\"'xs-formly-textarea-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7839
|
+
], template: "<div [id]=\"'xs-formly-textarea-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7636
7840
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
7637
7841
|
|
|
7638
7842
|
class XSFormlyTextareaSimpleComponent extends XSFormlyBaseComponent {
|
|
@@ -7641,7 +7845,7 @@ class XSFormlyTextareaSimpleComponent extends XSFormlyBaseComponent {
|
|
|
7641
7845
|
this.xsTranslateService = translateService;
|
|
7642
7846
|
}
|
|
7643
7847
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyTextareaSimpleComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7644
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyTextareaSimpleComponent, isStandalone: true, selector: "xs-formly-textarea-simple", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-textarea-simple-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7848
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyTextareaSimpleComponent, isStandalone: true, selector: "xs-formly-textarea-simple", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-textarea-simple-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7645
7849
|
}
|
|
7646
7850
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyTextareaSimpleComponent, decorators: [{
|
|
7647
7851
|
type: Component,
|
|
@@ -7649,7 +7853,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7649
7853
|
CommonModule,
|
|
7650
7854
|
ReactiveFormsModule,
|
|
7651
7855
|
XSFormlyLabelComponent,
|
|
7652
|
-
], template: "<div [id]=\"'xs-formly-textarea-simple-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7856
|
+
], template: "<div [id]=\"'xs-formly-textarea-simple-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 4\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full rounded-xl\"\n [ngClass]=\"props['variant'] === 'secondary' ? 'input-secondary' : 'input'\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7653
7857
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
7654
7858
|
|
|
7655
7859
|
var UPLOAD_IMAGE$1 = {
|
|
@@ -7678,7 +7882,9 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
|
|
|
7678
7882
|
fileInput = viewChild('fileInput', ...(ngDevMode ? [{ debugName: "fileInput" }] : []));
|
|
7679
7883
|
previewUrl;
|
|
7680
7884
|
isDragging = false;
|
|
7885
|
+
valueChangesSub = new Subscription();
|
|
7681
7886
|
translateService = inject(XSTranslateService);
|
|
7887
|
+
changeDetectorRef = inject(ChangeDetectorRef);
|
|
7682
7888
|
constructor() {
|
|
7683
7889
|
super();
|
|
7684
7890
|
this.xsTranslateService = this.translateService;
|
|
@@ -7696,35 +7902,91 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
|
|
|
7696
7902
|
get changeButtonLabel() {
|
|
7697
7903
|
return this.xsTranslateService.translate('UPLOAD_IMAGE.CHANGE_BUTTON');
|
|
7698
7904
|
}
|
|
7905
|
+
get removeButtonLabel() {
|
|
7906
|
+
return this.xsTranslateService.translate('UPLOAD_IMAGE.REMOVE_BUTTON');
|
|
7907
|
+
}
|
|
7908
|
+
get isFieldDisabled() {
|
|
7909
|
+
return !!this.props['disabled'] || !!this.control?.disabled;
|
|
7910
|
+
}
|
|
7699
7911
|
ngOnInit() {
|
|
7700
7912
|
super.ngOnInit();
|
|
7701
|
-
const
|
|
7702
|
-
if (
|
|
7703
|
-
this.
|
|
7704
|
-
val instanceof File ? URL.createObjectURL(val) : val;
|
|
7913
|
+
const initial = this.control.value;
|
|
7914
|
+
if (initial) {
|
|
7915
|
+
this.syncPreview(initial);
|
|
7705
7916
|
}
|
|
7706
7917
|
else if (this.props?.['currentImageUrl']) {
|
|
7707
7918
|
this.previewUrl = this.props['currentImageUrl'];
|
|
7708
7919
|
}
|
|
7920
|
+
this.valueChangesSub.add(this.control.valueChanges.subscribe((value) => {
|
|
7921
|
+
if (value instanceof File ||
|
|
7922
|
+
(typeof value === 'string' && value)) {
|
|
7923
|
+
this.syncPreview(value);
|
|
7924
|
+
}
|
|
7925
|
+
else if (!value) {
|
|
7926
|
+
this.revokeOldUrl();
|
|
7927
|
+
this.previewUrl = undefined;
|
|
7928
|
+
}
|
|
7929
|
+
this.changeDetectorRef.markForCheck();
|
|
7930
|
+
}));
|
|
7931
|
+
}
|
|
7932
|
+
syncPreview(value) {
|
|
7933
|
+
if (value instanceof File) {
|
|
7934
|
+
if (!this.previewUrl ||
|
|
7935
|
+
!this.previewUrl.startsWith('blob:')) {
|
|
7936
|
+
this.revokeOldUrl();
|
|
7937
|
+
this.previewUrl = URL.createObjectURL(value);
|
|
7938
|
+
}
|
|
7939
|
+
return;
|
|
7940
|
+
}
|
|
7941
|
+
if (this.previewUrl !== value) {
|
|
7942
|
+
this.revokeOldUrl();
|
|
7943
|
+
this.previewUrl = value;
|
|
7944
|
+
}
|
|
7709
7945
|
}
|
|
7710
7946
|
onFileChange(event) {
|
|
7947
|
+
if (this.isFieldDisabled)
|
|
7948
|
+
return;
|
|
7711
7949
|
const input = event.target;
|
|
7712
7950
|
if (input.files?.[0]) {
|
|
7713
7951
|
this.processFile(input.files[0]);
|
|
7714
7952
|
}
|
|
7953
|
+
input.value = '';
|
|
7954
|
+
}
|
|
7955
|
+
onDrop(event) {
|
|
7956
|
+
event.preventDefault();
|
|
7957
|
+
this.isDragging = false;
|
|
7958
|
+
if (this.isFieldDisabled)
|
|
7959
|
+
return;
|
|
7960
|
+
const file = event.dataTransfer?.files?.[0];
|
|
7961
|
+
if (file) {
|
|
7962
|
+
this.processFile(file);
|
|
7963
|
+
}
|
|
7964
|
+
}
|
|
7965
|
+
onDragOver(event) {
|
|
7966
|
+
event.preventDefault();
|
|
7967
|
+
this.isDragging = true;
|
|
7968
|
+
}
|
|
7969
|
+
openFilePicker() {
|
|
7970
|
+
if (this.isFieldDisabled)
|
|
7971
|
+
return;
|
|
7972
|
+
this.fileInput()?.nativeElement.click();
|
|
7715
7973
|
}
|
|
7716
7974
|
processFile(file) {
|
|
7717
7975
|
this.revokeOldUrl();
|
|
7718
7976
|
this.previewUrl = URL.createObjectURL(file);
|
|
7719
7977
|
this.control.setValue(file);
|
|
7978
|
+
this.control.markAsTouched();
|
|
7720
7979
|
this.control.markAsDirty();
|
|
7721
7980
|
}
|
|
7722
7981
|
clearFile(event) {
|
|
7723
7982
|
event.preventDefault();
|
|
7724
7983
|
event.stopPropagation();
|
|
7984
|
+
if (this.isFieldDisabled)
|
|
7985
|
+
return;
|
|
7725
7986
|
this.revokeOldUrl();
|
|
7726
7987
|
this.previewUrl = undefined;
|
|
7727
7988
|
this.control.setValue(null);
|
|
7989
|
+
this.control.markAsTouched();
|
|
7728
7990
|
this.fileInput().nativeElement.value = '';
|
|
7729
7991
|
}
|
|
7730
7992
|
revokeOldUrl() {
|
|
@@ -7733,11 +7995,12 @@ class XSFormlyUploadImageComponent extends XSFormlyBaseComponent {
|
|
|
7733
7995
|
}
|
|
7734
7996
|
}
|
|
7735
7997
|
ngOnDestroy() {
|
|
7998
|
+
this.valueChangesSub.unsubscribe();
|
|
7736
7999
|
super.ngOnDestroy();
|
|
7737
8000
|
this.revokeOldUrl();
|
|
7738
8001
|
}
|
|
7739
8002
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyUploadImageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7740
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyUploadImageComponent, isStandalone: true, selector: "xs-formly-upload-image", viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"
|
|
8003
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyUploadImageComponent, isStandalone: true, selector: "xs-formly-upload-image", viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave) = \"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"errorMessage ? 'xs-upload-image-error-message-' + id : null\"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7741
8004
|
}
|
|
7742
8005
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyUploadImageComponent, decorators: [{
|
|
7743
8006
|
type: Component,
|
|
@@ -7746,7 +8009,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7746
8009
|
ReactiveFormsModule,
|
|
7747
8010
|
XSImageComponent,
|
|
7748
8011
|
XSFormlyLabelComponent,
|
|
7749
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"
|
|
8012
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"xs-uploader-container flex flex-col mb-4\"\n id=\"xs-upload-image-root-{{ id }}\"\n>\n <xs-formly-label\n [for]=\"'xs-upload-image-input-' + id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n [elementId]=\"'xs-upload-image-label-' + id\"\n />\n\n <div\n class=\"mt-2 relative h-52 w-full overflow-hidden rounded-xl bg-zinc-900/50 transition-all duration-300 hover:border-zinc-600\"\n [class.border-zinc-400]=\"isDragging\"\n id=\"xs-upload-image-dropzone-{{ id }}\"\n >\n <input\n #fileInput\n id=\"xs-upload-image-input-{{ id }}\"\n type=\"file\"\n accept=\"image/*\"\n (change)=\"onFileChange($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave) = \"isDragging = false\"\n (drop)=\"onDrop($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"errorMessage ? 'xs-upload-image-error-message-' + id : null\"\n class=\"absolute inset-0 z-10 h-full w-full cursor-pointer opacity-0\"\n />\n\n <div\n class=\"absolute inset-0 z-20 pointer-events-none flex h-full w-full items-center justify-center\"\n id=\"xs-upload-image-preview-container-{{ id }}\"\n >\n @if (previewUrl) {\n <div\n class=\"relative h-full w-full pointer-events-auto\"\n id=\"xs-upload-image-preview-wrapper-{{ id }}\"\n >\n <xs-image\n [src]=\"previewUrl\"\n [customClass]=\"'h-full w-full object-cover transition-all duration-500 group-hover:scale-105'\"\n id=\"xs-upload-image-preview-image-{{ id }}\"\n ></xs-image>\n\n <div\n class=\"absolute inset-0 flex items-center justify-center gap-3 bg-black/60 opacity-0 backdrop-blur-[2px] transition-opacity duration-300 hover:opacity-100 focus-within:opacity-100\"\n >\n <button\n type=\"button\"\n (click)=\"openFilePicker()\"\n [disabled]=\"isFieldDisabled\"\n class=\"z-30 flex h-10 items-center px-4 rounded-full bg-white text-black text-xs font-bold shadow-2xl transition-all hover:scale-105 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-change-button-{{ id }}\"\n >\n {{ changeButtonLabel }}\n </button>\n <button\n type=\"button\"\n (click)=\"clearFile($event)\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-label]=\"removeButtonLabel\"\n class=\"z-30 flex h-10 w-10 items-center justify-center rounded-full bg-red-600 text-white shadow-2xl transition-all hover:bg-red-500 hover:scale-110 active:scale-95 pointer-events-auto\"\n id=\"xs-upload-image-clear-button-{{ id }}\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"3\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <path d=\"M18 6 6 18\" />\n <path d=\"m6 6 12 12\" />\n </svg>\n </button>\n </div>\n </div>\n } @else {\n <div\n class=\"flex flex-col items-center gap-4\"\n id=\"xs-upload-image-empty-state-{{ id }}\"\n >\n <div\n class=\"flex h-14 w-14 items-center justify-center rounded-2xl bg-zinc-900 text-zinc-600 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05)] transition-colors group-hover:text-zinc-400\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n >\n <rect\n width=\"18\"\n height=\"18\"\n x=\"3\"\n y=\"3\"\n rx=\"2\"\n ry=\"2\"\n />\n <circle cx=\"9\" cy=\"9\" r=\"2\" />\n <path\n d=\"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\"\n />\n </svg>\n </div>\n <div class=\"text-center\">\n <p\n class=\"text-[11px] font-bold text-zinc-300 uppercase tracking-tight\"\n id=\"xs-upload-image-select-title-{{ id }}\"\n >\n {{ selectTitle }}\n </p>\n <p\n class=\"text-[9px] text-zinc-600 uppercase tracking-widest mt-1\"\n id=\"xs-upload-image-hint-text-{{ id }}\"\n >\n {{ hintText }}\n </p>\n </div>\n </div>\n }\n </div>\n </div>\n\n @if (errorMessage) {\n <div\n class=\"flex items-center gap-2 px-1 animate-in\"\n id=\"xs-upload-image-error-wrapper-{{ id }}\"\n >\n <span\n class=\"h-1 w-1 rounded-full bg-red-500 shadow-[0_0_8px_#ef4444]\"\n ></span>\n <p\n class=\"text-[9px] font-black uppercase text-red-500 tracking-tighter\"\n id=\"xs-upload-image-error-message-{{ id }}\"\n >\n {{ errorMessage }}\n </p>\n </div>\n }\n</div>\n", styles: [":host{display:block}.animate-in{animation:fadeIn .25s ease-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
7750
8013
|
}], ctorParameters: () => [], propDecorators: { fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }] } });
|
|
7751
8014
|
|
|
7752
8015
|
class XSFormlyJsonComponent extends XSFormlyBaseComponent {
|
|
@@ -7754,8 +8017,17 @@ class XSFormlyJsonComponent extends XSFormlyBaseComponent {
|
|
|
7754
8017
|
super();
|
|
7755
8018
|
this.xsTranslateService = translateService;
|
|
7756
8019
|
}
|
|
8020
|
+
ngOnInit() {
|
|
8021
|
+
super.ngOnInit();
|
|
8022
|
+
const value = this.control?.value;
|
|
8023
|
+
if (value != null && typeof value !== 'string') {
|
|
8024
|
+
this.control.setValue(JSON.stringify(value, null, 2), {
|
|
8025
|
+
emitEvent: false,
|
|
8026
|
+
});
|
|
8027
|
+
}
|
|
8028
|
+
}
|
|
7757
8029
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyJsonComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7758
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyJsonComponent, isStandalone: true, selector: "xs-formly-json", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-json-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 6\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8030
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyJsonComponent, isStandalone: true, selector: "xs-formly-json", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-json-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 6\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7759
8031
|
}
|
|
7760
8032
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyJsonComponent, decorators: [{
|
|
7761
8033
|
type: Component,
|
|
@@ -7763,7 +8035,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7763
8035
|
CommonModule,
|
|
7764
8036
|
ReactiveFormsModule,
|
|
7765
8037
|
XSFormlyLabelComponent,
|
|
7766
|
-
], template: "<div [id]=\"'xs-formly-json-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 6\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
8038
|
+
], template: "<div [id]=\"'xs-formly-json-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 6\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7767
8039
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
7768
8040
|
|
|
7769
8041
|
class XSFormlyJsonEditorComponent extends XSFormlyBaseComponent {
|
|
@@ -7782,7 +8054,7 @@ class XSFormlyJsonEditorComponent extends XSFormlyBaseComponent {
|
|
|
7782
8054
|
}
|
|
7783
8055
|
}
|
|
7784
8056
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyJsonEditorComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7785
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyJsonEditorComponent, isStandalone: true, selector: "xs-formly-json-editor", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-json-editor-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <label\n [for]=\"id\"\n class=\"block text-sm font-semibold text-white\"\n >\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 8\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n (blur)=\"formatJson()\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSPopoverInfoComponent, selector: "xs-popover-info", inputs: ["text"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8057
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyJsonEditorComponent, isStandalone: true, selector: "xs-formly-json-editor", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-json-editor-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <label\n [for]=\"id\"\n class=\"block text-sm font-semibold text-white\"\n >\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 8\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n (blur)=\"formatJson()\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.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: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: XSPopoverInfoComponent, selector: "xs-popover-info", inputs: ["text"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7786
8058
|
}
|
|
7787
8059
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyJsonEditorComponent, decorators: [{
|
|
7788
8060
|
type: Component,
|
|
@@ -7790,7 +8062,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7790
8062
|
CommonModule,
|
|
7791
8063
|
ReactiveFormsModule,
|
|
7792
8064
|
XSPopoverInfoComponent,
|
|
7793
|
-
], template: "<div [id]=\"'xs-formly-json-editor-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <label\n [for]=\"id\"\n class=\"block text-sm font-semibold text-white\"\n >\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 8\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n (blur)=\"formatJson()\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
8065
|
+
], template: "<div [id]=\"'xs-formly-json-editor-' + id\" [class]=\"wrapperClass\">\n @if (props.label) {\n <label\n [for]=\"id\"\n class=\"block text-sm font-semibold text-white\"\n >\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <textarea\n [id]=\"id\"\n [formControl]=\"control\"\n [rows]=\"props.rows ?? 8\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n [readonly]=\"props.readonly\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [attr.aria-invalid]=\"errorMessage ? true : null\"\n [attr.aria-required]=\"props.required ? true : null\"\n (blur)=\"formatJson()\"\n class=\"w-full input rounded-xl\"\n ></textarea>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
7794
8066
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
7795
8067
|
|
|
7796
8068
|
class XSEmptyStateComponent {
|
|
@@ -7926,11 +8198,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
7926
8198
|
], host: { class: 'block w-full' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n [class]=\"getContainerClasses()\"\n class=\"relative flex overflow-hidden transition-all duration-300 uppercase\"\n role=\"region\"\n [attr.aria-label]=\"regionAriaLabel()\"\n>\n @if (config().layout !== 'horizontal') {\n <div class=\"flex flex-col items-center w-full text-center\">\n @if (getDisplayIcon()) {\n <div [class]=\"getIconWrapperClasses()\">\n <xs-icon\n [icon]=\"getDisplayIcon()!\"\n [class]=\"getIconColorClass()\"\n ></xs-icon>\n </div>\n }\n\n <h2 [class]=\"getTitleClasses()\">{{ config().title }}</h2>\n\n @if (config().description) {\n <p [class]=\"getDescriptionClasses()\">\n {{ config().description }}\n </p>\n }\n\n @if (config().buttons?.length) {\n <div\n class=\"flex flex-col items-center gap-3 mt-6 sm:flex-row sm:justify-center\"\n >\n @for (button of config().buttons; track $index) {\n <xs-button\n [label]=\"button.label\"\n [variant]=\"button.variant || 'primary'\"\n [icon]=\"button.icon\"\n [disabled]=\"button.disabled\"\n [loading]=\"button.loading\"\n [isFull]=\"button.isFull\"\n (onClick)=\"onActionClick(button)\"\n class=\"tracking-widest\"\n ></xs-button>\n }\n </div>\n }\n </div>\n }\n\n @if (config().layout === 'horizontal') {\n <div class=\"flex items-center w-full gap-6 text-left\">\n @if (getDisplayIcon()) {\n <div [class]=\"getIconWrapperClasses()\">\n <xs-icon\n [icon]=\"getDisplayIcon()!\"\n [class]=\"getIconColorClass()\"\n ></xs-icon>\n </div>\n }\n\n <div class=\"flex flex-col flex-1 min-w-0\">\n <h2 [class]=\"getTitleClasses()\" class=\"mb-0.5\">\n {{ config().title }}\n </h2>\n @if (config().description) {\n <p [class]=\"getDescriptionClasses()\" class=\"mb-0\">\n {{ config().description }}\n </p>\n }\n </div>\n\n @if (config().buttons?.length) {\n <div class=\"flex items-center flex-shrink-0 gap-3 ml-4\">\n @for (button of config().buttons; track $index) {\n <xs-button\n [label]=\"button.label\"\n [variant]=\"button.variant || 'outline'\"\n [icon]=\"button.icon\"\n (onClick)=\"onActionClick(button)\"\n ></xs-button>\n }\n </div>\n }\n </div>\n }\n</div>\n" }]
|
|
7927
8199
|
}], propDecorators: { config: [{ type: i0.Input, args: [{ isSignal: true, alias: "config", required: true }] }], regionAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "regionAriaLabel", required: false }] }], actionClick: [{ type: i0.Output, args: ["actionClick"] }] } });
|
|
7928
8200
|
|
|
8201
|
+
/**
|
|
8202
|
+
* Contador de modales abiertos: bloquea el scroll del body mientras haya al
|
|
8203
|
+
* menos uno visible y lo restaura al cerrar el último (hotfix XS-882).
|
|
8204
|
+
*/
|
|
8205
|
+
let openModalCount = 0;
|
|
8206
|
+
function lockBodyScroll(documentRef) {
|
|
8207
|
+
if (!documentRef)
|
|
8208
|
+
return;
|
|
8209
|
+
openModalCount++;
|
|
8210
|
+
documentRef.body.classList.add('modal-open');
|
|
8211
|
+
}
|
|
8212
|
+
function unlockBodyScroll() {
|
|
8213
|
+
openModalCount = Math.max(0, openModalCount - 1);
|
|
8214
|
+
if (openModalCount > 0)
|
|
8215
|
+
return;
|
|
8216
|
+
const body = typeof document !== 'undefined' ? document.body : null;
|
|
8217
|
+
body?.classList.remove('modal-open');
|
|
8218
|
+
}
|
|
7929
8219
|
class XSModalComponent {
|
|
7930
8220
|
injector = inject(Injector);
|
|
7931
8221
|
dynamicContentPlaceholder = viewChild.required('dynamicContentPlaceholder', { read: ViewContainerRef });
|
|
7932
8222
|
destroyRef = inject(DestroyRef);
|
|
7933
8223
|
hostRef = inject(ElementRef);
|
|
8224
|
+
document = inject(DOCUMENT, { optional: true });
|
|
7934
8225
|
translateService = inject(XSTranslateService);
|
|
7935
8226
|
langVersion = signal(0, ...(ngDevMode ? [{ debugName: "langVersion" }] : []));
|
|
7936
8227
|
platformId = inject(PLATFORM_ID);
|
|
@@ -7972,6 +8263,7 @@ class XSModalComponent {
|
|
|
7972
8263
|
this.footerSyncEffect?.destroy();
|
|
7973
8264
|
this.destroyInjectedComponent();
|
|
7974
8265
|
this.modalResult.complete();
|
|
8266
|
+
unlockBodyScroll();
|
|
7975
8267
|
});
|
|
7976
8268
|
}
|
|
7977
8269
|
destroyInjectedComponent() {
|
|
@@ -7986,6 +8278,9 @@ class XSModalComponent {
|
|
|
7986
8278
|
data, type, title, subTitle, buttons, _hasOverflow, _closeOnBackdropClick, _showCloseButton, _closeLabel, _contentPadding, _panelSize) {
|
|
7987
8279
|
const placeholder = this.dynamicContentPlaceholder();
|
|
7988
8280
|
placeholder?.clear();
|
|
8281
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
8282
|
+
lockBodyScroll(this.document);
|
|
8283
|
+
}
|
|
7989
8284
|
this.injectedComponentRef = placeholder.createComponent(componentType, {
|
|
7990
8285
|
injector: this.injector,
|
|
7991
8286
|
});
|
|
@@ -8159,14 +8454,14 @@ class XSModalComponent {
|
|
|
8159
8454
|
return this.translateService.translate(key);
|
|
8160
8455
|
}
|
|
8161
8456
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8162
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSModalComponent, isStandalone: true, selector: "xs-modal", host: { attributes: { "xs-modal-host": "" }, listeners: { "document:keydown.escape": "onEscapeKey($event)" } }, viewQueries: [{ propertyName: "dynamicContentPlaceholder", first: true, predicate: ["dynamicContentPlaceholder"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div\n class=\"modal-overlay\"\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"modalTitle() || translate('MODAL.DIALOG_LABEL')\"\n [ngClass]=\"{\n 'bottom-sheet': currentModalType() === 'bottom-sheet',\n centered: currentModalType() === 'centered',\n 'side-panel': currentModalType() === 'side-panel',\n }\"\n (mousedown)=\"onBackdropMouseDown($event)\"\n>\n <div\n data-xs-modal-panel\n tabindex=\"-1\"\n class=\"relative bg-black shadow-lg max-h-[
|
|
8457
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSModalComponent, isStandalone: true, selector: "xs-modal", host: { attributes: { "xs-modal-host": "" }, listeners: { "document:keydown.escape": "onEscapeKey($event)" } }, viewQueries: [{ propertyName: "dynamicContentPlaceholder", first: true, predicate: ["dynamicContentPlaceholder"], descendants: true, read: ViewContainerRef, isSignal: true }], ngImport: i0, template: "<div\n class=\"modal-overlay\"\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"modalTitle() || translate('MODAL.DIALOG_LABEL')\"\n [ngClass]=\"{\n 'bottom-sheet': currentModalType() === 'bottom-sheet',\n centered: currentModalType() === 'centered',\n 'side-panel': currentModalType() === 'side-panel',\n }\"\n (mousedown)=\"onBackdropMouseDown($event)\"\n>\n <div\n data-xs-modal-panel\n tabindex=\"-1\"\n class=\"relative bg-black shadow-lg max-h-[92dvh] flex flex-col\"\n [class.p-4]=\"contentPadding() === 'default'\"\n [class.p-0]=\"contentPadding() === 'none'\"\n [ngClass]=\"{\n 'modal-bottom-sheet': currentModalType() === 'bottom-sheet',\n 'modal-centered': currentModalType() === 'centered',\n 'modal-side-panel': currentModalType() === 'side-panel',\n 'modal-side-panel-sm': currentModalType() === 'side-panel' && panelSize() === 'sm',\n 'modal-side-panel-md': currentModalType() === 'side-panel' && panelSize() === 'md',\n 'modal-side-panel-lg': currentModalType() === 'side-panel' && panelSize() === 'lg',\n 'animate-slide-up':\n isVisible() && currentModalType() === 'bottom-sheet',\n 'animate-slide-down':\n !isVisible() && currentModalType() === 'bottom-sheet',\n 'animate-zoom-in':\n isVisible() && currentModalType() === 'centered',\n 'animate-slide-in-right':\n isVisible() && currentModalType() === 'side-panel',\n 'animate-slide-out-right':\n !isVisible() && currentModalType() === 'side-panel',\n }\"\n role=\"document\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n (animationend)=\"onAnimationEnd()\"\n >\n @if (currentModalType() === 'bottom-sheet') {\n <div\n class=\"flex justify-center p-2\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n <div class=\"w-10 h-1 bg-gray-300 rounded-full\"></div>\n </div>\n }\n @if (modalTitle()) {\n <div\n class=\"modal-header px-4 pb-2 text-center\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n <h2 class=\"text-xl font-bold text-white\">\n {{ modalTitle() }}\n </h2>\n @if (modalSubTitle()) {\n <p class=\"text-sm text-gray-300\">\n {{ modalSubTitle() }}\n </p>\n }\n </div>\n }\n @if (showCloseButton()) {\n <button\n type=\"button\"\n class=\"modal-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"closeLabel() || translate('MODAL.CLOSE')\"\n >\n <span aria-hidden=\"true\">\u00D7</span>\n </button>\n }\n\n <div class=\"flex-1 px-2 overflow-y-auto overflow-x-hidden\">\n <ng-template #dynamicContentPlaceholder></ng-template>\n </div>\n\n @if (buttons() && buttons().length > 0) {\n <div\n class=\"modal-footer grid grid-cols-12 gap-2 pt-4 mt-2 bg-black border-t border-zinc-800/30\"\n >\n @for (button of buttons(); track button.id ?? $index) {\n <xs-button\n [id]=\"\n button.id\n ? button.id\n : buttons().indexOf(button).toString()\n \"\n (click)=\"handleButtonAction(button.action!)\"\n [variant]=\"\n button.variant ? button.variant : 'primary'\n \"\n [layout]=\"button.layout ? button.layout : 'between'\"\n [isFull]=\"true\"\n [disabled]=\"button.disabled ?? false\"\n [loading]=\"button.loading ?? false\"\n [icon]=\"button.icon\"\n [label]=\"button.label\"\n [ngClass]=\"getButtonClass(button)\"\n >\n </xs-button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [".modal-overlay{position:fixed;inset:0;z-index:10000;display:flex;justify-content:center;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1));--tw-bg-opacity: .5}.modal-bottom-sheet{z-index:10001;width:100%;max-width:28rem;border-top-left-radius:1rem;border-top-right-radius:1rem}.modal-overlay.bottom-sheet{align-items:flex-end}.modal-centered{z-index:10001;margin:1rem;width:100%;max-width:32rem;border-radius:.75rem}.modal-overlay.centered{align-items:center}.modal-footer{padding-bottom:max(1rem,env(safe-area-inset-bottom,0px));padding-left:max(1rem,env(safe-area-inset-left,0px));padding-right:max(1rem,env(safe-area-inset-right,0px))}.modal-overlay.side-panel .modal-header{padding-top:max(.5rem,env(safe-area-inset-top,0px))}.modal-close-btn{position:absolute;top:.75rem;right:.75rem;z-index:10;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:9999px;font-size:1.5rem;line-height:2rem;line-height:1;--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.modal-close-btn:hover{background-color:#27272a99;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.modal-close-btn:focus-visible{outline-width:2px;outline-color:#fff}.modal-overlay.side-panel .modal-close-btn{top:max(.75rem,env(safe-area-inset-top,0px));right:max(.75rem,env(safe-area-inset-right,0px))}.modal-side-panel{z-index:10001;margin:0;height:100vh;max-height:100vh;width:100%;border-radius:0;border-left-width:1px;--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1));height:100dvh;max-height:100dvh}.modal-side-panel,.modal-side-panel-sm,.modal-side-panel-md,.modal-side-panel-lg{width:100%}@media(min-width:640px){.modal-side-panel-sm{max-width:28rem}.modal-side-panel-md{max-width:32rem}.modal-side-panel-lg,.modal-side-panel{max-width:36rem}}@media(min-width:1024px){.modal-side-panel{max-width:42rem}}.modal-overlay.side-panel{align-items:stretch;justify-content:flex-end;padding:0}@keyframes slideUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDown{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes zoomIn{0%{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}@keyframes slideInRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideOutRight{0%{transform:translate(0)}to{transform:translate(100%)}}.animate-slide-in-right{animation:slideInRight .3s ease-out forwards}.animate-slide-out-right{animation:slideOutRight .3s ease-in forwards}.animate-zoom-in{animation:zoomIn .3s ease-out forwards}.animate-slide-up{animation:slideUp .3s ease-out forwards}.animate-slide-down{animation:slideDown .3s ease-in forwards}:host h2{text-transform:uppercase}:host-context(xs-button) button{text-transform:uppercase}.close-button{position:absolute;top:.75rem;right:.75rem;cursor:pointer;font-size:1.5rem;line-height:2rem;font-weight:700;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.close-button:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.modal-open{overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: XSButtonComponent, selector: "xs-button", inputs: ["id", "label", "type", "icon", "action", "customClass", "variant", "layout", "badgeCount", "isFull", "disabled", "loading", "title", "ariaLabel", "borderRadius", "isGrouped", "groupPosition"], outputs: ["isGroupedChange", "groupPositionChange", "click", "onClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8163
8458
|
}
|
|
8164
8459
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSModalComponent, decorators: [{
|
|
8165
8460
|
type: Component,
|
|
8166
8461
|
args: [{ selector: 'xs-modal', imports: [CommonModule, XSButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
8167
8462
|
'xs-modal-host': '',
|
|
8168
8463
|
'(document:keydown.escape)': 'onEscapeKey($event)',
|
|
8169
|
-
}, template: "<div\n class=\"modal-overlay\"\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"modalTitle() || translate('MODAL.DIALOG_LABEL')\"\n [ngClass]=\"{\n 'bottom-sheet': currentModalType() === 'bottom-sheet',\n centered: currentModalType() === 'centered',\n 'side-panel': currentModalType() === 'side-panel',\n }\"\n (mousedown)=\"onBackdropMouseDown($event)\"\n>\n <div\n data-xs-modal-panel\n tabindex=\"-1\"\n class=\"relative bg-black shadow-lg max-h-[
|
|
8464
|
+
}, template: "<div\n class=\"modal-overlay\"\n role=\"dialog\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"modalTitle() || translate('MODAL.DIALOG_LABEL')\"\n [ngClass]=\"{\n 'bottom-sheet': currentModalType() === 'bottom-sheet',\n centered: currentModalType() === 'centered',\n 'side-panel': currentModalType() === 'side-panel',\n }\"\n (mousedown)=\"onBackdropMouseDown($event)\"\n>\n <div\n data-xs-modal-panel\n tabindex=\"-1\"\n class=\"relative bg-black shadow-lg max-h-[92dvh] flex flex-col\"\n [class.p-4]=\"contentPadding() === 'default'\"\n [class.p-0]=\"contentPadding() === 'none'\"\n [ngClass]=\"{\n 'modal-bottom-sheet': currentModalType() === 'bottom-sheet',\n 'modal-centered': currentModalType() === 'centered',\n 'modal-side-panel': currentModalType() === 'side-panel',\n 'modal-side-panel-sm': currentModalType() === 'side-panel' && panelSize() === 'sm',\n 'modal-side-panel-md': currentModalType() === 'side-panel' && panelSize() === 'md',\n 'modal-side-panel-lg': currentModalType() === 'side-panel' && panelSize() === 'lg',\n 'animate-slide-up':\n isVisible() && currentModalType() === 'bottom-sheet',\n 'animate-slide-down':\n !isVisible() && currentModalType() === 'bottom-sheet',\n 'animate-zoom-in':\n isVisible() && currentModalType() === 'centered',\n 'animate-slide-in-right':\n isVisible() && currentModalType() === 'side-panel',\n 'animate-slide-out-right':\n !isVisible() && currentModalType() === 'side-panel',\n }\"\n role=\"document\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n (animationend)=\"onAnimationEnd()\"\n >\n @if (currentModalType() === 'bottom-sheet') {\n <div\n class=\"flex justify-center p-2\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n <div class=\"w-10 h-1 bg-gray-300 rounded-full\"></div>\n </div>\n }\n @if (modalTitle()) {\n <div\n class=\"modal-header px-4 pb-2 text-center\"\n (mousedown)=\"$event.stopPropagation()\"\n (mouseup)=\"$event.stopPropagation()\"\n >\n <h2 class=\"text-xl font-bold text-white\">\n {{ modalTitle() }}\n </h2>\n @if (modalSubTitle()) {\n <p class=\"text-sm text-gray-300\">\n {{ modalSubTitle() }}\n </p>\n }\n </div>\n }\n @if (showCloseButton()) {\n <button\n type=\"button\"\n class=\"modal-close-btn\"\n (click)=\"close()\"\n [attr.aria-label]=\"closeLabel() || translate('MODAL.CLOSE')\"\n >\n <span aria-hidden=\"true\">\u00D7</span>\n </button>\n }\n\n <div class=\"flex-1 px-2 overflow-y-auto overflow-x-hidden\">\n <ng-template #dynamicContentPlaceholder></ng-template>\n </div>\n\n @if (buttons() && buttons().length > 0) {\n <div\n class=\"modal-footer grid grid-cols-12 gap-2 pt-4 mt-2 bg-black border-t border-zinc-800/30\"\n >\n @for (button of buttons(); track button.id ?? $index) {\n <xs-button\n [id]=\"\n button.id\n ? button.id\n : buttons().indexOf(button).toString()\n \"\n (click)=\"handleButtonAction(button.action!)\"\n [variant]=\"\n button.variant ? button.variant : 'primary'\n \"\n [layout]=\"button.layout ? button.layout : 'between'\"\n [isFull]=\"true\"\n [disabled]=\"button.disabled ?? false\"\n [loading]=\"button.loading ?? false\"\n [icon]=\"button.icon\"\n [label]=\"button.label\"\n [ngClass]=\"getButtonClass(button)\"\n >\n </xs-button>\n }\n </div>\n }\n </div>\n</div>\n", styles: [".modal-overlay{position:fixed;inset:0;z-index:10000;display:flex;justify-content:center;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1));--tw-bg-opacity: .5}.modal-bottom-sheet{z-index:10001;width:100%;max-width:28rem;border-top-left-radius:1rem;border-top-right-radius:1rem}.modal-overlay.bottom-sheet{align-items:flex-end}.modal-centered{z-index:10001;margin:1rem;width:100%;max-width:32rem;border-radius:.75rem}.modal-overlay.centered{align-items:center}.modal-footer{padding-bottom:max(1rem,env(safe-area-inset-bottom,0px));padding-left:max(1rem,env(safe-area-inset-left,0px));padding-right:max(1rem,env(safe-area-inset-right,0px))}.modal-overlay.side-panel .modal-header{padding-top:max(.5rem,env(safe-area-inset-top,0px))}.modal-close-btn{position:absolute;top:.75rem;right:.75rem;z-index:10;display:flex;height:2.25rem;width:2.25rem;align-items:center;justify-content:center;border-radius:9999px;font-size:1.5rem;line-height:2rem;line-height:1;--tw-text-opacity: 1;color:rgb(161 161 170 / var(--tw-text-opacity, 1));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.modal-close-btn:hover{background-color:#27272a99;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.modal-close-btn:focus-visible{outline-width:2px;outline-color:#fff}.modal-overlay.side-panel .modal-close-btn{top:max(.75rem,env(safe-area-inset-top,0px));right:max(.75rem,env(safe-area-inset-right,0px))}.modal-side-panel{z-index:10001;margin:0;height:100vh;max-height:100vh;width:100%;border-radius:0;border-left-width:1px;--tw-border-opacity: 1;border-color:rgb(39 39 42 / var(--tw-border-opacity, 1));height:100dvh;max-height:100dvh}.modal-side-panel,.modal-side-panel-sm,.modal-side-panel-md,.modal-side-panel-lg{width:100%}@media(min-width:640px){.modal-side-panel-sm{max-width:28rem}.modal-side-panel-md{max-width:32rem}.modal-side-panel-lg,.modal-side-panel{max-width:36rem}}@media(min-width:1024px){.modal-side-panel{max-width:42rem}}.modal-overlay.side-panel{align-items:stretch;justify-content:flex-end;padding:0}@keyframes slideUp{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDown{0%{transform:translateY(0)}to{transform:translateY(100%)}}@keyframes zoomIn{0%{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}@keyframes slideInRight{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes slideOutRight{0%{transform:translate(0)}to{transform:translate(100%)}}.animate-slide-in-right{animation:slideInRight .3s ease-out forwards}.animate-slide-out-right{animation:slideOutRight .3s ease-in forwards}.animate-zoom-in{animation:zoomIn .3s ease-out forwards}.animate-slide-up{animation:slideUp .3s ease-out forwards}.animate-slide-down{animation:slideDown .3s ease-in forwards}:host h2{text-transform:uppercase}:host-context(xs-button) button{text-transform:uppercase}.close-button{position:absolute;top:.75rem;right:.75rem;cursor:pointer;font-size:1.5rem;line-height:2rem;font-weight:700;--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.close-button:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.modal-open{overflow:hidden}\n"] }]
|
|
8170
8465
|
}], ctorParameters: () => [], propDecorators: { dynamicContentPlaceholder: [{ type: i0.ViewChild, args: ['dynamicContentPlaceholder', { ...{ read: ViewContainerRef }, isSignal: true }] }] } });
|
|
8171
8466
|
|
|
8172
8467
|
class XSModalConfirmComponent {
|
|
@@ -9473,6 +9768,11 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9473
9768
|
modalService = inject(XSModalService);
|
|
9474
9769
|
searchSubject = new Subject();
|
|
9475
9770
|
valueChangesSub = new Subscription();
|
|
9771
|
+
searchSub;
|
|
9772
|
+
searchSeq = 0;
|
|
9773
|
+
get isFieldDisabled() {
|
|
9774
|
+
return !!this.props['disabled'] || !!this.control?.disabled;
|
|
9775
|
+
}
|
|
9476
9776
|
constructor(translateService) {
|
|
9477
9777
|
super();
|
|
9478
9778
|
this.xsTranslateService = translateService;
|
|
@@ -9493,7 +9793,7 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9493
9793
|
this.syncSelectedItems();
|
|
9494
9794
|
}));
|
|
9495
9795
|
}
|
|
9496
|
-
this.searchSubject
|
|
9796
|
+
this.searchSub = this.searchSubject
|
|
9497
9797
|
.pipe(debounceTime$1(300), distinctUntilChanged$1())
|
|
9498
9798
|
.subscribe((query) => {
|
|
9499
9799
|
void this.doSearch(query);
|
|
@@ -9502,6 +9802,7 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9502
9802
|
ngOnDestroy() {
|
|
9503
9803
|
super.ngOnDestroy();
|
|
9504
9804
|
this.valueChangesSub.unsubscribe();
|
|
9805
|
+
this.searchSub?.unsubscribe();
|
|
9505
9806
|
this.searchSubject.complete();
|
|
9506
9807
|
}
|
|
9507
9808
|
syncSelectedItems() {
|
|
@@ -9521,6 +9822,7 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9521
9822
|
(typeof b['position'] === 'number' ? b['position'] : 0));
|
|
9522
9823
|
this.selectedItems.set(sorted);
|
|
9523
9824
|
this.control.setValue(sorted);
|
|
9825
|
+
this.control.markAsTouched();
|
|
9524
9826
|
this.control.markAsDirty();
|
|
9525
9827
|
}
|
|
9526
9828
|
t(key) {
|
|
@@ -9530,6 +9832,8 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9530
9832
|
return this.xsTranslateService.translate(key);
|
|
9531
9833
|
}
|
|
9532
9834
|
onSearchChange(query) {
|
|
9835
|
+
if (this.isFieldDisabled)
|
|
9836
|
+
return;
|
|
9533
9837
|
this.searchQuery.set(query);
|
|
9534
9838
|
if (!query.trim()) {
|
|
9535
9839
|
this.searchResults.set([]);
|
|
@@ -9545,21 +9849,33 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9545
9849
|
const onSearch = this.pickerProps.onSearch;
|
|
9546
9850
|
if (!onSearch)
|
|
9547
9851
|
return;
|
|
9852
|
+
const seq = ++this.searchSeq;
|
|
9548
9853
|
this.searching.set(true);
|
|
9549
9854
|
try {
|
|
9550
9855
|
const results = await onSearch(query);
|
|
9856
|
+
if (seq !== this.searchSeq)
|
|
9857
|
+
return;
|
|
9551
9858
|
const selectedIds = new Set(this.selectedItems().map((item) => item._id));
|
|
9552
9859
|
this.searchResults.set(results.filter((r) => !selectedIds.has(r._id)));
|
|
9553
9860
|
}
|
|
9554
9861
|
catch {
|
|
9862
|
+
if (seq !== this.searchSeq)
|
|
9863
|
+
return;
|
|
9555
9864
|
this.searchResults.set([]);
|
|
9556
9865
|
}
|
|
9557
9866
|
finally {
|
|
9558
|
-
this.
|
|
9867
|
+
if (seq === this.searchSeq)
|
|
9868
|
+
this.searching.set(false);
|
|
9559
9869
|
}
|
|
9560
9870
|
}
|
|
9561
9871
|
selectResult(item) {
|
|
9872
|
+
if (this.isFieldDisabled)
|
|
9873
|
+
return;
|
|
9562
9874
|
const current = this.selectedItems();
|
|
9875
|
+
if (current.some((entry) => entry._id === item._id)) {
|
|
9876
|
+
this.showDropdown.set(false);
|
|
9877
|
+
return;
|
|
9878
|
+
}
|
|
9563
9879
|
const newItem = {
|
|
9564
9880
|
...item,
|
|
9565
9881
|
position: current.length,
|
|
@@ -9570,6 +9886,8 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9570
9886
|
this.showDropdown.set(false);
|
|
9571
9887
|
}
|
|
9572
9888
|
async removeItem(index) {
|
|
9889
|
+
if (this.isFieldDisabled)
|
|
9890
|
+
return;
|
|
9573
9891
|
const item = this.selectedItems()[index];
|
|
9574
9892
|
let confirmed = false;
|
|
9575
9893
|
try {
|
|
@@ -9602,6 +9920,8 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9602
9920
|
this.updateControl(updated);
|
|
9603
9921
|
}
|
|
9604
9922
|
moveItem(index, direction) {
|
|
9923
|
+
if (this.isFieldDisabled)
|
|
9924
|
+
return;
|
|
9605
9925
|
const current = this.selectedItems();
|
|
9606
9926
|
const targetIndex = index + direction;
|
|
9607
9927
|
if (targetIndex < 0 || targetIndex >= current.length)
|
|
@@ -9618,6 +9938,8 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9618
9938
|
this.updateControl(reindexed);
|
|
9619
9939
|
}
|
|
9620
9940
|
async onCreateNew() {
|
|
9941
|
+
if (this.isFieldDisabled)
|
|
9942
|
+
return;
|
|
9621
9943
|
const onCreate = this.pickerProps.onCreate;
|
|
9622
9944
|
if (!onCreate)
|
|
9623
9945
|
return;
|
|
@@ -9632,6 +9954,8 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9632
9954
|
}
|
|
9633
9955
|
}
|
|
9634
9956
|
async onCreateFromSearch() {
|
|
9957
|
+
if (this.isFieldDisabled)
|
|
9958
|
+
return;
|
|
9635
9959
|
const onCreate = this.pickerProps.onDirectCreate ??
|
|
9636
9960
|
this.pickerProps.onCreate;
|
|
9637
9961
|
if (!onCreate)
|
|
@@ -9710,19 +10034,18 @@ class XSFormlyEntityPickerComponent extends XSFormlyBaseComponent {
|
|
|
9710
10034
|
}
|
|
9711
10035
|
}
|
|
9712
10036
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyEntityPickerComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9713
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyEntityPickerComponent, isStandalone: true, selector: "xs-formly-entity-picker", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-entity-picker-' + id\" [class]=\"wrapperClass\">\n @if (pickerProps.label) {\n <label class=\"formly-label\">\n {{ translateLabel(pickerProps.label) }}\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <div class=\"flex flex-col gap-4\">\n <div class=\"relative\">\n <input\n type=\"text\"\n [
|
|
10037
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyEntityPickerComponent, isStandalone: true, selector: "xs-formly-entity-picker", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-entity-picker-' + id\" [class]=\"wrapperClass\">\n @if (pickerProps.label) {\n <label class=\"formly-label\">\n {{ translateLabel(pickerProps.label) }}\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <div class=\"flex flex-col gap-4\">\n <div class=\"relative\">\n <input\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchChange($event.target.value)\"\n (focus)=\"onSearchFocus()\"\n (blur)=\"onSearchBlur()\"\n [placeholder]=\"searchPlaceholder\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n class=\"input !pr-11 !py-4 rounded-xl\"\n />\n <xs-icon\n icon=\"magnifying-glass\"\n class=\"absolute right-4 top-1/2 -translate-y-1/2 text-zinc-500 text-sm\"\n ></xs-icon>\n\n @if (showDropdown()) {\n <div\n class=\"absolute left-0 right-0 top-full mt-1 z-[10002] rounded-xl bg-black shadow-xl max-h-48 overflow-y-auto\"\n >\n @if (searching()) {\n <div class=\"flex items-center justify-center py-6 bg-zinc-900/50 rounded-xl\">\n <div class=\"animate-spin size-5 border-2 border-zinc-600 border-t-white rounded-full\"></div>\n </div>\n } @else if (searchResults().length === 0) {\n <xs-empty-state\n [config]=\"getNoResultsConfig()\"\n />\n } @else {\n <div class=\"bg-zinc-900/50 rounded-xl\">\n <div class=\"flex flex-col\">\n @for (item of searchResults(); track item._id) {\n <button\n type=\"button\"\n class=\"flex items-center gap-3 w-full p-3 hover:bg-zinc-800/60 transition text-left\"\n (click)=\"selectResult(item)\"\n >\n <div class=\"size-9 shrink-0 rounded-lg bg-zinc-800 flex items-center justify-center overflow-hidden\">\n @if (item['image']) {\n <xs-image\n [item]=\"item\"\n [typeItem]=\"typeItem\"\n imageType=\"small\"\n size=\"sm\"\n customClass=\"size-9 object-cover\"\n ></xs-image>\n } @else {\n <xs-icon [icon]=\"iconFallback\" class=\"text-zinc-500 text-xs\"></xs-icon>\n }\n </div>\n <div class=\"flex-1 min-w-0\">\n <p class=\"text-sm font-medium text-zinc-200 truncate\">{{ item.name }}</p>\n @if (getSecondaryText(item)) {\n <p class=\"text-xs text-zinc-400 truncate\">{{ getSecondaryText(item) }}</p>\n }\n </div>\n <xs-icon icon=\"plus\" class=\"text-zinc-400 text-xs shrink-0\"></xs-icon>\n </button>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n\n @if (selectedItems().length > 0) {\n <div class=\"flex flex-col gap-2\">\n <p class=\"formly-label pt-1\">\n {{ t('FORM.ENTITY_PICKER.ITEM_COUNT') }} ({{ selectedItems().length }})\n </p>\n @for (item of selectedItems(); track item._id; let i = $index) {\n <div class=\"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-zinc-900/50\">\n <div class=\"size-9 shrink-0 rounded-lg bg-zinc-800 flex items-center justify-center overflow-hidden\">\n @if (item['image']) {\n <xs-image\n [item]=\"item\"\n [typeItem]=\"typeItem\"\n imageType=\"small\"\n size=\"sm\"\n customClass=\"size-9 object-cover\"\n ></xs-image>\n } @else {\n <xs-icon [icon]=\"iconFallback\" class=\"text-zinc-500 text-xs\"></xs-icon>\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <p class=\"text-sm font-semibold text-zinc-200 truncate\">{{ item.name }}</p>\n @if (getSecondaryText(item)) {\n <p class=\"text-xs text-zinc-400 truncate\">{{ getSecondaryText(item) }}</p>\n }\n </div>\n\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (showReorder) {\n <xs-button\n icon=\"chevron-up\"\n layout=\"iconOnlyMini\"\n variant=\"primary\"\n [title]=\"t('FORM.ENTITY_PICKER.MOVE_UP')\"\n [disabled]=\"i === 0\"\n (onClick)=\"moveItem(i, -1)\"\n />\n <xs-button\n icon=\"chevron-down\"\n layout=\"iconOnlyMini\"\n variant=\"primary\"\n [title]=\"t('FORM.ENTITY_PICKER.MOVE_DOWN')\"\n [disabled]=\"i === selectedItems().length - 1\"\n (onClick)=\"moveItem(i, 1)\"\n />\n }\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-8 h-8 rounded-lg bg-red-600 text-white hover:opacity-70 transition shrink-0\"\n (click)=\"removeItem(i)\"\n [attr.aria-label]=\"t('FORM.ENTITY_PICKER.DELETE')\"\n >\n <xs-icon icon=\"trash\" class=\"text-xs\"></xs-icon>\n </button>\n </div>\n </div>\n }\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-2\">\n {{ errorMessage }}\n </p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: XSIconComponent, selector: "xs-icon", inputs: ["icon", "size", "class"] }, { kind: "component", type: XSImageComponent, selector: "xs-image", inputs: ["config", "viewTransitionName", "src", "alt", "width", "height", "size", "rounded", "objectFit", "clickable", "item", "typeItem", "imageType", "fallbackSrc", "loading", "priority", "customClass", "generateAvatar"], outputs: ["onClick", "onLoad", "onError"] }, { kind: "component", type: XSButtonComponent, selector: "xs-button", inputs: ["id", "label", "type", "icon", "action", "customClass", "variant", "layout", "badgeCount", "isFull", "disabled", "loading", "title", "ariaLabel", "borderRadius", "isGrouped", "groupPosition"], outputs: ["isGroupedChange", "groupPositionChange", "click", "onClick"] }, { kind: "component", type: XSEmptyStateComponent, selector: "xs-empty-state", inputs: ["config", "regionAriaLabel"], outputs: ["actionClick"] }, { kind: "component", type: XSPopoverInfoComponent, selector: "xs-popover-info", inputs: ["text"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9714
10038
|
}
|
|
9715
10039
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyEntityPickerComponent, decorators: [{
|
|
9716
10040
|
type: Component,
|
|
9717
10041
|
args: [{ selector: 'xs-formly-entity-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
9718
10042
|
CommonModule,
|
|
9719
|
-
FormsModule,
|
|
9720
10043
|
XSIconComponent,
|
|
9721
10044
|
XSImageComponent,
|
|
9722
10045
|
XSButtonComponent,
|
|
9723
10046
|
XSEmptyStateComponent,
|
|
9724
10047
|
XSPopoverInfoComponent,
|
|
9725
|
-
], template: "<div [id]=\"'xs-formly-entity-picker-' + id\" [class]=\"wrapperClass\">\n @if (pickerProps.label) {\n <label class=\"formly-label\">\n {{ translateLabel(pickerProps.label) }}\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <div class=\"flex flex-col gap-4\">\n <div class=\"relative\">\n <input\n type=\"text\"\n [
|
|
10048
|
+
], template: "<div [id]=\"'xs-formly-entity-picker-' + id\" [class]=\"wrapperClass\">\n @if (pickerProps.label) {\n <label class=\"formly-label\">\n {{ translateLabel(pickerProps.label) }}\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n\n <div class=\"flex flex-col gap-4\">\n <div class=\"relative\">\n <input\n type=\"text\"\n [value]=\"searchQuery()\"\n (input)=\"onSearchChange($event.target.value)\"\n (focus)=\"onSearchFocus()\"\n (blur)=\"onSearchBlur()\"\n [placeholder]=\"searchPlaceholder\"\n [disabled]=\"isFieldDisabled\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n class=\"input !pr-11 !py-4 rounded-xl\"\n />\n <xs-icon\n icon=\"magnifying-glass\"\n class=\"absolute right-4 top-1/2 -translate-y-1/2 text-zinc-500 text-sm\"\n ></xs-icon>\n\n @if (showDropdown()) {\n <div\n class=\"absolute left-0 right-0 top-full mt-1 z-[10002] rounded-xl bg-black shadow-xl max-h-48 overflow-y-auto\"\n >\n @if (searching()) {\n <div class=\"flex items-center justify-center py-6 bg-zinc-900/50 rounded-xl\">\n <div class=\"animate-spin size-5 border-2 border-zinc-600 border-t-white rounded-full\"></div>\n </div>\n } @else if (searchResults().length === 0) {\n <xs-empty-state\n [config]=\"getNoResultsConfig()\"\n />\n } @else {\n <div class=\"bg-zinc-900/50 rounded-xl\">\n <div class=\"flex flex-col\">\n @for (item of searchResults(); track item._id) {\n <button\n type=\"button\"\n class=\"flex items-center gap-3 w-full p-3 hover:bg-zinc-800/60 transition text-left\"\n (click)=\"selectResult(item)\"\n >\n <div class=\"size-9 shrink-0 rounded-lg bg-zinc-800 flex items-center justify-center overflow-hidden\">\n @if (item['image']) {\n <xs-image\n [item]=\"item\"\n [typeItem]=\"typeItem\"\n imageType=\"small\"\n size=\"sm\"\n customClass=\"size-9 object-cover\"\n ></xs-image>\n } @else {\n <xs-icon [icon]=\"iconFallback\" class=\"text-zinc-500 text-xs\"></xs-icon>\n }\n </div>\n <div class=\"flex-1 min-w-0\">\n <p class=\"text-sm font-medium text-zinc-200 truncate\">{{ item.name }}</p>\n @if (getSecondaryText(item)) {\n <p class=\"text-xs text-zinc-400 truncate\">{{ getSecondaryText(item) }}</p>\n }\n </div>\n <xs-icon icon=\"plus\" class=\"text-zinc-400 text-xs shrink-0\"></xs-icon>\n </button>\n }\n </div>\n </div>\n }\n </div>\n }\n </div>\n\n @if (selectedItems().length > 0) {\n <div class=\"flex flex-col gap-2\">\n <p class=\"formly-label pt-1\">\n {{ t('FORM.ENTITY_PICKER.ITEM_COUNT') }} ({{ selectedItems().length }})\n </p>\n @for (item of selectedItems(); track item._id; let i = $index) {\n <div class=\"flex items-center gap-4 px-4 py-3.5 rounded-xl bg-zinc-900/50\">\n <div class=\"size-9 shrink-0 rounded-lg bg-zinc-800 flex items-center justify-center overflow-hidden\">\n @if (item['image']) {\n <xs-image\n [item]=\"item\"\n [typeItem]=\"typeItem\"\n imageType=\"small\"\n size=\"sm\"\n customClass=\"size-9 object-cover\"\n ></xs-image>\n } @else {\n <xs-icon [icon]=\"iconFallback\" class=\"text-zinc-500 text-xs\"></xs-icon>\n }\n </div>\n\n <div class=\"flex-1 min-w-0\">\n <p class=\"text-sm font-semibold text-zinc-200 truncate\">{{ item.name }}</p>\n @if (getSecondaryText(item)) {\n <p class=\"text-xs text-zinc-400 truncate\">{{ getSecondaryText(item) }}</p>\n }\n </div>\n\n <div class=\"flex items-center gap-1 shrink-0\">\n @if (showReorder) {\n <xs-button\n icon=\"chevron-up\"\n layout=\"iconOnlyMini\"\n variant=\"primary\"\n [title]=\"t('FORM.ENTITY_PICKER.MOVE_UP')\"\n [disabled]=\"i === 0\"\n (onClick)=\"moveItem(i, -1)\"\n />\n <xs-button\n icon=\"chevron-down\"\n layout=\"iconOnlyMini\"\n variant=\"primary\"\n [title]=\"t('FORM.ENTITY_PICKER.MOVE_DOWN')\"\n [disabled]=\"i === selectedItems().length - 1\"\n (onClick)=\"moveItem(i, 1)\"\n />\n }\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-8 h-8 rounded-lg bg-red-600 text-white hover:opacity-70 transition shrink-0\"\n (click)=\"removeItem(i)\"\n [attr.aria-label]=\"t('FORM.ENTITY_PICKER.DELETE')\"\n >\n <xs-icon icon=\"trash\" class=\"text-xs\"></xs-icon>\n </button>\n </div>\n </div>\n }\n </div>\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-2\">\n {{ errorMessage }}\n </p>\n }\n</div>\n" }]
|
|
9726
10049
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
9727
10050
|
|
|
9728
10051
|
const iconNameForType = (name) => {
|
|
@@ -9771,7 +10094,7 @@ const iconNameForSocial = (name) => {
|
|
|
9771
10094
|
};
|
|
9772
10095
|
|
|
9773
10096
|
class XSFormlySocialComponent extends XSFormlyBaseComponent {
|
|
9774
|
-
isDropdownOpen = false;
|
|
10097
|
+
isDropdownOpen = signal(false, ...(ngDevMode ? [{ debugName: "isDropdownOpen" }] : []));
|
|
9775
10098
|
elementRef = inject(ElementRef);
|
|
9776
10099
|
destroyRef = inject(DestroyRef);
|
|
9777
10100
|
platformId = inject(PLATFORM_ID);
|
|
@@ -9784,7 +10107,7 @@ class XSFormlySocialComponent extends XSFormlyBaseComponent {
|
|
|
9784
10107
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
9785
10108
|
.subscribe((event) => {
|
|
9786
10109
|
if (!this.elementRef.nativeElement.contains(event.target)) {
|
|
9787
|
-
this.isDropdownOpen
|
|
10110
|
+
this.isDropdownOpen.set(false);
|
|
9788
10111
|
}
|
|
9789
10112
|
});
|
|
9790
10113
|
}
|
|
@@ -9893,6 +10216,8 @@ class XSFormlySocialComponent extends XSFormlyBaseComponent {
|
|
|
9893
10216
|
const next = { ...this.currentValue };
|
|
9894
10217
|
next[fieldName] = '';
|
|
9895
10218
|
this.control.setValue(next);
|
|
10219
|
+
this.control.markAsTouched();
|
|
10220
|
+
this.control.markAsDirty();
|
|
9896
10221
|
}
|
|
9897
10222
|
removeSocial(social) {
|
|
9898
10223
|
if (!Object.prototype.hasOwnProperty.call(this.currentValue, social.fieldName)) {
|
|
@@ -9901,14 +10226,18 @@ class XSFormlySocialComponent extends XSFormlyBaseComponent {
|
|
|
9901
10226
|
const next = { ...this.currentValue };
|
|
9902
10227
|
delete next[social.fieldName];
|
|
9903
10228
|
this.control.setValue(next);
|
|
10229
|
+
this.control.markAsTouched();
|
|
10230
|
+
this.control.markAsDirty();
|
|
9904
10231
|
}
|
|
9905
10232
|
updateSocial(fieldName, value) {
|
|
9906
10233
|
const next = { ...this.currentValue };
|
|
9907
10234
|
next[fieldName] = value;
|
|
9908
10235
|
this.control.setValue(next);
|
|
10236
|
+
this.control.markAsTouched();
|
|
10237
|
+
this.control.markAsDirty();
|
|
9909
10238
|
}
|
|
9910
10239
|
toggleDropdown() {
|
|
9911
|
-
this.isDropdownOpen
|
|
10240
|
+
this.isDropdownOpen.update((v) => !v);
|
|
9912
10241
|
}
|
|
9913
10242
|
openSocial(fieldName) {
|
|
9914
10243
|
const value = this.currentValue[fieldName];
|
|
@@ -9919,13 +10248,16 @@ class XSFormlySocialComponent extends XSFormlyBaseComponent {
|
|
|
9919
10248
|
if (fieldName === 'ra') {
|
|
9920
10249
|
url = `https://ra.co/clubs/${value}`;
|
|
9921
10250
|
}
|
|
10251
|
+
else if (!/^[a-z][a-z0-9+.-]*:\/\//i.test(url)) {
|
|
10252
|
+
url = `https://${url}`;
|
|
10253
|
+
}
|
|
9922
10254
|
window?.open(url, '_blank');
|
|
9923
10255
|
}
|
|
9924
10256
|
getIcon(type) {
|
|
9925
10257
|
return iconNameForSocial(type);
|
|
9926
10258
|
}
|
|
9927
10259
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySocialComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
9928
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySocialComponent, isStandalone: true, selector: "xs-formly-social", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-social-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (existingSocials.length > 0) {\n @for (\n social of existingSocials;\n track social.fieldName\n ) {\n <div class=\"flex mb-2 rounded-xl bg-zinc-900/50\">\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-12 h-[54px] px-3 pr-2 rounded-l-xl bg-zinc-900/50 button-interaction\"\n (click)=\"openSocial(social.fieldName)\"\n >\n <xs-icon\n [icon]=\"getIcon(social.subtype)\"\n ></xs-icon>\n </button>\n <input\n [id]=\"id + '_' + social.fieldName\"\n class=\"flex-grow input rounded-none bg-zinc-900/50 border-none\"\n [value]=\"currentValue[social.fieldName] || ''\"\n [attr.aria-label]=\"social.fieldName\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [placeholder]=\"\n social.placeholder ||\n 'https://' + social.fieldName + '.com/...'\n \"\n (input)=\"\n updateSocial(\n social.fieldName,\n $event.target.value\n )\n \"\n />\n <xs-button\n icon=\"trash\"\n layout=\"iconOnly\"\n variant=\"custom\"\n customClass=\"w-12 h-[54px] px-3 rounded-r-xl bg-zinc-900/50 button-interaction\"\n (onClick)=\"removeSocial(social)\"\n />\n </div>\n }\n }\n\n <div class=\"relative w-full\">\n @if (availableSocials.length > 0) {\n <xs-button\n [id]=\"id + '-add-social'\"\n [label]=\"addLinkLabel\"\n [icon]=\"{ name: isDropdownOpen ? 'chevron-up' : 'chevron-down', position: 'right' }\"\n layout=\"between\"\n variant=\"custom\"\n customClass=\"w-full input-select rounded-xl\"\n (onClick)=\"toggleDropdown()\"\n />\n\n @if (isDropdownOpen) {\n <div\n class=\"absolute z-[999] w-full mt-1 overflow-y-auto rounded-xl shadow-lg max-h-40 bg-black\"\n >\n <ul\n class=\"py-1 bg-zinc-900/50 rounded-xl\"\n role=\"listbox\"\n [attr.aria-label]=\"addLinkLabel\"\n >\n @for (\n option of availableSocials;\n track option.fieldName\n ) {\n <li\n [id]=\"id + '-option-' + option.fieldName\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n class=\"flex items-center gap-2 px-4 py-2 rounded-xl button-interaction\"\n (click)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n >\n <xs-icon\n [icon]=\"getIcon(option.subtype)\"\n ></xs-icon>\n <span class=\"flex-grow text-sm text-white\">\n {{ option.label }}\n </span>\n </li>\n }\n </ul>\n </div>\n }\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: XSIconComponent, selector: "xs-icon", inputs: ["icon", "size", "class"] }, { kind: "component", type: XSButtonComponent, selector: "xs-button", inputs: ["id", "label", "type", "icon", "action", "customClass", "variant", "layout", "badgeCount", "isFull", "disabled", "loading", "title", "ariaLabel", "borderRadius", "isGrouped", "groupPosition"], outputs: ["isGroupedChange", "groupPositionChange", "click", "onClick"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10260
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlySocialComponent, isStandalone: true, selector: "xs-formly-social", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-social-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (existingSocials.length > 0) {\n @for (\n social of existingSocials;\n track social.fieldName\n ) {\n <div class=\"flex mb-2 rounded-xl bg-zinc-900/50\">\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-12 h-[54px] px-3 pr-2 rounded-l-xl bg-zinc-900/50 button-interaction\"\n (click)=\"openSocial(social.fieldName)\"\n >\n <xs-icon\n [icon]=\"getIcon(social.subtype)\"\n ></xs-icon>\n </button>\n <input\n [id]=\"id + '_' + social.fieldName\"\n class=\"flex-grow input rounded-none bg-zinc-900/50 border-none\"\n [value]=\"currentValue[social.fieldName] || ''\"\n [attr.aria-label]=\"social.fieldName\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [placeholder]=\"\n social.placeholder ||\n 'https://' + social.fieldName + '.com/...'\n \"\n (input)=\"\n updateSocial(\n social.fieldName,\n $event.target.value\n )\n \"\n />\n <xs-button\n icon=\"trash\"\n layout=\"iconOnly\"\n variant=\"custom\"\n customClass=\"w-12 h-[54px] px-3 rounded-r-xl bg-zinc-900/50 button-interaction\"\n (onClick)=\"removeSocial(social)\"\n />\n </div>\n }\n }\n\n <div class=\"relative w-full\">\n @if (availableSocials.length > 0) {\n <xs-button\n [id]=\"id + '-add-social'\"\n [label]=\"addLinkLabel\"\n [icon]=\"{ name: isDropdownOpen() ? 'chevron-up' : 'chevron-down', position: 'right' }\"\n layout=\"between\"\n variant=\"custom\"\n customClass=\"w-full input-select rounded-xl\"\n (onClick)=\"toggleDropdown()\"\n />\n\n @if (isDropdownOpen()) {\n <div\n class=\"absolute z-[999] w-full mt-1 overflow-y-auto rounded-xl shadow-lg max-h-40 bg-black\"\n >\n <ul\n class=\"py-1 bg-zinc-900/50 rounded-xl\"\n role=\"listbox\"\n [attr.aria-label]=\"addLinkLabel\"\n >\n @for (\n option of availableSocials;\n track option.fieldName\n ) {\n <li\n [id]=\"id + '-option-' + option.fieldName\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n tabindex=\"0\"\n class=\"flex items-center gap-2 px-4 py-2 rounded-xl button-interaction\"\n (click)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n (keydown.enter)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n (keydown.space)=\"\n $event.preventDefault();\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n >\n <xs-icon\n [icon]=\"getIcon(option.subtype)\"\n ></xs-icon>\n <span class=\"flex-grow text-sm text-white\">\n {{ option.label }}\n </span>\n </li>\n }\n </ul>\n </div>\n }\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: FontAwesomeModule }, { kind: "component", type: XSIconComponent, selector: "xs-icon", inputs: ["icon", "size", "class"] }, { kind: "component", type: XSButtonComponent, selector: "xs-button", inputs: ["id", "label", "type", "icon", "action", "customClass", "variant", "layout", "badgeCount", "isFull", "disabled", "loading", "title", "ariaLabel", "borderRadius", "isGrouped", "groupPosition"], outputs: ["isGroupedChange", "groupPositionChange", "click", "onClick"] }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9929
10261
|
}
|
|
9930
10262
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlySocialComponent, decorators: [{
|
|
9931
10263
|
type: Component,
|
|
@@ -9936,7 +10268,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
9936
10268
|
XSIconComponent,
|
|
9937
10269
|
XSButtonComponent,
|
|
9938
10270
|
XSFormlyLabelComponent,
|
|
9939
|
-
], template: "<div [id]=\"'xs-formly-social-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (existingSocials.length > 0) {\n @for (\n social of existingSocials;\n track social.fieldName\n ) {\n <div class=\"flex mb-2 rounded-xl bg-zinc-900/50\">\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-12 h-[54px] px-3 pr-2 rounded-l-xl bg-zinc-900/50 button-interaction\"\n (click)=\"openSocial(social.fieldName)\"\n >\n <xs-icon\n [icon]=\"getIcon(social.subtype)\"\n ></xs-icon>\n </button>\n <input\n [id]=\"id + '_' + social.fieldName\"\n class=\"flex-grow input rounded-none bg-zinc-900/50 border-none\"\n [value]=\"currentValue[social.fieldName] || ''\"\n [attr.aria-label]=\"social.fieldName\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [placeholder]=\"\n social.placeholder ||\n 'https://' + social.fieldName + '.com/...'\n \"\n (input)=\"\n updateSocial(\n social.fieldName,\n $event.target.value\n )\n \"\n />\n <xs-button\n icon=\"trash\"\n layout=\"iconOnly\"\n variant=\"custom\"\n customClass=\"w-12 h-[54px] px-3 rounded-r-xl bg-zinc-900/50 button-interaction\"\n (onClick)=\"removeSocial(social)\"\n />\n </div>\n }\n }\n\n <div class=\"relative w-full\">\n @if (availableSocials.length > 0) {\n <xs-button\n [id]=\"id + '-add-social'\"\n [label]=\"addLinkLabel\"\n [icon]=\"{ name: isDropdownOpen ? 'chevron-up' : 'chevron-down', position: 'right' }\"\n layout=\"between\"\n variant=\"custom\"\n customClass=\"w-full input-select rounded-xl\"\n (onClick)=\"toggleDropdown()\"\n />\n\n @if (isDropdownOpen) {\n <div\n class=\"absolute z-[999] w-full mt-1 overflow-y-auto rounded-xl shadow-lg max-h-40 bg-black\"\n >\n <ul\n class=\"py-1 bg-zinc-900/50 rounded-xl\"\n role=\"listbox\"\n [attr.aria-label]=\"addLinkLabel\"\n >\n @for (\n option of availableSocials;\n track option.fieldName\n ) {\n <li\n [id]=\"id + '-option-' + option.fieldName\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n class=\"flex items-center gap-2 px-4 py-2 rounded-xl button-interaction\"\n (click)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n >\n <xs-icon\n [icon]=\"getIcon(option.subtype)\"\n ></xs-icon>\n <span class=\"flex-grow text-sm text-white\">\n {{ option.label }}\n </span>\n </li>\n }\n </ul>\n </div>\n }\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
10271
|
+
], template: "<div [id]=\"'xs-formly-social-' + id\" [class]=\"wrapperClass\">\n <xs-formly-label\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (existingSocials.length > 0) {\n @for (\n social of existingSocials;\n track social.fieldName\n ) {\n <div class=\"flex mb-2 rounded-xl bg-zinc-900/50\">\n <button\n type=\"button\"\n class=\"flex items-center justify-center w-12 h-[54px] px-3 pr-2 rounded-l-xl bg-zinc-900/50 button-interaction\"\n (click)=\"openSocial(social.fieldName)\"\n >\n <xs-icon\n [icon]=\"getIcon(social.subtype)\"\n ></xs-icon>\n </button>\n <input\n [id]=\"id + '_' + social.fieldName\"\n class=\"flex-grow input rounded-none bg-zinc-900/50 border-none\"\n [value]=\"currentValue[social.fieldName] || ''\"\n [attr.aria-label]=\"social.fieldName\"\n [attr.aria-describedby]=\"errorMessage ? 'error-' + id : null\"\n [placeholder]=\"\n social.placeholder ||\n 'https://' + social.fieldName + '.com/...'\n \"\n (input)=\"\n updateSocial(\n social.fieldName,\n $event.target.value\n )\n \"\n />\n <xs-button\n icon=\"trash\"\n layout=\"iconOnly\"\n variant=\"custom\"\n customClass=\"w-12 h-[54px] px-3 rounded-r-xl bg-zinc-900/50 button-interaction\"\n (onClick)=\"removeSocial(social)\"\n />\n </div>\n }\n }\n\n <div class=\"relative w-full\">\n @if (availableSocials.length > 0) {\n <xs-button\n [id]=\"id + '-add-social'\"\n [label]=\"addLinkLabel\"\n [icon]=\"{ name: isDropdownOpen() ? 'chevron-up' : 'chevron-down', position: 'right' }\"\n layout=\"between\"\n variant=\"custom\"\n customClass=\"w-full input-select rounded-xl\"\n (onClick)=\"toggleDropdown()\"\n />\n\n @if (isDropdownOpen()) {\n <div\n class=\"absolute z-[999] w-full mt-1 overflow-y-auto rounded-xl shadow-lg max-h-40 bg-black\"\n >\n <ul\n class=\"py-1 bg-zinc-900/50 rounded-xl\"\n role=\"listbox\"\n [attr.aria-label]=\"addLinkLabel\"\n >\n @for (\n option of availableSocials;\n track option.fieldName\n ) {\n <li\n [id]=\"id + '-option-' + option.fieldName\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n tabindex=\"0\"\n class=\"flex items-center gap-2 px-4 py-2 rounded-xl button-interaction\"\n (click)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n (keydown.enter)=\"\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n (keydown.space)=\"\n $event.preventDefault();\n addSocial(option.fieldName);\n toggleDropdown()\n \"\n >\n <xs-icon\n [icon]=\"getIcon(option.subtype)\"\n ></xs-icon>\n <span class=\"flex-grow text-sm text-white\">\n {{ option.label }}\n </span>\n </li>\n }\n </ul>\n </div>\n }\n }\n </div>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n" }]
|
|
9940
10272
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
9941
10273
|
|
|
9942
10274
|
var AI$1 = {
|
|
@@ -10091,7 +10423,7 @@ class XSFormlyHtmlEditorComponent extends XSFormlyBaseComponent {
|
|
|
10091
10423
|
}
|
|
10092
10424
|
}
|
|
10093
10425
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyHtmlEditorComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
10094
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyHtmlEditorComponent, isStandalone: true, selector: "xs-formly-html-editor", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-html-editor-' + id\" [class]=\"wrapperClass\" [ngClass]=\"{\n 'xs-html-editor-default': props['variant'] !== 'secondary',\n 'xs-html-editor-secondary': props['variant'] === 'secondary',\n}\">\n @if (props.label) {\n <div class=\"flex items-center gap-2 mb-2\">\n <label [for]=\"id\" class=\"formly-label mb-0\">\n
|
|
10426
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyHtmlEditorComponent, isStandalone: true, selector: "xs-formly-html-editor", usesInheritance: true, ngImport: i0, template: "<div [id]=\"'xs-formly-html-editor-' + id\" [class]=\"wrapperClass\" [ngClass]=\"{\n 'xs-html-editor-default': props['variant'] !== 'secondary',\n 'xs-html-editor-secondary': props['variant'] === 'secondary',\n}\">\n @if (props.label || aiEnabled || translateEnabled || aiTranslateEnabled) {\n <div class=\"flex items-center gap-2 mb-2\">\n @if (props.label) {\n <label [for]=\"id\" class=\"formly-label mb-0\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n @if (aiEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-ai-btn\"\n (click)=\"handleAiClick()\"\n [title]=\"aiButtonTitle\"\n >\n {{ aiButtonLabel }}\n </button>\n }\n @if (translateEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-translate-btn\"\n (click)=\"handleTranslateClick()\"\n [title]=\"translateButtonTitle\"\n >\n {{ translateButtonLabel }}\n </button>\n }\n @if (aiTranslateEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-ai-translate-btn\"\n (click)=\"handleAiTranslateClick()\"\n [title]=\"aiTranslateButtonTitle\"\n >\n {{ aiTranslateButtonLabel }}\n </button>\n }\n </div>\n }\n\n <angular-editor\n [id]=\"id\"\n [formControl]=\"control\"\n [config]=\"editorConfig\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n ></angular-editor>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", styles: [".angular-editor{border-radius:.75rem;overflow:hidden;font-size:.875rem;--ae-toolbar-border-radius: 0;--ae-toolbar-padding: .25rem;--ae-text-area-border: 0;--ae-text-area-border-radius: 0;--ae-button-bg-color: transparent;--ae-button-hover-bg-color: rgba(255, 255, 255, .08);--ae-button-active-bg-color: rgba(255, 255, 255, .12);--ae-button-border: 0;--ae-button-radius: .375rem;--ae-gap: .25rem;--ae-focus-outline-color: transparent;--ae-picker-color: #a1a1aa;--ae-picker-label-color: #a1a1aa;--ae-picker-option-bg-color: rgba(24, 24, 27, .95);--ae-picker-option-hover-bg-color: rgba( 255, 255, 255, .08 )}.xs-html-editor-default .angular-editor{--ae-toolbar-bg-color: rgba(24, 24, 27, .5)}.angular-editor-toolbar .select-custom-style{display:none!important}.xs-html-editor-secondary .angular-editor{--ae-toolbar-bg-color: #000}.angular-editor-textarea{border:0!important;border-radius:0!important;color:#fff!important;padding:.75rem!important;min-height:7rem!important}.xs-html-editor-default .angular-editor-textarea{background:#18181b80!important}.xs-html-editor-secondary .angular-editor-textarea{background:#000!important}.angular-editor-textarea:empty:before{color:#71717a!important}.angular-editor-toolbar{border-radius:0!important}.angular-editor-button{color:#a1a1aa!important}.angular-editor-button:hover{color:#fff!important}.angular-editor-textarea ol{list-style-type:decimal;padding-left:1.5rem;margin:.5rem 0}.angular-editor-textarea ul{list-style-type:disc;padding-left:1.5rem;margin:.5rem 0}.angular-editor-textarea li{color:#fff}.xs-html-editor-ai-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#a855f726;color:#c084fc;border:1px solid rgba(168,85,247,.3);cursor:pointer;transition:all .15s ease;margin-left:auto;white-space:nowrap}.xs-html-editor-ai-btn:hover{background:#a855f740;border-color:#a855f780}.xs-html-editor-translate-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#22c55e26;color:#4ade80;border:1px solid rgba(34,197,94,.3);cursor:pointer;transition:all .15s ease;margin-left:auto;white-space:nowrap}.xs-html-editor-translate-btn:hover{background:#22c55e40;border-color:#22c55e80}.xs-html-editor-ai-translate-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#3b82f626;color:#93c5fd;border:1px solid rgba(59,130,246,.3);cursor:pointer;transition:all .15s ease;white-space:nowrap}.xs-html-editor-ai-translate-btn:hover{background:#3b82f640;border-color:#3b82f680}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: AngularEditorModule }, { kind: "component", type: i4.AngularEditorComponent, selector: "angular-editor", inputs: ["id", "config", "placeholder", "tabIndex"], outputs: ["html", "viewMode", "blur", "focus", "contentChanged"] }, { kind: "component", type: XSPopoverInfoComponent, selector: "xs-popover-info", inputs: ["text"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
10095
10427
|
}
|
|
10096
10428
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyHtmlEditorComponent, decorators: [{
|
|
10097
10429
|
type: Component,
|
|
@@ -10100,7 +10432,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
10100
10432
|
ReactiveFormsModule,
|
|
10101
10433
|
AngularEditorModule,
|
|
10102
10434
|
XSPopoverInfoComponent,
|
|
10103
|
-
], template: "<div [id]=\"'xs-formly-html-editor-' + id\" [class]=\"wrapperClass\" [ngClass]=\"{\n 'xs-html-editor-default': props['variant'] !== 'secondary',\n 'xs-html-editor-secondary': props['variant'] === 'secondary',\n}\">\n @if (props.label) {\n <div class=\"flex items-center gap-2 mb-2\">\n <label [for]=\"id\" class=\"formly-label mb-0\">\n
|
|
10435
|
+
], template: "<div [id]=\"'xs-formly-html-editor-' + id\" [class]=\"wrapperClass\" [ngClass]=\"{\n 'xs-html-editor-default': props['variant'] !== 'secondary',\n 'xs-html-editor-secondary': props['variant'] === 'secondary',\n}\">\n @if (props.label || aiEnabled || translateEnabled || aiTranslateEnabled) {\n <div class=\"flex items-center gap-2 mb-2\">\n @if (props.label) {\n <label [for]=\"id\" class=\"formly-label mb-0\">\n {{ translateLabel(props.label) }}\n @if (props.required) {\n <span class=\"text-red-500\">*</span>\n }\n @if (infoText) {\n <xs-popover-info [text]=\"infoText\" />\n }\n </label>\n }\n @if (aiEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-ai-btn\"\n (click)=\"handleAiClick()\"\n [title]=\"aiButtonTitle\"\n >\n {{ aiButtonLabel }}\n </button>\n }\n @if (translateEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-translate-btn\"\n (click)=\"handleTranslateClick()\"\n [title]=\"translateButtonTitle\"\n >\n {{ translateButtonLabel }}\n </button>\n }\n @if (aiTranslateEnabled) {\n <button\n type=\"button\"\n class=\"xs-html-editor-ai-translate-btn\"\n (click)=\"handleAiTranslateClick()\"\n [title]=\"aiTranslateButtonTitle\"\n >\n {{ aiTranslateButtonLabel }}\n </button>\n }\n </div>\n }\n\n <angular-editor\n [id]=\"id\"\n [formControl]=\"control\"\n [config]=\"editorConfig\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n ></angular-editor>\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500\">{{ errorMessage }}</p>\n }\n</div>\n", styles: [".angular-editor{border-radius:.75rem;overflow:hidden;font-size:.875rem;--ae-toolbar-border-radius: 0;--ae-toolbar-padding: .25rem;--ae-text-area-border: 0;--ae-text-area-border-radius: 0;--ae-button-bg-color: transparent;--ae-button-hover-bg-color: rgba(255, 255, 255, .08);--ae-button-active-bg-color: rgba(255, 255, 255, .12);--ae-button-border: 0;--ae-button-radius: .375rem;--ae-gap: .25rem;--ae-focus-outline-color: transparent;--ae-picker-color: #a1a1aa;--ae-picker-label-color: #a1a1aa;--ae-picker-option-bg-color: rgba(24, 24, 27, .95);--ae-picker-option-hover-bg-color: rgba( 255, 255, 255, .08 )}.xs-html-editor-default .angular-editor{--ae-toolbar-bg-color: rgba(24, 24, 27, .5)}.angular-editor-toolbar .select-custom-style{display:none!important}.xs-html-editor-secondary .angular-editor{--ae-toolbar-bg-color: #000}.angular-editor-textarea{border:0!important;border-radius:0!important;color:#fff!important;padding:.75rem!important;min-height:7rem!important}.xs-html-editor-default .angular-editor-textarea{background:#18181b80!important}.xs-html-editor-secondary .angular-editor-textarea{background:#000!important}.angular-editor-textarea:empty:before{color:#71717a!important}.angular-editor-toolbar{border-radius:0!important}.angular-editor-button{color:#a1a1aa!important}.angular-editor-button:hover{color:#fff!important}.angular-editor-textarea ol{list-style-type:decimal;padding-left:1.5rem;margin:.5rem 0}.angular-editor-textarea ul{list-style-type:disc;padding-left:1.5rem;margin:.5rem 0}.angular-editor-textarea li{color:#fff}.xs-html-editor-ai-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#a855f726;color:#c084fc;border:1px solid rgba(168,85,247,.3);cursor:pointer;transition:all .15s ease;margin-left:auto;white-space:nowrap}.xs-html-editor-ai-btn:hover{background:#a855f740;border-color:#a855f780}.xs-html-editor-translate-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#22c55e26;color:#4ade80;border:1px solid rgba(34,197,94,.3);cursor:pointer;transition:all .15s ease;margin-left:auto;white-space:nowrap}.xs-html-editor-translate-btn:hover{background:#22c55e40;border-color:#22c55e80}.xs-html-editor-ai-translate-btn{display:inline-flex;align-items:center;gap:.25rem;padding:.125rem .5rem;font-size:.75rem;font-weight:600;line-height:1;border-radius:.375rem;background:#3b82f626;color:#93c5fd;border:1px solid rgba(59,130,246,.3);cursor:pointer;transition:all .15s ease;white-space:nowrap}.xs-html-editor-ai-translate-btn:hover{background:#3b82f640;border-color:#3b82f680}\n"] }]
|
|
10104
10436
|
}], ctorParameters: () => [{ type: XSTranslateService }] });
|
|
10105
10437
|
|
|
10106
10438
|
var ADDRESS_SEARCH$1 = {
|
|
@@ -10131,9 +10463,14 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10131
10463
|
justSelected = false;
|
|
10132
10464
|
clickInside = false;
|
|
10133
10465
|
search$ = new Subject();
|
|
10466
|
+
destroyRef = inject(DestroyRef);
|
|
10467
|
+
geocodeSeq = 0;
|
|
10134
10468
|
get addressSearchProps() {
|
|
10135
10469
|
return this.props;
|
|
10136
10470
|
}
|
|
10471
|
+
get isFieldDisabled() {
|
|
10472
|
+
return (!!this.props['disabled'] || !!this.formControl?.disabled);
|
|
10473
|
+
}
|
|
10137
10474
|
constructor() {
|
|
10138
10475
|
super();
|
|
10139
10476
|
this.xsTranslateService = inject(XSTranslateService);
|
|
@@ -10146,6 +10483,7 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10146
10483
|
this.searching.set(true);
|
|
10147
10484
|
return this.addressSearchProps.searchFn(query);
|
|
10148
10485
|
}))
|
|
10486
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
10149
10487
|
.subscribe({
|
|
10150
10488
|
next: (results) => {
|
|
10151
10489
|
this.suggestions.set(results);
|
|
@@ -10162,7 +10500,9 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10162
10500
|
ngOnInit() {
|
|
10163
10501
|
super.ngOnInit();
|
|
10164
10502
|
this.syncFromFormControl(this.formControl.value);
|
|
10165
|
-
this.formControl.valueChanges
|
|
10503
|
+
this.formControl.valueChanges
|
|
10504
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
10505
|
+
.subscribe((value) => {
|
|
10166
10506
|
if (this.justSelected)
|
|
10167
10507
|
return;
|
|
10168
10508
|
this.syncFromFormControl(value);
|
|
@@ -10180,6 +10520,8 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10180
10520
|
}
|
|
10181
10521
|
}
|
|
10182
10522
|
onInput(event) {
|
|
10523
|
+
if (this.isFieldDisabled)
|
|
10524
|
+
return;
|
|
10183
10525
|
const value = event.target?.value ?? '';
|
|
10184
10526
|
this.query.set(value);
|
|
10185
10527
|
if (value.length >= 3) {
|
|
@@ -10211,6 +10553,8 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10211
10553
|
this.clickInside = false;
|
|
10212
10554
|
}
|
|
10213
10555
|
selectSuggestion(suggestion) {
|
|
10556
|
+
if (this.isFieldDisabled)
|
|
10557
|
+
return;
|
|
10214
10558
|
this.justSelected = true;
|
|
10215
10559
|
this.showSuggestions.set(false);
|
|
10216
10560
|
const country = this.findCountry(suggestion.countryCode);
|
|
@@ -10231,9 +10575,13 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10231
10575
|
this.selectedLocation.set(`${suggestion.town}, ${countryName}`);
|
|
10232
10576
|
this.searchMode.set(false);
|
|
10233
10577
|
this.formControl.setValue(addressValue);
|
|
10578
|
+
this.formControl.markAsTouched();
|
|
10579
|
+
const geocodeSeq = ++this.geocodeSeq;
|
|
10234
10580
|
const addressStr = `${suggestion.street}, ${suggestion.town}, ${countryName}`;
|
|
10235
10581
|
this.addressSearchProps.geocodeFn(addressStr).subscribe({
|
|
10236
10582
|
next: (result) => {
|
|
10583
|
+
if (geocodeSeq !== this.geocodeSeq)
|
|
10584
|
+
return;
|
|
10237
10585
|
this.justSelected = false;
|
|
10238
10586
|
if (result) {
|
|
10239
10587
|
this.formControl.setValue({
|
|
@@ -10245,12 +10593,17 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10245
10593
|
}
|
|
10246
10594
|
},
|
|
10247
10595
|
error: () => {
|
|
10596
|
+
if (geocodeSeq !== this.geocodeSeq)
|
|
10597
|
+
return;
|
|
10248
10598
|
this.justSelected = false;
|
|
10249
10599
|
},
|
|
10250
10600
|
});
|
|
10251
10601
|
}
|
|
10252
10602
|
editAddress() {
|
|
10603
|
+
if (this.isFieldDisabled)
|
|
10604
|
+
return;
|
|
10253
10605
|
this.formControl.setValue(null);
|
|
10606
|
+
this.formControl.markAsTouched();
|
|
10254
10607
|
this.query.set('');
|
|
10255
10608
|
this.selectedStreet.set('');
|
|
10256
10609
|
this.selectedLocation.set('');
|
|
@@ -10276,7 +10629,7 @@ class XSFormlyAddressSearchComponent extends XSFormlyBaseComponent {
|
|
|
10276
10629
|
this.selectedLocation.set(countryName ? `${town}, ${countryName}` : town);
|
|
10277
10630
|
}
|
|
10278
10631
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyAddressSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
10279
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyAddressSearchComponent, isStandalone: true, selector: "xs-formly-address-search", host: { listeners: { "document:click": "onDocumentClick()", "click": "onComponentClick()" } }, viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (searchMode()) {\n <div class=\"relative\">\n <div class=\"flex items-center gap-2 rounded-xl bg-zinc-900/50 px-4 py-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 shrink-0\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/></svg>\n <input\n #searchInput\n [id]=\"id\"\n type=\"text\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n class=\"w-full bg-transparent text-white text-sm font-medium placeholder:text-zinc-500 border-0 outline-none focus:outline-none focus:ring-0\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (keydown)=\"onKeydown($event)\"\n [value]=\"query()\"\n autocomplete=\"off\"\n />\n @if (searching()) {\n <span class=\"text-xs text-zinc-500\">{{ translateLabel('ADDRESS_SEARCH.SEARCHING') }}</span>\n }\n </div>\n\n @if (showSuggestions()) {\n <div class=\"absolute z-50 w-full mt-1 bg-black border border-zinc-800 rounded-xl shadow-xl max-h-60 overflow-y-auto\">\n @for (suggestion of suggestions(); track $index) {\n <button\n type=\"button\"\n class=\"w-full text-left px-4 py-3 text-sm text-zinc-300 hover:bg-zinc-900 hover:text-white transition-colors border-b border-zinc-800 last:border-b-0\"\n (click)=\"selectSuggestion(suggestion)\"\n >\n <span class=\"block truncate\">{{ suggestion.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"flex items-start justify-between gap-4 rounded-xl bg-zinc-900/50 px-4 py-3\">\n <div class=\"flex items-start gap-3 min-w-0\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 mt-0.5 shrink-0\"><path d=\"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/></svg>\n <div class=\"text-sm text-zinc-300 min-w-0\">\n <p>{{ selectedStreet() }}</p>\n <p class=\"text-zinc-500\">{{ selectedLocation() }}</p>\n </div>\n </div>\n <button\n type=\"button\"\n class=\"shrink-0 text-xs text-zinc-500 hover:text-zinc-300 transition-colors\"\n (click)=\"editAddress()\"\n >\n {{ translateLabel('ADDRESS_SEARCH.EDIT') }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-1\">{{ errorMessage }}</p>\n }\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400 mt-1\">{{ props.description }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10632
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyAddressSearchComponent, isStandalone: true, selector: "xs-formly-address-search", host: { listeners: { "document:click": "onDocumentClick()", "click": "onComponentClick()" } }, viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (searchMode()) {\n <div class=\"relative\">\n <div class=\"flex items-center gap-2 rounded-xl bg-zinc-900/50 px-4 py-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 shrink-0\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/></svg>\n <input\n #searchInput\n [id]=\"id\"\n type=\"text\"\n [disabled]=\"isFieldDisabled\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n class=\"w-full bg-transparent text-white text-sm font-medium placeholder:text-zinc-500 border-0 outline-none focus:outline-none focus:ring-0\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (keydown)=\"onKeydown($event)\"\n [value]=\"query()\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n autocomplete=\"off\"\n />\n @if (searching()) {\n <span class=\"text-xs text-zinc-500\">{{ translateLabel('ADDRESS_SEARCH.SEARCHING') }}</span>\n }\n </div>\n\n @if (showSuggestions()) {\n <div class=\"absolute z-50 w-full mt-1 bg-black border border-zinc-800 rounded-xl shadow-xl max-h-60 overflow-y-auto\">\n @for (suggestion of suggestions(); track $index) {\n <button\n type=\"button\"\n class=\"w-full text-left px-4 py-3 text-sm text-zinc-300 hover:bg-zinc-900 hover:text-white transition-colors border-b border-zinc-800 last:border-b-0\"\n (click)=\"selectSuggestion(suggestion)\"\n >\n <span class=\"block truncate\">{{ suggestion.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"flex items-start justify-between gap-4 rounded-xl bg-zinc-900/50 px-4 py-3\">\n <div class=\"flex items-start gap-3 min-w-0\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 mt-0.5 shrink-0\"><path d=\"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/></svg>\n <div class=\"text-sm text-zinc-300 min-w-0\">\n <p>{{ selectedStreet() }}</p>\n <p class=\"text-zinc-500\">{{ selectedLocation() }}</p>\n </div>\n </div>\n <button\n type=\"button\"\n class=\"shrink-0 text-xs text-zinc-500 hover:text-zinc-300 transition-colors\"\n [disabled]=\"isFieldDisabled\"\n (click)=\"editAddress()\"\n >\n {{ translateLabel('ADDRESS_SEARCH.EDIT') }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-1\">{{ errorMessage }}</p>\n }\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400 mt-1\">{{ props.description }}</p>\n }\n</div>\n", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: XSFormlyLabelComponent, selector: "xs-formly-label", inputs: ["for", "label", "required", "infoText", "asHeading", "elementId"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10280
10633
|
}
|
|
10281
10634
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyAddressSearchComponent, decorators: [{
|
|
10282
10635
|
type: Component,
|
|
@@ -10287,7 +10640,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
10287
10640
|
], host: {
|
|
10288
10641
|
'(document:click)': 'onDocumentClick()',
|
|
10289
10642
|
'(click)': 'onComponentClick()',
|
|
10290
|
-
}, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (searchMode()) {\n <div class=\"relative\">\n <div class=\"flex items-center gap-2 rounded-xl bg-zinc-900/50 px-4 py-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 shrink-0\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/></svg>\n <input\n #searchInput\n [id]=\"id\"\n type=\"text\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n class=\"w-full bg-transparent text-white text-sm font-medium placeholder:text-zinc-500 border-0 outline-none focus:outline-none focus:ring-0\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (keydown)=\"onKeydown($event)\"\n [value]=\"query()\"\n autocomplete=\"off\"\n />\n @if (searching()) {\n <span class=\"text-xs text-zinc-500\">{{ translateLabel('ADDRESS_SEARCH.SEARCHING') }}</span>\n }\n </div>\n\n @if (showSuggestions()) {\n <div class=\"absolute z-50 w-full mt-1 bg-black border border-zinc-800 rounded-xl shadow-xl max-h-60 overflow-y-auto\">\n @for (suggestion of suggestions(); track $index) {\n <button\n type=\"button\"\n class=\"w-full text-left px-4 py-3 text-sm text-zinc-300 hover:bg-zinc-900 hover:text-white transition-colors border-b border-zinc-800 last:border-b-0\"\n (click)=\"selectSuggestion(suggestion)\"\n >\n <span class=\"block truncate\">{{ suggestion.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"flex items-start justify-between gap-4 rounded-xl bg-zinc-900/50 px-4 py-3\">\n <div class=\"flex items-start gap-3 min-w-0\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 mt-0.5 shrink-0\"><path d=\"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/></svg>\n <div class=\"text-sm text-zinc-300 min-w-0\">\n <p>{{ selectedStreet() }}</p>\n <p class=\"text-zinc-500\">{{ selectedLocation() }}</p>\n </div>\n </div>\n <button\n type=\"button\"\n class=\"shrink-0 text-xs text-zinc-500 hover:text-zinc-300 transition-colors\"\n (click)=\"editAddress()\"\n >\n {{ translateLabel('ADDRESS_SEARCH.EDIT') }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-1\">{{ errorMessage }}</p>\n }\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400 mt-1\">{{ props.description }}</p>\n }\n</div>\n" }]
|
|
10643
|
+
}, template: "<div [class]=\"wrapperClass\">\n <xs-formly-label\n [for]=\"id\"\n [label]=\"translateLabel(props.label)\"\n [required]=\"props.required\"\n [infoText]=\"infoText\"\n />\n\n @if (searchMode()) {\n <div class=\"relative\">\n <div class=\"flex items-center gap-2 rounded-xl bg-zinc-900/50 px-4 py-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 shrink-0\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"m21 21-4.35-4.35\"/></svg>\n <input\n #searchInput\n [id]=\"id\"\n type=\"text\"\n [disabled]=\"isFieldDisabled\"\n [placeholder]=\"translateLabel(props.placeholder) || ''\"\n class=\"w-full bg-transparent text-white text-sm font-medium placeholder:text-zinc-500 border-0 outline-none focus:outline-none focus:ring-0\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (keydown)=\"onKeydown($event)\"\n [value]=\"query()\"\n [attr.aria-describedby]=\"\n errorMessage ? 'error-' + id : null\n \"\n autocomplete=\"off\"\n />\n @if (searching()) {\n <span class=\"text-xs text-zinc-500\">{{ translateLabel('ADDRESS_SEARCH.SEARCHING') }}</span>\n }\n </div>\n\n @if (showSuggestions()) {\n <div class=\"absolute z-50 w-full mt-1 bg-black border border-zinc-800 rounded-xl shadow-xl max-h-60 overflow-y-auto\">\n @for (suggestion of suggestions(); track $index) {\n <button\n type=\"button\"\n class=\"w-full text-left px-4 py-3 text-sm text-zinc-300 hover:bg-zinc-900 hover:text-white transition-colors border-b border-zinc-800 last:border-b-0\"\n (click)=\"selectSuggestion(suggestion)\"\n >\n <span class=\"block truncate\">{{ suggestion.label }}</span>\n </button>\n }\n </div>\n }\n </div>\n } @else {\n <div class=\"flex items-start justify-between gap-4 rounded-xl bg-zinc-900/50 px-4 py-3\">\n <div class=\"flex items-start gap-3 min-w-0\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" class=\"text-zinc-500 mt-0.5 shrink-0\"><path d=\"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z\"/><circle cx=\"12\" cy=\"10\" r=\"3\"/></svg>\n <div class=\"text-sm text-zinc-300 min-w-0\">\n <p>{{ selectedStreet() }}</p>\n <p class=\"text-zinc-500\">{{ selectedLocation() }}</p>\n </div>\n </div>\n <button\n type=\"button\"\n class=\"shrink-0 text-xs text-zinc-500 hover:text-zinc-300 transition-colors\"\n [disabled]=\"isFieldDisabled\"\n (click)=\"editAddress()\"\n >\n {{ translateLabel('ADDRESS_SEARCH.EDIT') }}\n </button>\n </div>\n }\n\n @if (errorMessage) {\n <p [id]=\"'error-' + id\" class=\"text-xs text-red-500 mt-1\">{{ errorMessage }}</p>\n }\n @if (!errorMessage && props.description) {\n <p class=\"text-xs text-zinc-400 mt-1\">{{ props.description }}</p>\n }\n</div>\n" }]
|
|
10291
10644
|
}], ctorParameters: () => [], propDecorators: { searchInputRef: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }] } });
|
|
10292
10645
|
|
|
10293
10646
|
class XSFormlyInputWithActionsComponent extends XSFormlyBaseComponent {
|
|
@@ -10316,17 +10669,12 @@ class XSFormlyInputWithActionsComponent extends XSFormlyBaseComponent {
|
|
|
10316
10669
|
{
|
|
10317
10670
|
label: 'Ab',
|
|
10318
10671
|
title: this.translate.translate('FORM.INPUT_ACTIONS.TITLE_CASE'),
|
|
10319
|
-
apply: (v) => v
|
|
10320
|
-
.toLowerCase()
|
|
10321
|
-
.replace(/\b\w/g, (c) => c.toUpperCase()),
|
|
10672
|
+
apply: (v) => toTitleCase(v),
|
|
10322
10673
|
},
|
|
10323
10674
|
{
|
|
10324
10675
|
label: '×',
|
|
10325
10676
|
title: this.translate.translate('FORM.INPUT_ACTIONS.CLEAN'),
|
|
10326
|
-
apply: (v) => v
|
|
10327
|
-
.replace(/\s+/g, ' ')
|
|
10328
|
-
.replace(/[^\w\s\-.'&]/g, '')
|
|
10329
|
-
.trim(),
|
|
10677
|
+
apply: (v) => cleanText(v),
|
|
10330
10678
|
},
|
|
10331
10679
|
];
|
|
10332
10680
|
}
|
|
@@ -10337,14 +10685,9 @@ class XSFormlyInputWithActionsComponent extends XSFormlyBaseComponent {
|
|
|
10337
10685
|
case 'uppercase':
|
|
10338
10686
|
return (v) => v.toUpperCase();
|
|
10339
10687
|
case 'titlecase':
|
|
10340
|
-
return (v) => v
|
|
10341
|
-
.toLowerCase()
|
|
10342
|
-
.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
10688
|
+
return (v) => toTitleCase(v);
|
|
10343
10689
|
case 'clean':
|
|
10344
|
-
return (v) => v
|
|
10345
|
-
.replace(/\s+/g, ' ')
|
|
10346
|
-
.replace(/[^\w\s\-.'&]/g, '')
|
|
10347
|
-
.trim();
|
|
10690
|
+
return (v) => cleanText(v);
|
|
10348
10691
|
default:
|
|
10349
10692
|
return (v) => v;
|
|
10350
10693
|
}
|
|
@@ -10352,6 +10695,8 @@ class XSFormlyInputWithActionsComponent extends XSFormlyBaseComponent {
|
|
|
10352
10695
|
applyAction(action) {
|
|
10353
10696
|
const current = this.control?.value || '';
|
|
10354
10697
|
this.control?.setValue(action.apply(current));
|
|
10698
|
+
this.control?.markAsTouched();
|
|
10699
|
+
this.control?.markAsDirty();
|
|
10355
10700
|
}
|
|
10356
10701
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyInputWithActionsComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
10357
10702
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.33", type: XSFormlyInputWithActionsComponent, isStandalone: true, selector: "xs-formly-input-with-actions", usesInheritance: true, ngImport: i0, template: `
|
|
@@ -10368,8 +10713,9 @@ class XSFormlyInputWithActionsComponent extends XSFormlyBaseComponent {
|
|
|
10368
10713
|
[formControl]="control"
|
|
10369
10714
|
[id]="id"
|
|
10370
10715
|
[type]="props.type || 'text'"
|
|
10371
|
-
[placeholder]="props.placeholder
|
|
10716
|
+
[placeholder]="translateLabel(props.placeholder)"
|
|
10372
10717
|
[readonly]="props.readonly"
|
|
10718
|
+
[attr.inputmode]="props['inputmode']"
|
|
10373
10719
|
[attr.maxlength]="props['maxlength']"
|
|
10374
10720
|
[attr.aria-describedby]="
|
|
10375
10721
|
errorMessage ? 'error-' + id : null
|
|
@@ -10437,8 +10783,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
10437
10783
|
[formControl]="control"
|
|
10438
10784
|
[id]="id"
|
|
10439
10785
|
[type]="props.type || 'text'"
|
|
10440
|
-
[placeholder]="props.placeholder
|
|
10786
|
+
[placeholder]="translateLabel(props.placeholder)"
|
|
10441
10787
|
[readonly]="props.readonly"
|
|
10788
|
+
[attr.inputmode]="props['inputmode']"
|
|
10442
10789
|
[attr.maxlength]="props['maxlength']"
|
|
10443
10790
|
[attr.aria-describedby]="
|
|
10444
10791
|
errorMessage ? 'error-' + id : null
|
|
@@ -10482,6 +10829,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
10482
10829
|
`,
|
|
10483
10830
|
}]
|
|
10484
10831
|
}] });
|
|
10832
|
+
function toTitleCase(value) {
|
|
10833
|
+
return value
|
|
10834
|
+
.toLowerCase()
|
|
10835
|
+
.replace(/(^|[\s\-_([{«"'“‘])(\p{L})/gu, (_match, pre, char) => pre + char.toUpperCase());
|
|
10836
|
+
}
|
|
10837
|
+
function cleanText(value) {
|
|
10838
|
+
return value
|
|
10839
|
+
.replace(/\s+/g, ' ')
|
|
10840
|
+
.replace(/[^\p{L}\p{N}\s\-.'&]/gu, '')
|
|
10841
|
+
.trim();
|
|
10842
|
+
}
|
|
10485
10843
|
|
|
10486
10844
|
var XSFormlyType;
|
|
10487
10845
|
(function (XSFormlyType) {
|
|
@@ -10972,9 +11330,21 @@ class XSFormlyComponent {
|
|
|
10972
11330
|
options: this.options(),
|
|
10973
11331
|
});
|
|
10974
11332
|
}
|
|
11333
|
+
else {
|
|
11334
|
+
this.form.markAllAsTouched();
|
|
11335
|
+
// markAllAsTouched no cambia el status cuando el campo ya era
|
|
11336
|
+
// inválido y por tanto no emite statusChanges: los campos OnPush
|
|
11337
|
+
// no se repintarían. Se fuerza su revisión vía la API de Formly.
|
|
11338
|
+
const detectChanges = this.options().detectChanges;
|
|
11339
|
+
if (typeof detectChanges === 'function') {
|
|
11340
|
+
for (const field of this.normalizedFields()) {
|
|
11341
|
+
detectChanges(field);
|
|
11342
|
+
}
|
|
11343
|
+
}
|
|
11344
|
+
}
|
|
10975
11345
|
}
|
|
10976
11346
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyComponent, deps: [{ token: XSTranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
10977
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.33", type: XSFormlyComponent, isStandalone: true, selector: "xs-formly", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, gridClass: { classPropertyName: "gridClass", publicName: "gridClass", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", submit: "submit", formReady: "formReady" }, host: { attributes: { "xs-formly-host": "" }, properties: { "attr.size": "size()" } }, ngImport: i0, template: "<form\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n>\n <formly-form\n [form]=\"form\"\n [model]=\"model()\"\n [fields]=\"normalizedFields()\"\n [options]=\"options()\"\n (modelChange)=\"onModelChange($event)\"\n [class]=\"layout() === 'grid' ? gridClass() : (size() === 'compact' ? 'space-y-0' : 'space-y-4')\"\n ></formly-form>\n\n <ng-content></ng-content>\n</form>\n", styles: [":host ::ng-deep formly-form>formly-field,:host ::ng-deep formly-form>formly-field>formly-group{display:contents}:host ::ng-deep formly-form label:not(.formly-label){display:flex;align-items:center;gap:.5rem;padding-left:.25rem;margin-bottom:1rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.2em;color:#f8fafc}:host[size=compact] ::ng-deep formly-form label:not(.formly-label){margin-bottom:0;font-size:.625rem}:host[size=compact] ::ng-deep formly-field{background:none!important;padding:0!important;border:none!important;margin:0!important}:host[size=compact] ::ng-deep .input-select,:host[size=compact] ::ng-deep input:not([type=checkbox]):not([type=radio]),:host[size=compact] ::ng-deep .input{padding:.3125rem 1.5rem .3125rem .5rem!important;font-size:.75rem!important;min-height:0!important;height:2rem!important;line-height:1.25!important;border-radius:.5rem!important}:host[size=compact] ::ng-deep .formly-field-wrapper{margin-bottom:0!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute{padding-right:.625rem!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute svg{width:.625rem!important;height:.625rem!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: XSFormlyModule }, { kind: "component", type: i1$3.LegacyFormlyForm, selector: "formly-form" }, { kind: "ngmodule", type: FormlyModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
11347
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.33", type: XSFormlyComponent, isStandalone: true, selector: "xs-formly", inputs: { layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null }, gridClass: { classPropertyName: "gridClass", publicName: "gridClass", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fields: { classPropertyName: "fields", publicName: "fields", isSignal: true, isRequired: false, transformFunction: null }, model: { classPropertyName: "model", publicName: "model", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { model: "modelChange", submit: "submit", formReady: "formReady" }, host: { attributes: { "xs-formly-host": "" }, properties: { "attr.size": "size()" } }, ngImport: i0, template: "<form\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n (submit)=\"$event.stopPropagation()\"\n>\n <formly-form\n [form]=\"form\"\n [model]=\"model()\"\n [fields]=\"normalizedFields()\"\n [options]=\"options()\"\n (modelChange)=\"onModelChange($event)\"\n [class]=\"layout() === 'grid' ? gridClass() : (size() === 'compact' ? 'space-y-0' : 'space-y-4')\"\n ></formly-form>\n\n <ng-content></ng-content>\n</form>\n", styles: [":host ::ng-deep formly-form>formly-field,:host ::ng-deep formly-form>formly-field>formly-group{display:contents}:host ::ng-deep formly-form label:not(.formly-label){display:flex;align-items:center;gap:.5rem;padding-left:.25rem;margin-bottom:1rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.2em;color:#f8fafc}:host[size=compact] ::ng-deep formly-form label:not(.formly-label){margin-bottom:0;font-size:.625rem}:host[size=compact] ::ng-deep formly-field{background:none!important;padding:0!important;border:none!important;margin:0!important}:host[size=compact] ::ng-deep .input-select,:host[size=compact] ::ng-deep input:not([type=checkbox]):not([type=radio]),:host[size=compact] ::ng-deep .input{padding:.3125rem 1.5rem .3125rem .5rem!important;font-size:.75rem!important;min-height:0!important;height:2rem!important;line-height:1.25!important;border-radius:.5rem!important}:host[size=compact] ::ng-deep .formly-field-wrapper{margin-bottom:0!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute{padding-right:.625rem!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute svg{width:.625rem!important;height:.625rem!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: XSFormlyModule }, { kind: "component", type: i1$3.LegacyFormlyForm, selector: "formly-form" }, { kind: "ngmodule", type: FormlyModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10978
11348
|
}
|
|
10979
11349
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImport: i0, type: XSFormlyComponent, decorators: [{
|
|
10980
11350
|
type: Component,
|
|
@@ -10986,7 +11356,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
10986
11356
|
], host: {
|
|
10987
11357
|
'xs-formly-host': '',
|
|
10988
11358
|
'[attr.size]': 'size()',
|
|
10989
|
-
}, template: "<form\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n>\n <formly-form\n [form]=\"form\"\n [model]=\"model()\"\n [fields]=\"normalizedFields()\"\n [options]=\"options()\"\n (modelChange)=\"onModelChange($event)\"\n [class]=\"layout() === 'grid' ? gridClass() : (size() === 'compact' ? 'space-y-0' : 'space-y-4')\"\n ></formly-form>\n\n <ng-content></ng-content>\n</form>\n", styles: [":host ::ng-deep formly-form>formly-field,:host ::ng-deep formly-form>formly-field>formly-group{display:contents}:host ::ng-deep formly-form label:not(.formly-label){display:flex;align-items:center;gap:.5rem;padding-left:.25rem;margin-bottom:1rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.2em;color:#f8fafc}:host[size=compact] ::ng-deep formly-form label:not(.formly-label){margin-bottom:0;font-size:.625rem}:host[size=compact] ::ng-deep formly-field{background:none!important;padding:0!important;border:none!important;margin:0!important}:host[size=compact] ::ng-deep .input-select,:host[size=compact] ::ng-deep input:not([type=checkbox]):not([type=radio]),:host[size=compact] ::ng-deep .input{padding:.3125rem 1.5rem .3125rem .5rem!important;font-size:.75rem!important;min-height:0!important;height:2rem!important;line-height:1.25!important;border-radius:.5rem!important}:host[size=compact] ::ng-deep .formly-field-wrapper{margin-bottom:0!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute{padding-right:.625rem!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute svg{width:.625rem!important;height:.625rem!important}\n"] }]
|
|
11359
|
+
}, template: "<form\n [formGroup]=\"form\"\n (ngSubmit)=\"onSubmit()\"\n (submit)=\"$event.stopPropagation()\"\n>\n <formly-form\n [form]=\"form\"\n [model]=\"model()\"\n [fields]=\"normalizedFields()\"\n [options]=\"options()\"\n (modelChange)=\"onModelChange($event)\"\n [class]=\"layout() === 'grid' ? gridClass() : (size() === 'compact' ? 'space-y-0' : 'space-y-4')\"\n ></formly-form>\n\n <ng-content></ng-content>\n</form>\n", styles: [":host ::ng-deep formly-form>formly-field,:host ::ng-deep formly-form>formly-field>formly-group{display:contents}:host ::ng-deep formly-form label:not(.formly-label){display:flex;align-items:center;gap:.5rem;padding-left:.25rem;margin-bottom:1rem;font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.2em;color:#f8fafc}:host[size=compact] ::ng-deep formly-form label:not(.formly-label){margin-bottom:0;font-size:.625rem}:host[size=compact] ::ng-deep formly-field{background:none!important;padding:0!important;border:none!important;margin:0!important}:host[size=compact] ::ng-deep .input-select,:host[size=compact] ::ng-deep input:not([type=checkbox]):not([type=radio]),:host[size=compact] ::ng-deep .input{padding:.3125rem 1.5rem .3125rem .5rem!important;font-size:.75rem!important;min-height:0!important;height:2rem!important;line-height:1.25!important;border-radius:.5rem!important}:host[size=compact] ::ng-deep .formly-field-wrapper{margin-bottom:0!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute{padding-right:.625rem!important}:host[size=compact] ::ng-deep .pointer-events-none.absolute svg{width:.625rem!important;height:.625rem!important}\n"] }]
|
|
10990
11360
|
}], ctorParameters: () => [{ type: XSTranslateService }], propDecorators: { layout: [{ type: i0.Input, args: [{ isSignal: true, alias: "layout", required: false }] }], gridClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "gridClass", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fields: [{ type: i0.Input, args: [{ isSignal: true, alias: "fields", required: false }] }], model: [{ type: i0.Input, args: [{ isSignal: true, alias: "model", required: false }] }, { type: i0.Output, args: ["modelChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], submit: [{ type: i0.Output, args: ["submit"] }], formReady: [{ type: i0.Output, args: ["formReady"] }] } });
|
|
10991
11361
|
|
|
10992
11362
|
const formlyComponents = [XSFormlyComponent];
|
|
@@ -11949,6 +12319,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.33", ngImpo
|
|
|
11949
12319
|
|
|
11950
12320
|
const getTypePlural = (type) => {
|
|
11951
12321
|
const typeMappings = {
|
|
12322
|
+
album: 'albums',
|
|
12323
|
+
albums: 'albums',
|
|
11952
12324
|
article: 'articles',
|
|
11953
12325
|
articles: 'articles',
|
|
11954
12326
|
artist: 'artists',
|