@solcre-org/core-ui 2.15.17 → 2.15.19

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.
@@ -2425,6 +2425,7 @@ var HeaderElementType;
2425
2425
  HeaderElementType["FILTER"] = "filter";
2426
2426
  HeaderElementType["CREATE"] = "create";
2427
2427
  HeaderElementType["CUSTOM_TEMPLATE"] = "customTemplate";
2428
+ HeaderElementType["INDIVIDUAL_ACTION"] = "individualAction";
2428
2429
  })(HeaderElementType || (HeaderElementType = {}));
2429
2430
 
2430
2431
  var CountryCode;
@@ -3060,6 +3061,13 @@ class PhoneFieldComponent extends BaseFieldComponent {
3060
3061
  this.phoneControl.valueChanges
3061
3062
  .pipe(takeUntilDestroyed(), debounceTime(300), distinctUntilChanged())
3062
3063
  .subscribe((phoneNumber) => {
3064
+ if (phoneNumber) {
3065
+ const sanitized = phoneNumber.replace(/[^\d\s\-\(\)]/g, '');
3066
+ if (sanitized !== phoneNumber) {
3067
+ this.phoneControl.setValue(sanitized, { emitEvent: false });
3068
+ return;
3069
+ }
3070
+ }
3063
3071
  if (!this.isUpdatingValue) {
3064
3072
  this.updatePhoneValue();
3065
3073
  }
@@ -3320,12 +3328,20 @@ class PhoneFieldComponent extends BaseFieldComponent {
3320
3328
  this.toggleDropdown();
3321
3329
  }
3322
3330
  }
3331
+ onPhoneKeyPress(event) {
3332
+ const charCode = event.which || event.keyCode;
3333
+ const char = String.fromCharCode(charCode);
3334
+ const allowedChars = /[\d\s\-\(\)]/;
3335
+ if (!allowedChars.test(char)) {
3336
+ event.preventDefault();
3337
+ }
3338
+ }
3323
3339
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PhoneFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
3324
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: PhoneFieldComponent, isStandalone: true, selector: "core-phone-field", host: { listeners: { "document:click": "onDocumentClick($event)" } }, usesInheritance: true, ngImport: i0, template: "<label class=\"c-entry-item\" [class.c-entry-item--inline]=\"field().inline\">\n <span class=\"c-entry-text\" *ngIf=\"field().label\">\n {{ field().label | translate }}\n @if (hasRequiredValidators()) {\n <span class=\"c-required\">*</span>\n }\n </span>\n\n <div class=\"c-entry-phone\" [class.is-disabled]=\"isDisabled()\">\n <div\n class=\"c-entry-input c-entry-input--phone c-area-code js-area-code c-phone-field__custom-select\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-readonly]=\"isReadonly()\"\n (click)=\"onAreaCodeClick($event)\"\n (keydown.enter)=\"onAreaCodeKeydown($any($event))\"\n (keydown.space)=\"onAreaCodeKeydown($any($event))\"\n role=\"button\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"true\"\n >\n <input type=\"hidden\" class=\"js-area-value\" [value]=\"selectedCountry()?.phone || ''\" />\n <div class=\"c-area-code__selected js-area-code-selected\">\n @if (phoneConfig().showFlags && selectedCountry()?.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(selectedCountry()!)\"\n [alt]=\"selectedCountry()?.name || ''\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span class=\"c-area-code__num\">{{ getSelectedCountryDisplay() }}</span>\n <span class=\"c-area-code__arrow icon-arrow-down\"></span>\n </div>\n <div class=\"c-area-code__options js-area-code-options\" [class.show]=\"isDropdownOpen()\">\n @for (country of availableCountries(); track country.code + '-' + country.name) {\n <div class=\"c-area-code__option\" (click)=\"selectCountry(country, $event)\">\n @if (phoneConfig().showFlags && country.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(country)\"\n [alt]=\"country.name\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span>{{ getCountryLabel(country) }}</span>\n </div>\n }\n </div>\n </div>\n\n <span\n class=\"c-entry-input\"\n [class.is-readonly]=\"isReadonly() || field().blocked\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-invalid]=\"hasError()\"\n >\n <input\n type=\"tel\"\n [id]=\"field().key.toString()\"\n [name]=\"field().key.toString()\"\n [formControl]=\"phoneControl\"\n [placeholder]=\"getPhonePlaceholder() | translate\"\n [readonly]=\"isReadonly() || field().blocked\"\n [class.has-error]=\"hasError()\"\n [class.is-invalid]=\"hasError()\"\n inputmode=\"tel\"\n autocomplete=\"tel\"\n (blur)=\"onBlurInput()\"\n (keydown.enter)=\"onEnterInput($any($event))\"\n />\n </span>\n </div>\n\n <core-field-errors [errors]=\"errors()\"></core-field-errors>\n</label>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3$1.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: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "component", type: FieldErrorsComponent, selector: "core-field-errors", inputs: ["errors"] }] });
3340
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: PhoneFieldComponent, isStandalone: true, selector: "core-phone-field", host: { listeners: { "document:click": "onDocumentClick($event)" } }, usesInheritance: true, ngImport: i0, template: "<label class=\"c-entry-item\" [class.c-entry-item--inline]=\"field().inline\">\n <span class=\"c-entry-text\" *ngIf=\"field().label\">\n {{ field().label | translate }}\n @if (hasRequiredValidators()) {\n <span class=\"c-required\">*</span>\n }\n </span>\n\n <div class=\"c-entry-phone\" [class.is-disabled]=\"isDisabled()\">\n <div\n class=\"c-entry-input c-entry-input--phone c-area-code js-area-code c-phone-field__custom-select\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-readonly]=\"isReadonly()\"\n (click)=\"onAreaCodeClick($event)\"\n (keydown.enter)=\"onAreaCodeKeydown($any($event))\"\n (keydown.space)=\"onAreaCodeKeydown($any($event))\"\n role=\"button\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"true\"\n >\n <input type=\"hidden\" class=\"js-area-value\" [value]=\"selectedCountry()?.phone || ''\" />\n <div class=\"c-area-code__selected js-area-code-selected\">\n @if (phoneConfig().showFlags && selectedCountry()?.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(selectedCountry()!)\"\n [alt]=\"selectedCountry()?.name || ''\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span class=\"c-area-code__num\">{{ getSelectedCountryDisplay() }}</span>\n <span class=\"c-area-code__arrow icon-arrow-down\"></span>\n </div>\n <div class=\"c-area-code__options js-area-code-options\" [class.show]=\"isDropdownOpen()\">\n @for (country of availableCountries(); track country.code + '-' + country.name) {\n <div class=\"c-area-code__option\" (click)=\"selectCountry(country, $event)\">\n @if (phoneConfig().showFlags && country.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(country)\"\n [alt]=\"country.name\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span>{{ getCountryLabel(country) }}</span>\n </div>\n }\n </div>\n </div>\n\n <span\n class=\"c-entry-input\"\n [class.is-readonly]=\"isReadonly() || field().blocked\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-invalid]=\"hasError()\"\n >\n <input\n type=\"tel\"\n [id]=\"field().key.toString()\"\n [name]=\"field().key.toString()\"\n [formControl]=\"phoneControl\"\n [placeholder]=\"getPhonePlaceholder() | translate\"\n [readonly]=\"isReadonly() || field().blocked\"\n [class.has-error]=\"hasError()\"\n [class.is-invalid]=\"hasError()\"\n inputmode=\"numeric\"\n autocomplete=\"tel\"\n (blur)=\"onBlurInput()\"\n (keydown.enter)=\"onEnterInput($any($event))\"\n (keypress)=\"onPhoneKeyPress($event)\"\n />\n </span>\n </div>\n\n <core-field-errors [errors]=\"errors()\"></core-field-errors>\n</label>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i3$1.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: i3$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3$1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "component", type: FieldErrorsComponent, selector: "core-field-errors", inputs: ["errors"] }] });
3325
3341
  }
3326
3342
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PhoneFieldComponent, decorators: [{
3327
3343
  type: Component,
3328
- args: [{ selector: 'core-phone-field', standalone: true, imports: [CommonModule, ReactiveFormsModule, TranslateModule, FieldErrorsComponent], template: "<label class=\"c-entry-item\" [class.c-entry-item--inline]=\"field().inline\">\n <span class=\"c-entry-text\" *ngIf=\"field().label\">\n {{ field().label | translate }}\n @if (hasRequiredValidators()) {\n <span class=\"c-required\">*</span>\n }\n </span>\n\n <div class=\"c-entry-phone\" [class.is-disabled]=\"isDisabled()\">\n <div\n class=\"c-entry-input c-entry-input--phone c-area-code js-area-code c-phone-field__custom-select\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-readonly]=\"isReadonly()\"\n (click)=\"onAreaCodeClick($event)\"\n (keydown.enter)=\"onAreaCodeKeydown($any($event))\"\n (keydown.space)=\"onAreaCodeKeydown($any($event))\"\n role=\"button\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"true\"\n >\n <input type=\"hidden\" class=\"js-area-value\" [value]=\"selectedCountry()?.phone || ''\" />\n <div class=\"c-area-code__selected js-area-code-selected\">\n @if (phoneConfig().showFlags && selectedCountry()?.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(selectedCountry()!)\"\n [alt]=\"selectedCountry()?.name || ''\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span class=\"c-area-code__num\">{{ getSelectedCountryDisplay() }}</span>\n <span class=\"c-area-code__arrow icon-arrow-down\"></span>\n </div>\n <div class=\"c-area-code__options js-area-code-options\" [class.show]=\"isDropdownOpen()\">\n @for (country of availableCountries(); track country.code + '-' + country.name) {\n <div class=\"c-area-code__option\" (click)=\"selectCountry(country, $event)\">\n @if (phoneConfig().showFlags && country.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(country)\"\n [alt]=\"country.name\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span>{{ getCountryLabel(country) }}</span>\n </div>\n }\n </div>\n </div>\n\n <span\n class=\"c-entry-input\"\n [class.is-readonly]=\"isReadonly() || field().blocked\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-invalid]=\"hasError()\"\n >\n <input\n type=\"tel\"\n [id]=\"field().key.toString()\"\n [name]=\"field().key.toString()\"\n [formControl]=\"phoneControl\"\n [placeholder]=\"getPhonePlaceholder() | translate\"\n [readonly]=\"isReadonly() || field().blocked\"\n [class.has-error]=\"hasError()\"\n [class.is-invalid]=\"hasError()\"\n inputmode=\"tel\"\n autocomplete=\"tel\"\n (blur)=\"onBlurInput()\"\n (keydown.enter)=\"onEnterInput($any($event))\"\n />\n </span>\n </div>\n\n <core-field-errors [errors]=\"errors()\"></core-field-errors>\n</label>\n" }]
3344
+ args: [{ selector: 'core-phone-field', standalone: true, imports: [CommonModule, ReactiveFormsModule, TranslateModule, FieldErrorsComponent], template: "<label class=\"c-entry-item\" [class.c-entry-item--inline]=\"field().inline\">\n <span class=\"c-entry-text\" *ngIf=\"field().label\">\n {{ field().label | translate }}\n @if (hasRequiredValidators()) {\n <span class=\"c-required\">*</span>\n }\n </span>\n\n <div class=\"c-entry-phone\" [class.is-disabled]=\"isDisabled()\">\n <div\n class=\"c-entry-input c-entry-input--phone c-area-code js-area-code c-phone-field__custom-select\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-readonly]=\"isReadonly()\"\n (click)=\"onAreaCodeClick($event)\"\n (keydown.enter)=\"onAreaCodeKeydown($any($event))\"\n (keydown.space)=\"onAreaCodeKeydown($any($event))\"\n role=\"button\"\n [attr.tabindex]=\"isDisabled() ? -1 : 0\"\n [attr.aria-expanded]=\"isDropdownOpen()\"\n [attr.aria-haspopup]=\"true\"\n >\n <input type=\"hidden\" class=\"js-area-value\" [value]=\"selectedCountry()?.phone || ''\" />\n <div class=\"c-area-code__selected js-area-code-selected\">\n @if (phoneConfig().showFlags && selectedCountry()?.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(selectedCountry()!)\"\n [alt]=\"selectedCountry()?.name || ''\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span class=\"c-area-code__num\">{{ getSelectedCountryDisplay() }}</span>\n <span class=\"c-area-code__arrow icon-arrow-down\"></span>\n </div>\n <div class=\"c-area-code__options js-area-code-options\" [class.show]=\"isDropdownOpen()\">\n @for (country of availableCountries(); track country.code + '-' + country.name) {\n <div class=\"c-area-code__option\" (click)=\"selectCountry(country, $event)\">\n @if (phoneConfig().showFlags && country.flag) {\n <img\n class=\"c-area-code__flag\"\n [src]=\"getFlagUrl(country)\"\n [alt]=\"country.name\"\n (error)=\"onFlagError($event)\"\n />\n }\n <span>{{ getCountryLabel(country) }}</span>\n </div>\n }\n </div>\n </div>\n\n <span\n class=\"c-entry-input\"\n [class.is-readonly]=\"isReadonly() || field().blocked\"\n [class.is-disabled]=\"isDisabled()\"\n [class.is-invalid]=\"hasError()\"\n >\n <input\n type=\"tel\"\n [id]=\"field().key.toString()\"\n [name]=\"field().key.toString()\"\n [formControl]=\"phoneControl\"\n [placeholder]=\"getPhonePlaceholder() | translate\"\n [readonly]=\"isReadonly() || field().blocked\"\n [class.has-error]=\"hasError()\"\n [class.is-invalid]=\"hasError()\"\n inputmode=\"numeric\"\n autocomplete=\"tel\"\n (blur)=\"onBlurInput()\"\n (keydown.enter)=\"onEnterInput($any($event))\"\n (keypress)=\"onPhoneKeyPress($event)\"\n />\n </span>\n </div>\n\n <core-field-errors [errors]=\"errors()\"></core-field-errors>\n</label>\n" }]
3329
3345
  }], ctorParameters: () => [], propDecorators: { onDocumentClick: [{
3330
3346
  type: HostListener,
3331
3347
  args: ['document:click', ['$event']]
@@ -10827,8 +10843,131 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
10827
10843
  }]
10828
10844
  }] });
10829
10845
 
10846
+ class MobileResolutionService {
10847
+ DEFAULT_MOBILE_BREAKPOINT = 768;
10848
+ DEFAULT_CHECK_INTERVAL = 200;
10849
+ _isMobile = signal(false);
10850
+ _screenWidth = signal(0);
10851
+ _breakpoint = signal(this.DEFAULT_MOBILE_BREAKPOINT);
10852
+ _showHeaderBreakpoint = signal(null);
10853
+ _isConfigured = signal(false);
10854
+ resizeTimeout;
10855
+ isMobile = this._isMobile.asReadonly();
10856
+ screenWidth = this._screenWidth.asReadonly();
10857
+ breakpoint = this._breakpoint.asReadonly();
10858
+ showHeaderBreakpoint = this._showHeaderBreakpoint.asReadonly();
10859
+ isConfigured = this._isConfigured.asReadonly();
10860
+ isXSmall = computed(() => this._screenWidth() < 576);
10861
+ isSmall = computed(() => this._screenWidth() >= 576 && this._screenWidth() < 768);
10862
+ isMedium = computed(() => this._screenWidth() >= 768 && this._screenWidth() < 992);
10863
+ isLarge = computed(() => this._screenWidth() >= 992 && this._screenWidth() < 1200);
10864
+ isXLarge = computed(() => this._screenWidth() >= 1200);
10865
+ shouldShowMobileHeader = computed(() => {
10866
+ const headerBreakpoint = this._showHeaderBreakpoint();
10867
+ const effectiveBreakpoint = headerBreakpoint !== null ? headerBreakpoint : this._breakpoint();
10868
+ return this._screenWidth() <= effectiveBreakpoint;
10869
+ });
10870
+ isXs = this.isXSmall;
10871
+ isSm = this.isSmall;
10872
+ isMd = this.isMedium;
10873
+ isLg = this.isLarge;
10874
+ isXl = this.isXLarge;
10875
+ isMobileDevice = computed(() => this.isXSmall() || this.isSmall());
10876
+ isTablet = this.isMedium;
10877
+ isDesktop = computed(() => this.isLarge() || this.isXLarge());
10878
+ constructor() {
10879
+ if (typeof window !== 'undefined') {
10880
+ this.initializeWithDefaults();
10881
+ }
10882
+ }
10883
+ configure(config) {
10884
+ if (typeof window === 'undefined') {
10885
+ return;
10886
+ }
10887
+ const breakpoint = config?.maxWidth || this.DEFAULT_MOBILE_BREAKPOINT;
10888
+ const checkInterval = config?.checkInterval || this.DEFAULT_CHECK_INTERVAL;
10889
+ this._breakpoint.set(breakpoint);
10890
+ if (config?.showHeaderMaxWidth !== undefined) {
10891
+ this._showHeaderBreakpoint.set(config.showHeaderMaxWidth);
10892
+ }
10893
+ this._isConfigured.set(true);
10894
+ this.updateScreenSize();
10895
+ this.setupResizeListener(checkInterval);
10896
+ }
10897
+ initializeWithDefaults() {
10898
+ if (this._isConfigured()) {
10899
+ return;
10900
+ }
10901
+ this.configure({
10902
+ maxWidth: this.DEFAULT_MOBILE_BREAKPOINT,
10903
+ checkInterval: this.DEFAULT_CHECK_INTERVAL
10904
+ });
10905
+ }
10906
+ updateScreenSize() {
10907
+ if (typeof window === 'undefined') {
10908
+ return;
10909
+ }
10910
+ const width = window.innerWidth;
10911
+ this._screenWidth.set(width);
10912
+ this._isMobile.set(width <= this._breakpoint());
10913
+ }
10914
+ setupResizeListener(interval) {
10915
+ if (typeof window === 'undefined') {
10916
+ return;
10917
+ }
10918
+ window.removeEventListener('resize', this.handleResize);
10919
+ window.addEventListener('resize', this.handleResize.bind(this));
10920
+ }
10921
+ handleResize() {
10922
+ if (this.resizeTimeout) {
10923
+ clearTimeout(this.resizeTimeout);
10924
+ }
10925
+ this.resizeTimeout = setTimeout(() => {
10926
+ this.updateScreenSize();
10927
+ }, this.DEFAULT_CHECK_INTERVAL);
10928
+ }
10929
+ isWidthLessThan(width) {
10930
+ return this._screenWidth() <= width;
10931
+ }
10932
+ isWidthGreaterThan(width) {
10933
+ return this._screenWidth() > width;
10934
+ }
10935
+ isWidthBetween(min, max) {
10936
+ const width = this._screenWidth();
10937
+ return width >= min && width <= max;
10938
+ }
10939
+ getCurrentBreakpoint() {
10940
+ if (this.isXSmall())
10941
+ return 'xs';
10942
+ if (this.isSmall())
10943
+ return 'sm';
10944
+ if (this.isMedium())
10945
+ return 'md';
10946
+ if (this.isLarge())
10947
+ return 'lg';
10948
+ return 'xl';
10949
+ }
10950
+ destroy() {
10951
+ if (typeof window !== 'undefined') {
10952
+ window.removeEventListener('resize', this.handleResize);
10953
+ }
10954
+ if (this.resizeTimeout) {
10955
+ clearTimeout(this.resizeTimeout);
10956
+ }
10957
+ }
10958
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
10959
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, providedIn: 'root' });
10960
+ }
10961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, decorators: [{
10962
+ type: Injectable,
10963
+ args: [{
10964
+ providedIn: 'root'
10965
+ }]
10966
+ }], ctorParameters: () => [] });
10967
+
10830
10968
  class HeaderService {
10831
10969
  translateService = inject(TranslateService);
10970
+ mobileResolutionService = inject(MobileResolutionService);
10832
10971
  title = signal('');
10833
10972
  text = signal('');
10834
10973
  globalActions = signal([]);
@@ -10952,8 +11091,12 @@ class HeaderService {
10952
11091
  this.showDefaultCreate.set(config.showDefaultCreate);
10953
11092
  if (config.customActions !== undefined) {
10954
11093
  this.customActions.set(config.customActions);
11094
+ const isMobile = this.mobileResolutionService.isMobile();
10955
11095
  const headerActions = config.customActions
10956
11096
  .filter(action => {
11097
+ if (!isMobile) {
11098
+ return true;
11099
+ }
10957
11100
  if (!action.mobileConfig)
10958
11101
  return false;
10959
11102
  return action.mobileConfig.showInHeader === true;
@@ -10973,8 +11116,9 @@ class HeaderService {
10973
11116
  }));
10974
11117
  this.headerActions.set(headerActions);
10975
11118
  }
10976
- if (config.globalActions !== undefined)
11119
+ if (config.globalActions !== undefined) {
10977
11120
  this.globalActions.set(config.globalActions);
11121
+ }
10978
11122
  if (config.customFilters !== undefined)
10979
11123
  this.customFilters.set(config.customFilters);
10980
11124
  if (config.hasCreatePermission !== undefined)
@@ -11116,13 +11260,25 @@ class HeaderService {
11116
11260
  ];
11117
11261
  return defaultElements;
11118
11262
  }
11119
- const customElements = order.elements
11120
- .filter(element => element.visible !== false)
11121
- .sort((a, b) => (a.position || 0) - (b.position || 0));
11122
- return customElements;
11263
+ const expandedElements = [];
11264
+ for (const element of order.elements) {
11265
+ if (element.visible === false)
11266
+ continue;
11267
+ if (element.type !== HeaderElementType.INDIVIDUAL_ACTION) {
11268
+ expandedElements.push(element);
11269
+ continue;
11270
+ }
11271
+ if (element.actionId !== undefined && element.actionType) {
11272
+ expandedElements.push(element);
11273
+ }
11274
+ }
11275
+ return expandedElements.sort((a, b) => (a.position || 0) - (b.position || 0));
11123
11276
  }
11124
- isElementVisible(elementType) {
11277
+ isElementVisible(elementType, element) {
11125
11278
  const order = this.headerOrder();
11279
+ if (elementType === HeaderElementType.INDIVIDUAL_ACTION && element) {
11280
+ return this.isIndividualActionVisible(element);
11281
+ }
11126
11282
  if (!order || !order.useCustomOrder || !order.elements) {
11127
11283
  switch (elementType) {
11128
11284
  case HeaderElementType.GLOBAL_ACTIONS:
@@ -11140,8 +11296,8 @@ class HeaderService {
11140
11296
  return false;
11141
11297
  }
11142
11298
  }
11143
- const element = order.elements.find(el => el.type === elementType);
11144
- if (!element || element.visible === false) {
11299
+ const configElement = order.elements.find(el => el.type === elementType);
11300
+ if (!configElement || configElement.visible === false) {
11145
11301
  return false;
11146
11302
  }
11147
11303
  switch (elementType) {
@@ -11159,6 +11315,58 @@ class HeaderService {
11159
11315
  return false;
11160
11316
  }
11161
11317
  }
11318
+ isIndividualActionVisible(element) {
11319
+ if (!element.actionType || element.actionId === undefined) {
11320
+ return false;
11321
+ }
11322
+ const actionId = element.actionId;
11323
+ switch (element.actionType) {
11324
+ case 'global':
11325
+ const globalAction = this.findGlobalAction(actionId);
11326
+ return globalAction !== null;
11327
+ case 'custom':
11328
+ const customAction = this.customActions().find((action, index) => action.id === actionId || index === actionId);
11329
+ return customAction !== undefined;
11330
+ case 'switch':
11331
+ const switchAction = this.findGlobalAction(actionId);
11332
+ return switchAction !== null && switchAction.isSwitch === true;
11333
+ default:
11334
+ return false;
11335
+ }
11336
+ }
11337
+ findGlobalAction(actionId) {
11338
+ const actions = this.globalActions();
11339
+ // Buscar por índice si es número
11340
+ if (typeof actionId === 'number') {
11341
+ return actions[actionId] || null;
11342
+ }
11343
+ // Buscar por label o propiedad
11344
+ const found = actions.find(action => action.label === actionId ||
11345
+ action.icon === actionId ||
11346
+ action.id === actionId);
11347
+ return found || null;
11348
+ }
11349
+ getIndividualAction(element) {
11350
+ if (element.type !== HeaderElementType.INDIVIDUAL_ACTION) {
11351
+ return null;
11352
+ }
11353
+ if (!element.actionType || element.actionId === undefined) {
11354
+ return null;
11355
+ }
11356
+ switch (element.actionType) {
11357
+ case 'global':
11358
+ case 'switch':
11359
+ return this.findGlobalAction(element.actionId);
11360
+ case 'custom':
11361
+ const customActions = this.customActions();
11362
+ if (typeof element.actionId === 'number') {
11363
+ return customActions[element.actionId] || null;
11364
+ }
11365
+ return customActions.find(action => action.id === element.actionId) || null;
11366
+ default:
11367
+ return null;
11368
+ }
11369
+ }
11162
11370
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11163
11371
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderService, providedIn: 'root' });
11164
11372
  }
@@ -11827,157 +12035,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
11827
12035
  args: [{ selector: 'core-generic-switch', standalone: true, imports: [CommonModule, IconCompatPipe, TranslateModule], template: "<div class=\"c-switch\" [attr.aria-label]=\"ariaLabel()\" role=\"group\">\n @for (option of options(); track option.value) {\n <button\n class=\"c-icon-btn\"\n [class]=\"option.icon || '' | coreIconCompat\"\n [class.is-active]=\"isSelected(option.value)\"\n [class.is-disabled]=\"option.disabled\"\n [attr.title]=\"option.tooltip || option.label || '' | translate\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.data-value]=\"option.value\"\n (click)=\"onOptionClick(option)\"\n >\n @if (option.label && !option.icon) {\n {{ option.label | translate }}\n }\n </button>\n }\n</div>" }]
11828
12036
  }] });
11829
12037
 
11830
- class MobileResolutionService {
11831
- DEFAULT_MOBILE_BREAKPOINT = 768;
11832
- DEFAULT_CHECK_INTERVAL = 200;
11833
- _isMobile = signal(false);
11834
- _screenWidth = signal(0);
11835
- _breakpoint = signal(this.DEFAULT_MOBILE_BREAKPOINT);
11836
- _showHeaderBreakpoint = signal(null);
11837
- _isConfigured = signal(false);
11838
- resizeTimeout;
11839
- isMobile = this._isMobile.asReadonly();
11840
- screenWidth = this._screenWidth.asReadonly();
11841
- breakpoint = this._breakpoint.asReadonly();
11842
- showHeaderBreakpoint = this._showHeaderBreakpoint.asReadonly();
11843
- isConfigured = this._isConfigured.asReadonly();
11844
- isXSmall = computed(() => this._screenWidth() < 576);
11845
- isSmall = computed(() => this._screenWidth() >= 576 && this._screenWidth() < 768);
11846
- isMedium = computed(() => this._screenWidth() >= 768 && this._screenWidth() < 992);
11847
- isLarge = computed(() => this._screenWidth() >= 992 && this._screenWidth() < 1200);
11848
- isXLarge = computed(() => this._screenWidth() >= 1200);
11849
- shouldShowMobileHeader = computed(() => {
11850
- const headerBreakpoint = this._showHeaderBreakpoint();
11851
- const effectiveBreakpoint = headerBreakpoint !== null ? headerBreakpoint : this._breakpoint();
11852
- return this._screenWidth() <= effectiveBreakpoint;
11853
- });
11854
- isXs = this.isXSmall;
11855
- isSm = this.isSmall;
11856
- isMd = this.isMedium;
11857
- isLg = this.isLarge;
11858
- isXl = this.isXLarge;
11859
- isMobileDevice = computed(() => this.isXSmall() || this.isSmall());
11860
- isTablet = this.isMedium;
11861
- isDesktop = computed(() => this.isLarge() || this.isXLarge());
11862
- constructor() {
11863
- if (typeof window !== 'undefined') {
11864
- this.initializeWithDefaults();
11865
- }
11866
- }
11867
- configure(config) {
11868
- if (typeof window === 'undefined') {
11869
- return;
11870
- }
11871
- const breakpoint = config?.maxWidth || this.DEFAULT_MOBILE_BREAKPOINT;
11872
- const checkInterval = config?.checkInterval || this.DEFAULT_CHECK_INTERVAL;
11873
- this._breakpoint.set(breakpoint);
11874
- if (config?.showHeaderMaxWidth !== undefined) {
11875
- this._showHeaderBreakpoint.set(config.showHeaderMaxWidth);
11876
- }
11877
- this._isConfigured.set(true);
11878
- this.updateScreenSize();
11879
- this.setupResizeListener(checkInterval);
12038
+ class FixedActionsMobileModalService {
12039
+ _isVisible = signal(false);
12040
+ _modalData = signal(null);
12041
+ isVisible = this._isVisible.asReadonly();
12042
+ modalData = this._modalData.asReadonly();
12043
+ open(data) {
12044
+ this._modalData.set(data);
12045
+ this._isVisible.set(true);
11880
12046
  }
11881
- initializeWithDefaults() {
11882
- if (this._isConfigured()) {
11883
- return;
11884
- }
11885
- this.configure({
11886
- maxWidth: this.DEFAULT_MOBILE_BREAKPOINT,
11887
- checkInterval: this.DEFAULT_CHECK_INTERVAL
11888
- });
12047
+ close() {
12048
+ this._isVisible.set(false);
12049
+ setTimeout(() => {
12050
+ if (!this._isVisible()) {
12051
+ this._modalData.set(null);
12052
+ }
12053
+ }, 300);
11889
12054
  }
11890
- updateScreenSize() {
11891
- if (typeof window === 'undefined') {
11892
- return;
12055
+ executeAction(action, row) {
12056
+ if (action.callback) {
12057
+ action.callback(row);
11893
12058
  }
11894
- const width = window.innerWidth;
11895
- this._screenWidth.set(width);
11896
- this._isMobile.set(width <= this._breakpoint());
11897
- }
11898
- setupResizeListener(interval) {
11899
- if (typeof window === 'undefined') {
11900
- return;
12059
+ else if (action.customAction?.callback) {
12060
+ action.customAction.callback(row);
11901
12061
  }
11902
- window.removeEventListener('resize', this.handleResize);
11903
- window.addEventListener('resize', this.handleResize.bind(this));
11904
- }
11905
- handleResize() {
11906
- if (this.resizeTimeout) {
11907
- clearTimeout(this.resizeTimeout);
12062
+ else if (action.globalAction?.callback) {
12063
+ const selectedRows = this._modalData()?.selectedRows || [];
12064
+ action.globalAction.callback(selectedRows);
11908
12065
  }
11909
- this.resizeTimeout = setTimeout(() => {
11910
- this.updateScreenSize();
11911
- }, this.DEFAULT_CHECK_INTERVAL);
11912
- }
11913
- isWidthLessThan(width) {
11914
- return this._screenWidth() <= width;
11915
- }
11916
- isWidthGreaterThan(width) {
11917
- return this._screenWidth() > width;
11918
- }
11919
- isWidthBetween(min, max) {
11920
- const width = this._screenWidth();
11921
- return width >= min && width <= max;
11922
- }
11923
- getCurrentBreakpoint() {
11924
- if (this.isXSmall())
11925
- return 'xs';
11926
- if (this.isSmall())
11927
- return 'sm';
11928
- if (this.isMedium())
11929
- return 'md';
11930
- if (this.isLarge())
11931
- return 'lg';
11932
- return 'xl';
11933
- }
11934
- destroy() {
11935
- if (typeof window !== 'undefined') {
11936
- window.removeEventListener('resize', this.handleResize);
11937
- }
11938
- if (this.resizeTimeout) {
11939
- clearTimeout(this.resizeTimeout);
11940
- }
11941
- }
11942
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11943
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, providedIn: 'root' });
11944
- }
11945
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: MobileResolutionService, decorators: [{
11946
- type: Injectable,
11947
- args: [{
11948
- providedIn: 'root'
11949
- }]
11950
- }], ctorParameters: () => [] });
11951
-
11952
- class FixedActionsMobileModalService {
11953
- _isVisible = signal(false);
11954
- _modalData = signal(null);
11955
- isVisible = this._isVisible.asReadonly();
11956
- modalData = this._modalData.asReadonly();
11957
- open(data) {
11958
- this._modalData.set(data);
11959
- this._isVisible.set(true);
11960
- }
11961
- close() {
11962
- this._isVisible.set(false);
11963
- setTimeout(() => {
11964
- if (!this._isVisible()) {
11965
- this._modalData.set(null);
11966
- }
11967
- }, 300);
11968
- }
11969
- executeAction(action, row) {
11970
- if (action.callback) {
11971
- action.callback(row);
11972
- }
11973
- else if (action.customAction?.callback) {
11974
- action.customAction.callback(row);
11975
- }
11976
- else if (action.globalAction?.callback) {
11977
- const selectedRows = this._modalData()?.selectedRows || [];
11978
- action.globalAction.callback(selectedRows);
11979
- }
11980
- this.close();
12066
+ this.close();
11981
12067
  }
11982
12068
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FixedActionsMobileModalService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
11983
12069
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: FixedActionsMobileModalService, providedIn: 'root' });
@@ -12041,6 +12127,12 @@ class FixedActionsMobileModalComponent {
12041
12127
  return false;
12042
12128
  }
12043
12129
  getActionLabel(action) {
12130
+ if (action.customAction?.mobileConfig?.mobileLabel) {
12131
+ return action.customAction.mobileConfig.mobileLabel;
12132
+ }
12133
+ if (action.globalAction?.mobileConfig?.mobileLabel) {
12134
+ return action.globalAction.mobileConfig.mobileLabel;
12135
+ }
12044
12136
  return action.label || action.customAction?.label || action.globalAction?.label || '';
12045
12137
  }
12046
12138
  getActionIcon(action) {
@@ -13540,12 +13632,14 @@ class GenericTableComponent {
13540
13632
  showCreateButton: this.showCreateButton(),
13541
13633
  hasCreatePermission: this.hasAction(TableAction.CREATE),
13542
13634
  });
13635
+ const existingCustomActions = this.headerService.getCustomActions()();
13543
13636
  this.headerService.setHeaderConfig({
13544
13637
  title: this.listTitle(),
13545
13638
  globalActions: this.globalActions(),
13546
13639
  showDefaultFilter: this.showFilter(),
13547
13640
  showDefaultCreate: this.showCreateButton(),
13548
13641
  customFilters: this.customFilters(),
13642
+ customActions: existingCustomActions,
13549
13643
  headerOrder: this.headerOrder(),
13550
13644
  filterButtonConfig: this.filterButtonConfig(),
13551
13645
  createButtonConfig: this.createButtonConfig(),
@@ -15564,8 +15658,21 @@ class HeaderComponent {
15564
15658
  getHeaderText() {
15565
15659
  return this.headerService.getText()();
15566
15660
  }
15661
+ getIndividualAction(element) {
15662
+ return this.headerService.getIndividualAction(element);
15663
+ }
15664
+ isIndividualActionSwitch(action) {
15665
+ return action?.isSwitch === true && action?.switchOptions;
15666
+ }
15667
+ hasIndividualActionPermission(action) {
15668
+ if (!action)
15669
+ return false;
15670
+ if (!action.requiredPermission)
15671
+ return true;
15672
+ return this.permissionService.hasPermission(action.requiredPermission.resource, action.requiredPermission.action);
15673
+ }
15567
15674
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
15568
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: HeaderComponent, isStandalone: true, selector: "core-header", outputs: { filterRequested: "filterRequested", createRequested: "createRequested", globalActionTriggered: "globalActionTriggered" }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "@if (headerService.getIsVisible()()) {\n @if(!headerService.getHeaderOutside()()) {\n <div class=\"c-header\">\n <div class=\"c-header__row\">\n\n <div class=\"c-header__group\">\n\n <h2 class=\"c-header__heading u-heading\">{{ getHeaderTitle() }}</h2>\n\n </div>\n\n <div class=\"c-header__group u-flex\">\n\n @for (element of headerService.getOrderedElements(); track element.type) {\n @if (headerService.isElementVisible(element.type)) {\n \n @switch (element.type) {\n @case (HeaderElementType.GLOBAL_ACTIONS) {\n @for (globalAction of headerService.getGlobalActions()(); track globalAction.label || $index) {\n @if (hasPermission(globalAction)) {\n @if (globalAction.isSwitch && globalAction.switchOptions) {\n <core-generic-switch\n [options]=\"globalAction.switchOptions\"\n [selectedValue]=\"globalAction.switchSelectedValue\"\n [ariaLabel]=\"globalAction.switchAriaLabel || globalAction.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, globalAction)\">\n </core-generic-switch>\n } @else {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(globalAction)\"\n (buttonClick)=\"onGlobalButtonClick($event, globalAction)\">\n </core-generic-button>\n }\n }\n }\n }\n \n @case (HeaderElementType.CUSTOM_ACTIONS) {\n @for (customAction of headerService.getCustomActions()(); track customAction.id) {\n @if (isCustomActionVisible(customAction)) {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(customAction)\"\n (buttonClick)=\"onCustomButtonClick($event, customAction)\">\n </core-generic-button>\n }\n }\n }\n \n @case (HeaderElementType.FILTER) {\n <core-generic-button \n [config]=\"getFilterButtonConfig()\"\n (buttonClick)=\"onFilterButtonClick()\">\n </core-generic-button>\n }\n \n @case (HeaderElementType.CREATE) {\n <core-generic-button \n [config]=\"getCreateButtonConfig()\"\n (buttonClick)=\"onCreateButtonClick()\">\n </core-generic-button>\n }\n }\n \n }\n }\n\n </div>\n\n </div>\n\n <p class=\"c-header__text u-text\" *ngIf=\"getHeaderText()\">\n {{ getHeaderText() }}\n </p>\n\n @if (\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n </div>\n } @else {\n @if(\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n }\n}", styles: [":root{--header-bg: #ffffff;--header-text: #333;--header-shadow: rgba(0, 0, 0, .1);--logout-btn-color: #e74c3c;--logout-btn-hover: #c0392b;--theme-btn-color: #666;--theme-btn-hover: #007bff}.dark-mode{--header-bg: #1a1a1a;--header-text: #e0e0e0;--header-shadow: rgba(255, 255, 255, .1);--logout-btn-color: #ff6b6b;--logout-btn-hover: #ff8787;--theme-btn-color: #bbb;--theme-btn-hover: #4da8ff}.header{background-color:var(--header-bg);box-shadow:0 2px 4px var(--header-shadow);padding:15px 20px;display:flex;justify-content:space-between;align-items:center}.header .user-info{font-weight:500;color:var(--header-text)}.header .header-actions{display:flex;align-items:center;gap:15px}.header .theme-toggle-btn{background:none;border:none;color:var(--theme-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .theme-toggle-btn:hover{color:var(--theme-btn-hover)}.header .logout-btn{background:none;border:none;color:var(--logout-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .logout-btn i{margin-right:5px}.header .logout-btn:hover{color:var(--logout-btn-hover)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: GenericButtonComponent, selector: "core-generic-button", inputs: ["config", "data"], outputs: ["buttonClick"] }, { kind: "component", type: GenericSwitchComponent, selector: "core-generic-switch", inputs: ["options", "selectedValue", "ariaLabel"], outputs: ["valueChange"] }] });
15675
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: HeaderComponent, isStandalone: true, selector: "core-header", outputs: { filterRequested: "filterRequested", createRequested: "createRequested", globalActionTriggered: "globalActionTriggered" }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "@if (headerService.getIsVisible()()) {\n @if(!headerService.getHeaderOutside()()) {\n <div class=\"c-header\">\n <div class=\"c-header__row\">\n\n <div class=\"c-header__group\">\n\n <h2 class=\"c-header__heading u-heading\">{{ getHeaderTitle() }}</h2>\n\n </div>\n\n <div class=\"c-header__group u-flex\">\n\n @for (element of headerService.getOrderedElements(); track element.type + '-' + (element.actionId || $index)) {\n @if (headerService.isElementVisible(element.type, element)) {\n \n @switch (element.type) {\n @case (HeaderElementType.GLOBAL_ACTIONS) {\n @for (globalAction of headerService.getGlobalActions()(); track globalAction.label || $index) {\n @if (hasPermission(globalAction)) {\n @if (globalAction.isSwitch && globalAction.switchOptions) {\n <core-generic-switch\n [options]=\"globalAction.switchOptions\"\n [selectedValue]=\"globalAction.switchSelectedValue\"\n [ariaLabel]=\"globalAction.switchAriaLabel || globalAction.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, globalAction)\">\n </core-generic-switch>\n } @else {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(globalAction)\"\n (buttonClick)=\"onGlobalButtonClick($event, globalAction)\">\n </core-generic-button>\n }\n }\n }\n }\n \n @case (HeaderElementType.CUSTOM_ACTIONS) {\n @for (customAction of headerService.getCustomActions()(); track customAction.id) {\n @if (isCustomActionVisible(customAction)) {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(customAction)\"\n (buttonClick)=\"onCustomButtonClick($event, customAction)\">\n </core-generic-button>\n }\n }\n }\n \n @case (HeaderElementType.FILTER) {\n <core-generic-button \n [config]=\"getFilterButtonConfig()\"\n (buttonClick)=\"onFilterButtonClick()\">\n </core-generic-button>\n }\n \n @case (HeaderElementType.CREATE) {\n <core-generic-button \n [config]=\"getCreateButtonConfig()\"\n (buttonClick)=\"onCreateButtonClick()\">\n </core-generic-button>\n }\n\n @case (HeaderElementType.INDIVIDUAL_ACTION) {\n @if (getIndividualAction(element); as action) {\n @if (hasIndividualActionPermission(action)) {\n @if (isIndividualActionSwitch(action)) {\n <core-generic-switch\n [options]=\"action.switchOptions\"\n [selectedValue]=\"action.switchSelectedValue\"\n [ariaLabel]=\"action.switchAriaLabel || action.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, action)\">\n </core-generic-switch>\n } @else if (element.actionType === 'global') {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(action)\"\n (buttonClick)=\"onGlobalButtonClick($event, action)\">\n </core-generic-button>\n } @else if (element.actionType === 'custom') {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(action)\"\n (buttonClick)=\"onCustomButtonClick($event, action)\">\n </core-generic-button>\n }\n }\n }\n }\n }\n \n }\n }\n\n </div>\n\n </div>\n\n <p class=\"c-header__text u-text\" *ngIf=\"getHeaderText()\">\n {{ getHeaderText() }}\n </p>\n\n @if (\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n </div>\n } @else {\n @if(\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n }\n}", styles: [":root{--header-bg: #ffffff;--header-text: #333;--header-shadow: rgba(0, 0, 0, .1);--logout-btn-color: #e74c3c;--logout-btn-hover: #c0392b;--theme-btn-color: #666;--theme-btn-hover: #007bff}.dark-mode{--header-bg: #1a1a1a;--header-text: #e0e0e0;--header-shadow: rgba(255, 255, 255, .1);--logout-btn-color: #ff6b6b;--logout-btn-hover: #ff8787;--theme-btn-color: #bbb;--theme-btn-hover: #4da8ff}.header{background-color:var(--header-bg);box-shadow:0 2px 4px var(--header-shadow);padding:15px 20px;display:flex;justify-content:space-between;align-items:center}.header .user-info{font-weight:500;color:var(--header-text)}.header .header-actions{display:flex;align-items:center;gap:15px}.header .theme-toggle-btn{background:none;border:none;color:var(--theme-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .theme-toggle-btn:hover{color:var(--theme-btn-hover)}.header .logout-btn{background:none;border:none;color:var(--logout-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .logout-btn i{margin-right:5px}.header .logout-btn:hover{color:var(--logout-btn-hover)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: GenericButtonComponent, selector: "core-generic-button", inputs: ["config", "data"], outputs: ["buttonClick"] }, { kind: "component", type: GenericSwitchComponent, selector: "core-generic-switch", inputs: ["options", "selectedValue", "ariaLabel"], outputs: ["valueChange"] }] });
15569
15676
  }
15570
15677
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: HeaderComponent, decorators: [{
15571
15678
  type: Component,
@@ -15574,7 +15681,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
15574
15681
  TranslateModule,
15575
15682
  GenericButtonComponent,
15576
15683
  GenericSwitchComponent
15577
- ], hostDirectives: [CoreHostDirective], template: "@if (headerService.getIsVisible()()) {\n @if(!headerService.getHeaderOutside()()) {\n <div class=\"c-header\">\n <div class=\"c-header__row\">\n\n <div class=\"c-header__group\">\n\n <h2 class=\"c-header__heading u-heading\">{{ getHeaderTitle() }}</h2>\n\n </div>\n\n <div class=\"c-header__group u-flex\">\n\n @for (element of headerService.getOrderedElements(); track element.type) {\n @if (headerService.isElementVisible(element.type)) {\n \n @switch (element.type) {\n @case (HeaderElementType.GLOBAL_ACTIONS) {\n @for (globalAction of headerService.getGlobalActions()(); track globalAction.label || $index) {\n @if (hasPermission(globalAction)) {\n @if (globalAction.isSwitch && globalAction.switchOptions) {\n <core-generic-switch\n [options]=\"globalAction.switchOptions\"\n [selectedValue]=\"globalAction.switchSelectedValue\"\n [ariaLabel]=\"globalAction.switchAriaLabel || globalAction.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, globalAction)\">\n </core-generic-switch>\n } @else {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(globalAction)\"\n (buttonClick)=\"onGlobalButtonClick($event, globalAction)\">\n </core-generic-button>\n }\n }\n }\n }\n \n @case (HeaderElementType.CUSTOM_ACTIONS) {\n @for (customAction of headerService.getCustomActions()(); track customAction.id) {\n @if (isCustomActionVisible(customAction)) {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(customAction)\"\n (buttonClick)=\"onCustomButtonClick($event, customAction)\">\n </core-generic-button>\n }\n }\n }\n \n @case (HeaderElementType.FILTER) {\n <core-generic-button \n [config]=\"getFilterButtonConfig()\"\n (buttonClick)=\"onFilterButtonClick()\">\n </core-generic-button>\n }\n \n @case (HeaderElementType.CREATE) {\n <core-generic-button \n [config]=\"getCreateButtonConfig()\"\n (buttonClick)=\"onCreateButtonClick()\">\n </core-generic-button>\n }\n }\n \n }\n }\n\n </div>\n\n </div>\n\n <p class=\"c-header__text u-text\" *ngIf=\"getHeaderText()\">\n {{ getHeaderText() }}\n </p>\n\n @if (\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n </div>\n } @else {\n @if(\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n }\n}", styles: [":root{--header-bg: #ffffff;--header-text: #333;--header-shadow: rgba(0, 0, 0, .1);--logout-btn-color: #e74c3c;--logout-btn-hover: #c0392b;--theme-btn-color: #666;--theme-btn-hover: #007bff}.dark-mode{--header-bg: #1a1a1a;--header-text: #e0e0e0;--header-shadow: rgba(255, 255, 255, .1);--logout-btn-color: #ff6b6b;--logout-btn-hover: #ff8787;--theme-btn-color: #bbb;--theme-btn-hover: #4da8ff}.header{background-color:var(--header-bg);box-shadow:0 2px 4px var(--header-shadow);padding:15px 20px;display:flex;justify-content:space-between;align-items:center}.header .user-info{font-weight:500;color:var(--header-text)}.header .header-actions{display:flex;align-items:center;gap:15px}.header .theme-toggle-btn{background:none;border:none;color:var(--theme-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .theme-toggle-btn:hover{color:var(--theme-btn-hover)}.header .logout-btn{background:none;border:none;color:var(--logout-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .logout-btn i{margin-right:5px}.header .logout-btn:hover{color:var(--logout-btn-hover)}\n"] }]
15684
+ ], hostDirectives: [CoreHostDirective], template: "@if (headerService.getIsVisible()()) {\n @if(!headerService.getHeaderOutside()()) {\n <div class=\"c-header\">\n <div class=\"c-header__row\">\n\n <div class=\"c-header__group\">\n\n <h2 class=\"c-header__heading u-heading\">{{ getHeaderTitle() }}</h2>\n\n </div>\n\n <div class=\"c-header__group u-flex\">\n\n @for (element of headerService.getOrderedElements(); track element.type + '-' + (element.actionId || $index)) {\n @if (headerService.isElementVisible(element.type, element)) {\n \n @switch (element.type) {\n @case (HeaderElementType.GLOBAL_ACTIONS) {\n @for (globalAction of headerService.getGlobalActions()(); track globalAction.label || $index) {\n @if (hasPermission(globalAction)) {\n @if (globalAction.isSwitch && globalAction.switchOptions) {\n <core-generic-switch\n [options]=\"globalAction.switchOptions\"\n [selectedValue]=\"globalAction.switchSelectedValue\"\n [ariaLabel]=\"globalAction.switchAriaLabel || globalAction.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, globalAction)\">\n </core-generic-switch>\n } @else {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(globalAction)\"\n (buttonClick)=\"onGlobalButtonClick($event, globalAction)\">\n </core-generic-button>\n }\n }\n }\n }\n \n @case (HeaderElementType.CUSTOM_ACTIONS) {\n @for (customAction of headerService.getCustomActions()(); track customAction.id) {\n @if (isCustomActionVisible(customAction)) {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(customAction)\"\n (buttonClick)=\"onCustomButtonClick($event, customAction)\">\n </core-generic-button>\n }\n }\n }\n \n @case (HeaderElementType.FILTER) {\n <core-generic-button \n [config]=\"getFilterButtonConfig()\"\n (buttonClick)=\"onFilterButtonClick()\">\n </core-generic-button>\n }\n \n @case (HeaderElementType.CREATE) {\n <core-generic-button \n [config]=\"getCreateButtonConfig()\"\n (buttonClick)=\"onCreateButtonClick()\">\n </core-generic-button>\n }\n\n @case (HeaderElementType.INDIVIDUAL_ACTION) {\n @if (getIndividualAction(element); as action) {\n @if (hasIndividualActionPermission(action)) {\n @if (isIndividualActionSwitch(action)) {\n <core-generic-switch\n [options]=\"action.switchOptions\"\n [selectedValue]=\"action.switchSelectedValue\"\n [ariaLabel]=\"action.switchAriaLabel || action.label || 'Switch options'\"\n (valueChange)=\"onGlobalSwitchChange($event, action)\">\n </core-generic-switch>\n } @else if (element.actionType === 'global') {\n <core-generic-button \n [config]=\"getGlobalActionButtonConfig(action)\"\n (buttonClick)=\"onGlobalButtonClick($event, action)\">\n </core-generic-button>\n } @else if (element.actionType === 'custom') {\n <core-generic-button \n [config]=\"getCustomActionButtonConfig(action)\"\n (buttonClick)=\"onCustomButtonClick($event, action)\">\n </core-generic-button>\n }\n }\n }\n }\n }\n \n }\n }\n\n </div>\n\n </div>\n\n <p class=\"c-header__text u-text\" *ngIf=\"getHeaderText()\">\n {{ getHeaderText() }}\n </p>\n\n @if (\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n </div>\n } @else {\n @if(\n headerService.isElementVisible(HeaderElementType.CUSTOM_TEMPLATE) && \n headerService.getCustomTemplate()()\n ) {\n <ng-container [ngTemplateOutlet]=\"headerService.getCustomTemplate()()\"></ng-container>\n }\n }\n}", styles: [":root{--header-bg: #ffffff;--header-text: #333;--header-shadow: rgba(0, 0, 0, .1);--logout-btn-color: #e74c3c;--logout-btn-hover: #c0392b;--theme-btn-color: #666;--theme-btn-hover: #007bff}.dark-mode{--header-bg: #1a1a1a;--header-text: #e0e0e0;--header-shadow: rgba(255, 255, 255, .1);--logout-btn-color: #ff6b6b;--logout-btn-hover: #ff8787;--theme-btn-color: #bbb;--theme-btn-hover: #4da8ff}.header{background-color:var(--header-bg);box-shadow:0 2px 4px var(--header-shadow);padding:15px 20px;display:flex;justify-content:space-between;align-items:center}.header .user-info{font-weight:500;color:var(--header-text)}.header .header-actions{display:flex;align-items:center;gap:15px}.header .theme-toggle-btn{background:none;border:none;color:var(--theme-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .theme-toggle-btn:hover{color:var(--theme-btn-hover)}.header .logout-btn{background:none;border:none;color:var(--logout-btn-color);font-size:16px;cursor:pointer;display:flex;align-items:center}.header .logout-btn i{margin-right:5px}.header .logout-btn:hover{color:var(--logout-btn-hover)}\n"] }]
15578
15685
  }], ctorParameters: () => [] });
15579
15686
 
15580
15687
  class MobileHeaderComponent {
@@ -15717,12 +15824,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
15717
15824
  // Este archivo es generado automáticamente por scripts/update-version.js
15718
15825
  // No edites manualmente este archivo
15719
15826
  const VERSION = {
15720
- full: '2.15.17',
15827
+ full: '2.15.19',
15721
15828
  major: 2,
15722
15829
  minor: 15,
15723
- patch: 17,
15724
- timestamp: '2025-10-15T13:49:10.034Z',
15725
- buildDate: '15/10/2025'
15830
+ patch: 19,
15831
+ timestamp: '2025-10-16T18:16:52.077Z',
15832
+ buildDate: '16/10/2025'
15726
15833
  };
15727
15834
 
15728
15835
  class MainNavComponent {
@@ -16493,1334 +16600,1353 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
16493
16600
  args: ['document:keydown', ['$event']]
16494
16601
  }] } });
16495
16602
 
16496
- class GenericFixedActionsComponent {
16497
- headerService = inject(HeaderService);
16498
- fixedActionsMobileModalService = inject(FixedActionsMobileModalService);
16499
- permissionService = inject(PermissionWrapperService);
16500
- mobileResolutionService = inject(MobileResolutionService);
16501
- cdr = inject(ChangeDetectorRef);
16502
- constructor() {
16503
- effect(() => {
16504
- const actions = this.visibleActions();
16505
- this.cdr.markForCheck();
16506
- });
16507
- }
16508
- shouldShow = this.mobileResolutionService.shouldShowMobileHeader;
16509
- outsideActions = computed(() => {
16510
- const actions = this.headerService.getCustomActions()()
16511
- .filter(action => {
16512
- if (!action.mobileConfig)
16513
- return false;
16514
- return action.mobileConfig.showOutsideFixedActions === true;
16515
- })
16516
- .filter(action => {
16517
- if (action.requiredPermission) {
16518
- return this.permissionService.hasPermission(action.requiredPermission.resource, action.requiredPermission.action);
16519
- }
16520
- return true;
16521
- })
16522
- .filter(action => {
16523
- const visibleValue = action.visible;
16524
- if (typeof visibleValue === 'function') {
16525
- return visibleValue();
16526
- }
16527
- return visibleValue !== false;
16528
- });
16529
- return actions;
16530
- });
16531
- modalActions = computed(() => {
16532
- const actions = this.headerService.getCustomActions()()
16533
- .filter(action => {
16534
- if (!action.mobileConfig)
16535
- return false;
16536
- return action.mobileConfig.showInsideModal === true;
16537
- })
16538
- .filter(action => {
16539
- if (action.requiredPermission) {
16540
- return this.permissionService.hasPermission(action.requiredPermission.resource, action.requiredPermission.action);
16541
- }
16542
- return true;
16543
- })
16544
- .filter(action => {
16545
- const visibleValue = action.visible;
16546
- if (typeof visibleValue === 'function') {
16547
- return visibleValue();
16603
+ class DataStoreService {
16604
+ stores = new Map();
16605
+ defaultIdSelector(item) {
16606
+ if (item && typeof item === 'object' && 'id' in item) {
16607
+ const idVal = item.id;
16608
+ if (typeof idVal === 'string' || typeof idVal === 'number') {
16609
+ return idVal;
16548
16610
  }
16549
- return visibleValue !== false;
16550
- });
16551
- return actions;
16552
- });
16553
- hasModalActions = computed(() => {
16554
- const has = this.modalActions().length > 0;
16555
- return has;
16556
- });
16557
- visibleActions = computed(() => {
16558
- const actions = [];
16559
- this.outsideActions().forEach(action => {
16560
- actions.push({
16561
- id: action.id,
16562
- icon: action.icon,
16563
- label: action.label,
16564
- class: action.class,
16565
- tooltip: action.tooltip,
16566
- callback: action.callback,
16567
- requiredPermission: action.requiredPermission
16568
- });
16569
- });
16570
- const modalActionsArray = this.modalActions();
16571
- if (modalActionsArray.length > 0) {
16572
- const plusButtonAction = {
16573
- id: 'header-more-actions',
16574
- icon: 'icon-add-clean',
16575
- class: 'c-btn',
16576
- tooltip: 'Más acciones',
16577
- callback: () => this.openModalActions()
16578
- };
16579
- actions.push(plusButtonAction);
16580
16611
  }
16581
- return actions;
16582
- });
16583
- getActionClass(action) {
16584
- const baseClass = 'c-fixed-actions__btn';
16585
- const iconClass = action.icon || '';
16586
- const customClass = action.class || 'c-btn';
16587
- return `${baseClass} ${customClass} ${iconClass}`.trim();
16588
- }
16589
- isActionDisabled(action) {
16590
- return false;
16612
+ throw new Error('No se encontró una propiedad id (string o number) y no se pasó idSelector.');
16591
16613
  }
16592
- onActionClick(action) {
16593
- if (action.callback) {
16594
- action.callback();
16614
+ ensureStore(key, idSelector) {
16615
+ if (!this.stores.has(key)) {
16616
+ this.stores.set(key, {
16617
+ items: signal([]),
16618
+ index: new Map(),
16619
+ idSelector: idSelector ?? this.defaultIdSelector,
16620
+ });
16621
+ }
16622
+ else if (idSelector) {
16623
+ this.stores.get(key).idSelector = idSelector;
16595
16624
  }
16625
+ return this.stores.get(key);
16596
16626
  }
16597
- openModalActions() {
16598
- const actions = this.modalActions();
16599
- if (actions.length === 0)
16600
- return;
16601
- const fixedActions = actions.map(action => ({
16602
- id: action.id,
16603
- label: action.label,
16604
- icon: action.icon,
16605
- class: action.class,
16606
- callback: action.callback,
16607
- requiredPermission: action.requiredPermission,
16608
- customAction: {
16609
- label: action.label,
16610
- title: action.label,
16611
- icon: action.icon,
16612
- callback: () => {
16613
- if (action.callback) {
16614
- action.callback();
16615
- }
16616
- },
16617
- requiredPermission: action.requiredPermission,
16618
- shouldShow: () => action.visible !== false,
16619
- shouldDisable: () => action.disabled === true
16620
- }
16621
- }));
16622
- this.fixedActionsMobileModalService.open({
16623
- title: 'Acciones',
16624
- actions: fixedActions
16625
- });
16627
+ hydrate(key, items, idSelector) {
16628
+ const store = this.ensureStore(key, idSelector);
16629
+ const copy = [...items];
16630
+ const idx = new Map();
16631
+ for (const it of copy) {
16632
+ idx.set(String(store.idSelector(it)), it);
16633
+ }
16634
+ store.items.set(copy);
16635
+ store.index = idx;
16626
16636
  }
16627
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericFixedActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16628
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: GenericFixedActionsComponent, isStandalone: true, selector: "core-generic-fixed-actions", ngImport: i0, template: `
16629
- @if (shouldShow() && visibleActions().length > 0) {
16630
- @for (action of visibleActions(); track action.id) {
16631
- <button
16632
- type="button"
16633
- [ngClass]="getActionClass(action)"
16634
- [disabled]="isActionDisabled(action)"
16635
- [title]="action.tooltip || action.label || ''"
16636
- [attr.aria-label]="action.tooltip || action.label || ''"
16637
- (click)="onActionClick(action)">
16638
- </button>
16637
+ upsertOne(key, item, idSelector) {
16638
+ const store = this.ensureStore(key, idSelector);
16639
+ const id = String(store.idSelector(item));
16640
+ const current = store.items();
16641
+ const pos = current.findIndex((i) => String(store.idSelector(i)) === id);
16642
+ if (pos >= 0) {
16643
+ const next = [...current];
16644
+ next[pos] = item;
16645
+ store.items.set(next);
16646
+ }
16647
+ else {
16648
+ store.items.set([...current, item]);
16639
16649
  }
16650
+ store.index.set(id, item);
16640
16651
  }
16641
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
16642
- }
16643
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericFixedActionsComponent, decorators: [{
16644
- type: Component,
16645
- args: [{
16646
- selector: 'core-generic-fixed-actions',
16647
- standalone: true,
16648
- imports: [CommonModule],
16649
- template: `
16650
- @if (shouldShow() && visibleActions().length > 0) {
16651
- @for (action of visibleActions(); track action.id) {
16652
- <button
16653
- type="button"
16654
- [ngClass]="getActionClass(action)"
16655
- [disabled]="isActionDisabled(action)"
16656
- [title]="action.tooltip || action.label || ''"
16657
- [attr.aria-label]="action.tooltip || action.label || ''"
16658
- (click)="onActionClick(action)">
16659
- </button>
16652
+ upsertMany(key, items, idSelector) {
16653
+ for (const it of items) {
16654
+ this.upsertOne(key, it, idSelector);
16660
16655
  }
16661
16656
  }
16662
- `,
16663
- }]
16664
- }], ctorParameters: () => [] });
16665
-
16666
- class LayoutComponent {
16667
- navItems = input([]);
16668
- bottomNavItems = input([]);
16669
- collapsedLogo = input('');
16670
- expandedLogo = input('');
16671
- logoImagesConfig = input(null);
16672
- navConfig = input({});
16673
- mobileHeaderConfig = input(null);
16674
- onLogout = output();
16675
- onMobileRefresh = output();
16676
- onMobileFilter = output();
16677
- dialogService = inject(ConfirmationDialogService);
16678
- mainNavService = inject(MainNavService);
16679
- layoutService = inject(LayoutService);
16680
- layoutStateService = inject(LayoutStateService);
16681
- sidebarMobileModalService = inject(SidebarMobileModalService);
16682
- templateRegistry = inject(SidebarTemplateRegistryService);
16683
- headerService = inject(HeaderService);
16684
- mobileResolutionService = inject(MobileResolutionService);
16685
- SidebarVisibility = SidebarVisibility;
16686
- ModalMode = ModalMode;
16687
- SidebarMobileType = SidebarMobileType;
16688
- screenWidth = signal(typeof window !== 'undefined' ? window.innerWidth : 1024);
16689
- isSidebarCollapsed = false;
16690
- isHeaderVisible = false;
16691
- isMobile = this.mobileResolutionService.isMobile;
16692
- shouldShowMobileHeader = this.mobileResolutionService.shouldShowMobileHeader;
16693
- mainNavComponent;
16694
- get leftSidebarConfig() {
16695
- return this.layoutStateService.getLeftSidebarConfig()();
16657
+ removeOne(key, id, idSelector) {
16658
+ const store = this.ensureStore(key, idSelector);
16659
+ const idStr = String(id);
16660
+ const next = store
16661
+ .items()
16662
+ .filter((i) => String(store.idSelector(i)) !== idStr);
16663
+ store.items.set(next);
16664
+ store.index.delete(idStr);
16696
16665
  }
16697
- get rightSidebarConfig() {
16698
- return this.layoutStateService.getRightSidebarConfig()();
16666
+ removeMany(key, ids, idSelector) {
16667
+ const store = this.ensureStore(key, idSelector);
16668
+ const idsSet = new Set(ids.map(String));
16669
+ const next = store
16670
+ .items()
16671
+ .filter((i) => !idsSet.has(String(store.idSelector(i))));
16672
+ store.items.set(next);
16673
+ for (const id of ids) {
16674
+ store.index.delete(String(id));
16675
+ }
16699
16676
  }
16700
- ngOnInit() {
16701
- this.mainNavService.isCollapsed$.subscribe(isCollapsed => {
16702
- this.isSidebarCollapsed = isCollapsed;
16703
- });
16704
- this.layoutStateService.isHeaderVisible$().subscribe(isVisible => {
16705
- this.isHeaderVisible = isVisible;
16677
+ clear(key, idSelector) {
16678
+ const store = this.ensureStore(key, idSelector);
16679
+ store.items.set([]);
16680
+ store.index.clear();
16681
+ }
16682
+ selectAll(key, idSelector) {
16683
+ const store = this.ensureStore(key, idSelector);
16684
+ return computed(() => store.items());
16685
+ }
16686
+ getById(key, id, idSelector) {
16687
+ const store = this.ensureStore(key, idSelector);
16688
+ return store.index.get(String(id));
16689
+ }
16690
+ selectById(key, id, idSelector) {
16691
+ const store = this.ensureStore(key, idSelector);
16692
+ const idStr = String(id);
16693
+ return computed(() => {
16694
+ store.items();
16695
+ return store.index.get(idStr);
16706
16696
  });
16707
- this.updateScreenWidth();
16708
16697
  }
16709
- onResize(event) {
16710
- this.updateScreenWidth();
16698
+ count(key, idSelector) {
16699
+ const store = this.ensureStore(key, idSelector);
16700
+ return store.items().length;
16711
16701
  }
16712
- updateScreenWidth() {
16713
- if (typeof window !== 'undefined') {
16714
- this.screenWidth.set(window.innerWidth);
16702
+ hasData(key) {
16703
+ return this.stores.has(key) && this.stores.get(key).items().length > 0;
16704
+ }
16705
+ getStoreKeys() {
16706
+ return Array.from(this.stores.keys());
16707
+ }
16708
+ removeStore(key) {
16709
+ this.stores.delete(key);
16710
+ }
16711
+ flush(key) {
16712
+ if (key) {
16713
+ if (this.stores.has(key)) {
16714
+ const store = this.stores.get(key);
16715
+ store.items.set([]);
16716
+ store.index.clear();
16717
+ }
16718
+ }
16719
+ else {
16720
+ for (const [storeKey, store] of this.stores.entries()) {
16721
+ store.items.set([]);
16722
+ store.index.clear();
16723
+ }
16715
16724
  }
16716
16725
  }
16717
- isMobileView(config) {
16718
- const responsiveConfig = config?.responsiveConfig;
16719
- const maxBreakpoint = responsiveConfig?.maxMobileBreakpoint ?? this.mobileResolutionService.breakpoint();
16720
- const minBreakpoint = responsiveConfig?.minMobileBreakpoint ?? 0;
16721
- return this.screenWidth() <= maxBreakpoint && this.screenWidth() >= minBreakpoint;
16726
+ flushAll() {
16727
+ this.stores.clear();
16722
16728
  }
16723
- shouldRenderLeftSidebar() {
16724
- const config = this.leftSidebarConfig;
16725
- const responsiveConfig = config?.responsiveConfig;
16726
- if (!responsiveConfig)
16727
- return true;
16728
- if (this.isMobileView(config) && responsiveConfig.mobileType === SidebarMobileType.MODAL) {
16729
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
16730
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, providedIn: 'root' });
16731
+ }
16732
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, decorators: [{
16733
+ type: Injectable,
16734
+ args: [{ providedIn: 'root' }]
16735
+ }] });
16736
+
16737
+ class CustomClassService {
16738
+ rendererFactory;
16739
+ dataStore;
16740
+ renderer;
16741
+ STORE_KEY = 'custom-class-operations';
16742
+ operationCounter = 0;
16743
+ constructor(rendererFactory, dataStore) {
16744
+ this.rendererFactory = rendererFactory;
16745
+ this.dataStore = dataStore;
16746
+ this.renderer = this.rendererFactory.createRenderer(null, null);
16747
+ // Initialize the store
16748
+ this.dataStore.hydrate(this.STORE_KEY, []);
16749
+ }
16750
+ ngOnDestroy() {
16751
+ this.clearHistory();
16752
+ this.dataStore.removeStore(this.STORE_KEY);
16753
+ }
16754
+ addClass(target, classNames, parent) {
16755
+ const elements = this.resolveElements(target, parent);
16756
+ if (elements.length === 0) {
16757
+ this.recordOperation('add', target, classNames, false);
16729
16758
  return false;
16730
16759
  }
16760
+ const classes = Array.isArray(classNames) ? classNames : [classNames];
16761
+ elements.forEach(element => {
16762
+ classes.forEach(className => {
16763
+ if (className && className.trim()) {
16764
+ this.renderer.addClass(element, className.trim());
16765
+ }
16766
+ });
16767
+ });
16768
+ this.recordOperation('add', target, classes, true);
16731
16769
  return true;
16732
16770
  }
16733
- shouldRenderRightSidebar() {
16734
- const config = this.rightSidebarConfig;
16735
- const responsiveConfig = config?.responsiveConfig;
16736
- if (!responsiveConfig)
16737
- return true;
16738
- if (this.isMobileView(config) && responsiveConfig.mobileType === SidebarMobileType.MODAL) {
16771
+ removeClass(target, classNames, parent) {
16772
+ const elements = this.resolveElements(target, parent);
16773
+ if (elements.length === 0) {
16774
+ this.recordOperation('remove', target, classNames, false);
16739
16775
  return false;
16740
16776
  }
16777
+ const classes = Array.isArray(classNames) ? classNames : [classNames];
16778
+ elements.forEach(element => {
16779
+ classes.forEach(className => {
16780
+ if (className && className.trim()) {
16781
+ this.renderer.removeClass(element, className.trim());
16782
+ }
16783
+ });
16784
+ });
16785
+ this.recordOperation('remove', target, classes, true);
16741
16786
  return true;
16742
16787
  }
16743
- getEffectiveLeftSidebarVisibility() {
16744
- if (!this.shouldRenderLeftSidebar()) {
16745
- return SidebarVisibility.HIDE;
16788
+ toggleClass(target, classNames, parent) {
16789
+ const elements = this.resolveElements(target, parent);
16790
+ if (elements.length === 0) {
16791
+ this.recordOperation('toggle', target, classNames, false);
16792
+ return false;
16746
16793
  }
16747
- return this.layoutService.sidebarLeft().visibility;
16794
+ const classes = Array.isArray(classNames) ? classNames : [classNames];
16795
+ elements.forEach(element => {
16796
+ classes.forEach(className => {
16797
+ if (className && className.trim()) {
16798
+ const trimmedClass = className.trim();
16799
+ if (element.classList.contains(trimmedClass)) {
16800
+ this.renderer.removeClass(element, trimmedClass);
16801
+ }
16802
+ else {
16803
+ this.renderer.addClass(element, trimmedClass);
16804
+ }
16805
+ }
16806
+ });
16807
+ });
16808
+ this.recordOperation('toggle', target, classes, true);
16809
+ return true;
16748
16810
  }
16749
- getEffectiveLeftSidebarWidth() {
16750
- if (!this.shouldRenderLeftSidebar()) {
16751
- return SidebarWidth.DEFAULT;
16811
+ hasClass(target, className, parent) {
16812
+ const elements = this.resolveElements(target, parent);
16813
+ if (elements.length === 0) {
16814
+ return false;
16752
16815
  }
16753
- return this.layoutService.sidebarLeft().width;
16816
+ const element = elements[0];
16817
+ return element.classList.contains(className.trim());
16754
16818
  }
16755
- getEffectiveLeftSidebarHeight() {
16756
- if (!this.shouldRenderLeftSidebar()) {
16757
- return SidebarHeight.DEFAULT;
16819
+ replaceClass(target, oldClass, newClass, parent) {
16820
+ const elements = this.resolveElements(target, parent);
16821
+ if (elements.length === 0) {
16822
+ this.recordOperation('replace', target, [newClass], false, oldClass);
16823
+ return false;
16758
16824
  }
16759
- return this.layoutService.sidebarLeft().height;
16825
+ elements.forEach(element => {
16826
+ if (oldClass && oldClass.trim()) {
16827
+ this.renderer.removeClass(element, oldClass.trim());
16828
+ }
16829
+ if (newClass && newClass.trim()) {
16830
+ this.renderer.addClass(element, newClass.trim());
16831
+ }
16832
+ });
16833
+ this.recordOperation('replace', target, [newClass], true, oldClass);
16834
+ return true;
16760
16835
  }
16761
- getEffectiveRightSidebarVisibility() {
16762
- if (!this.shouldRenderRightSidebar()) {
16763
- return SidebarVisibility.HIDE;
16836
+ setClass(target, classNames, parent) {
16837
+ const elements = this.resolveElements(target, parent);
16838
+ if (elements.length === 0) {
16839
+ this.recordOperation('set', target, classNames, false);
16840
+ return false;
16764
16841
  }
16765
- return this.layoutService.sidebarRight().visibility;
16842
+ const classes = Array.isArray(classNames) ? classNames : [classNames];
16843
+ elements.forEach(element => {
16844
+ // Clear all existing classes
16845
+ element.className = '';
16846
+ // Add new classes
16847
+ classes.forEach(className => {
16848
+ if (className && className.trim()) {
16849
+ this.renderer.addClass(element, className.trim());
16850
+ }
16851
+ });
16852
+ });
16853
+ this.recordOperation('set', target, classes, true);
16854
+ return true;
16766
16855
  }
16767
- getEffectiveRightSidebarWidth() {
16768
- if (!this.shouldRenderRightSidebar()) {
16769
- return SidebarWidth.DEFAULT;
16856
+ resolveElements(target, parent) {
16857
+ let searchContext = document;
16858
+ // Resolve parent context if provided
16859
+ if (parent) {
16860
+ if (parent instanceof ElementRef) {
16861
+ searchContext = parent.nativeElement;
16862
+ }
16863
+ else if (parent instanceof HTMLElement) {
16864
+ searchContext = parent;
16865
+ }
16866
+ else if (parent && parent.nativeElement instanceof HTMLElement) {
16867
+ searchContext = parent.nativeElement;
16868
+ }
16869
+ else if (typeof parent === 'string') {
16870
+ const parentElement = document.querySelector(parent);
16871
+ if (parentElement instanceof HTMLElement) {
16872
+ searchContext = parentElement;
16873
+ }
16874
+ }
16770
16875
  }
16771
- return this.layoutService.sidebarRight().width;
16772
- }
16773
- getEffectiveRightSidebarHeight() {
16774
- if (!this.shouldRenderRightSidebar()) {
16775
- return SidebarHeight.DEFAULT;
16876
+ // ElementRef from ViewChild
16877
+ if (target instanceof ElementRef) {
16878
+ const element = target.nativeElement;
16879
+ // If parent is specified, check if element is within parent
16880
+ if (parent && searchContext !== document) {
16881
+ return searchContext.contains(element) ? [element] : [];
16882
+ }
16883
+ return [element];
16776
16884
  }
16777
- return this.layoutService.sidebarRight().height;
16778
- }
16779
- toggleSidebar() {
16780
- this.mainNavService.toggleSidebarState();
16781
- }
16782
- getHeaderClasses() {
16783
- const baseClass = 'o-layout__header';
16784
- const customClass = this.headerService.getGlobalCustomClass()();
16785
- return customClass ? `${baseClass} ${customClass}` : baseClass;
16786
- }
16787
- onFilterRequested() {
16788
- const event = new CustomEvent('filterRequested');
16789
- window.dispatchEvent(event);
16790
- }
16791
- onCreateRequested() {
16792
- const event = new CustomEvent('createRequested');
16793
- window.dispatchEvent(event);
16794
- }
16795
- onGlobalActionTriggered(action) {
16796
- const event = new CustomEvent('globalActionTriggered', { detail: action });
16797
- window.dispatchEvent(event);
16885
+ // Direct HTMLElement
16886
+ if (target instanceof HTMLElement) {
16887
+ // If parent is specified, check if element is within parent
16888
+ if (parent && searchContext !== document) {
16889
+ return searchContext.contains(target) ? [target] : [];
16890
+ }
16891
+ return [target];
16892
+ }
16893
+ // NodeList or HTMLCollection
16894
+ if (target instanceof NodeList || target instanceof HTMLCollection) {
16895
+ const elements = Array.from(target);
16896
+ // Filter by parent if specified
16897
+ if (parent && searchContext !== document) {
16898
+ return elements.filter(el => searchContext.contains(el));
16899
+ }
16900
+ return elements;
16901
+ }
16902
+ // CSS Selector string
16903
+ if (typeof target === 'string') {
16904
+ const elements = searchContext.querySelectorAll(target);
16905
+ return Array.from(elements);
16906
+ }
16907
+ // If it has a nativeElement property (custom wrapper)
16908
+ if (target && target.nativeElement instanceof HTMLElement) {
16909
+ const element = target.nativeElement;
16910
+ // If parent is specified, check if element is within parent
16911
+ if (parent && searchContext !== document) {
16912
+ return searchContext.contains(element) ? [element] : [];
16913
+ }
16914
+ return [element];
16915
+ }
16916
+ return [];
16798
16917
  }
16799
- onMobileMenuClick() {
16800
- this.mainNavComponent?.toggleMobileNav();
16918
+ recordOperation(operation, target, classNames, success, oldClass) {
16919
+ const classes = Array.isArray(classNames) ? classNames : [classNames];
16920
+ const targetId = this.getTargetIdentifier(target);
16921
+ const record = {
16922
+ id: `op-${++this.operationCounter}-${Date.now()}`,
16923
+ timestamp: Date.now(),
16924
+ operation,
16925
+ target: targetId,
16926
+ classNames: classes,
16927
+ oldClass,
16928
+ success
16929
+ };
16930
+ this.dataStore.upsertOne(this.STORE_KEY, record);
16801
16931
  }
16802
- onMobileRefreshClick() {
16803
- const refreshCallback = this.headerService.getRefreshCallback()();
16804
- if (refreshCallback) {
16805
- refreshCallback();
16932
+ getTargetIdentifier(target) {
16933
+ if (typeof target === 'string') {
16934
+ return target;
16806
16935
  }
16807
- this.onMobileRefresh.emit();
16936
+ if (target instanceof ElementRef) {
16937
+ return this.getElementSelector(target.nativeElement);
16938
+ }
16939
+ if (target instanceof HTMLElement) {
16940
+ return this.getElementSelector(target);
16941
+ }
16942
+ if (target && target.nativeElement instanceof HTMLElement) {
16943
+ return this.getElementSelector(target.nativeElement);
16944
+ }
16945
+ return 'unknown-target';
16808
16946
  }
16809
- onMobileFilterClick() {
16810
- const event = new CustomEvent('filterRequested');
16811
- window.dispatchEvent(event);
16812
- this.onMobileFilter.emit();
16947
+ getElementSelector(element) {
16948
+ if (element.id) {
16949
+ return `#${element.id}`;
16950
+ }
16951
+ const classes = Array.from(element.classList).join('.');
16952
+ if (classes) {
16953
+ return `.${classes}`;
16954
+ }
16955
+ return element.tagName.toLowerCase();
16813
16956
  }
16814
- setLeftSidebarConfig(config) {
16815
- this.layoutStateService.setLeftSidebarConfig(config);
16957
+ getOperationHistory() {
16958
+ return [...this.dataStore.selectAll(this.STORE_KEY)()];
16816
16959
  }
16817
- setRightSidebarConfig(config) {
16818
- this.layoutStateService.setRightSidebarConfig(config);
16960
+ getOperationsByType(operation) {
16961
+ return this.getOperationHistory().filter(op => op.operation === operation);
16819
16962
  }
16820
- hideLeftSidebar() {
16821
- this.layoutStateService.hideLeftSidebar();
16963
+ getOperationsByTarget(target) {
16964
+ return this.getOperationHistory().filter(op => op.target === target);
16822
16965
  }
16823
- hideRightSidebar() {
16824
- this.layoutStateService.hideRightSidebar();
16966
+ getSuccessfulOperations() {
16967
+ return this.getOperationHistory().filter(op => op.success);
16825
16968
  }
16826
- getSidebarModalTitle() {
16827
- const modalState = this.sidebarMobileModalService.getModalState();
16828
- const config = modalState.config();
16829
- if (!config)
16830
- return '';
16831
- if (config.title) {
16832
- return config.title;
16833
- }
16834
- if (config.templateKey) {
16835
- return config.title || 'Sidebar';
16836
- }
16837
- return 'Menu';
16969
+ getFailedOperations() {
16970
+ return this.getOperationHistory().filter(op => !op.success);
16838
16971
  }
16839
- getSidebarModalButtons() {
16840
- return [
16841
- {
16842
- text: 'modal.cancel',
16843
- action: () => this.sidebarMobileModalService.closeModal(),
16844
- },
16845
- ];
16972
+ getOperationCount() {
16973
+ return this.dataStore.count(this.STORE_KEY);
16846
16974
  }
16847
- get sidebarModalContentTemplate() {
16848
- const modalState = this.sidebarMobileModalService.getModalState();
16849
- const config = modalState.config();
16850
- if (!config)
16851
- return null;
16852
- if (config.customTemplate) {
16853
- return config.customTemplate;
16854
- }
16855
- if (config.templateKey) {
16856
- return this.templateRegistry.getTemplate(config.templateKey);
16857
- }
16858
- return null;
16975
+ clearHistory() {
16976
+ this.dataStore.clear(this.STORE_KEY);
16977
+ this.operationCounter = 0;
16859
16978
  }
16860
- logout() {
16861
- this.onLogout.emit();
16979
+ getRecentOperations(limit = 10) {
16980
+ const all = this.getOperationHistory();
16981
+ return all.slice(-limit).reverse();
16862
16982
  }
16863
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
16864
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: LayoutComponent, isStandalone: true, selector: "core-layout", inputs: { navItems: { classPropertyName: "navItems", publicName: "navItems", isSignal: true, isRequired: false, transformFunction: null }, bottomNavItems: { classPropertyName: "bottomNavItems", publicName: "bottomNavItems", isSignal: true, isRequired: false, transformFunction: null }, collapsedLogo: { classPropertyName: "collapsedLogo", publicName: "collapsedLogo", isSignal: true, isRequired: false, transformFunction: null }, expandedLogo: { classPropertyName: "expandedLogo", publicName: "expandedLogo", isSignal: true, isRequired: false, transformFunction: null }, logoImagesConfig: { classPropertyName: "logoImagesConfig", publicName: "logoImagesConfig", isSignal: true, isRequired: false, transformFunction: null }, navConfig: { classPropertyName: "navConfig", publicName: "navConfig", isSignal: true, isRequired: false, transformFunction: null }, mobileHeaderConfig: { classPropertyName: "mobileHeaderConfig", publicName: "mobileHeaderConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLogout: "onLogout", onMobileRefresh: "onMobileRefresh", onMobileFilter: "onMobileFilter" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "mainNavComponent", first: true, predicate: MainNavComponent, descendants: true }], hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"o-layout\" \n [attr.data-layout]=\"layoutService.dataAttributes()['data-layout']\"\n [attr.data-sidebar-left]=\"getEffectiveLeftSidebarVisibility()\"\n [attr.data-sidebar-left-w]=\"getEffectiveLeftSidebarWidth()\"\n [attr.data-sidebar-left-h]=\"getEffectiveLeftSidebarHeight()\"\n [attr.data-sidebar-right]=\"getEffectiveRightSidebarVisibility()\"\n [attr.data-sidebar-right-w]=\"getEffectiveRightSidebarWidth()\"\n [attr.data-sidebar-right-h]=\"getEffectiveRightSidebarHeight()\"\n >\n\n <!-- Nav -->\n <core-main-nav class=\"o-layout__nav\" \n (toggleSidebar)=\"toggleSidebar()\"\n [navItems]=\"navItems()\"\n [navConfig]=\"navConfig()\"\n [bottomNavItems]=\"bottomNavItems()\"\n [logoImagesConfig]=\"logoImagesConfig()\"\n [collapsedLogo]=\"collapsedLogo()\"\n [expandedLogo]=\"expandedLogo()\"\n (onLogout)=\"logout()\"\n >\n </core-main-nav>\n\n <!-- Main -->\n <div class=\"o-layout__body\">\n \n @if(shouldShowMobileHeader() && mobileHeaderConfig()) {\n <core-mobile-header\n class=\"o-layout__header c-header-mobile\"\n [config]=\"mobileHeaderConfig()!\"\n (menuClick)=\"onMobileMenuClick()\"\n (refreshClick)=\"onMobileRefreshClick()\"\n (filterClick)=\"onMobileFilterClick()\">\n </core-mobile-header>\n }\n\n @if(layoutStateService.isHeaderVisible$() | async) {\n @if(!shouldShowMobileHeader()) {\n <core-header\n [class]=\"getHeaderClasses()\"\n (filterRequested)=\"onFilterRequested()\"\n (createRequested)=\"onCreateRequested()\"\n (globalActionTriggered)=\"onGlobalActionTriggered($event)\">\n </core-header>\n }\n }\n\n @if(layoutService.sidebarLeft().visibility === SidebarVisibility.SHOW && leftSidebarConfig && shouldRenderLeftSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--left\"\n [config]=\"leftSidebarConfig\">\n </core-generic-sidebar>\n }\n\n <ng-content></ng-content>\n\n @if(layoutService.sidebarRight().visibility === SidebarVisibility.SHOW && rightSidebarConfig && shouldRenderRightSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--right\"\n [config]=\"rightSidebarConfig\">\n </core-generic-sidebar>\n }\n\n\n @if(dialogService.isOpen$()) {\n <core-confirmation-dialog\n [isOpen]=\"dialogService.isOpen$()\"\n [config]=\"dialogService.config$()\"\n (confirm)=\"dialogService.confirm($event)\"\n (cancel)=\"dialogService.cancel()\"\n ></core-confirmation-dialog>\n }\n\n @if(sidebarMobileModalService.isOpen()) {\n <core-generic-modal\n [isOpen]=\"sidebarMobileModalService.isOpen()\"\n [mode]=\"ModalMode.CREATE\"\n [title]=\"getSidebarModalTitle()\"\n [customTemplate]=\"sidebarModalContentTemplate\"\n (close)=\"sidebarMobileModalService.closeModal()\"\n [buttonConfig]=\"getSidebarModalButtons()\">\n </core-generic-modal>\n }\n\n </div> <!-- .o-layout__body -->\n</div> <!-- .o-layout -->\n\n<!-- Fixed Actions (Mobile) -->\n<core-generic-fixed-actions class=\"c-fixed-actions c-fixed-actions--right\"/>\n\n<!-- Fixed Actions Mobile Modal -->\n<core-fixed-actions-mobile-modal />\n\n<!-- Sidebar Custom Modal Global -->\n<core-sidebar-custom-modal></core-sidebar-custom-modal>\n\n<!-- Image Modal Global -->\n<core-image-modal></core-image-modal>\n\n<!-- Gallery Modal Global -->\n<core-gallery-modal></core-gallery-modal>\n\n<!-- ! Refactor: End -->", dependencies: [{ kind: "component", type: MainNavComponent, selector: "core-main-nav", inputs: ["navConfig", "appVersion", "navItems", "bottomNavItems", "isProduction", "logoImagesConfig", "collapsedLogo", "expandedLogo"], outputs: ["onLogout"] }, { kind: "component", type: HeaderComponent, selector: "core-header", outputs: ["filterRequested", "createRequested", "globalActionTriggered"] }, { kind: "component", type: MobileHeaderComponent, selector: "core-mobile-header", inputs: ["config"], outputs: ["menuClick", "refreshClick", "filterClick"] }, { kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "component", type: ConfirmationDialogComponent, selector: "core-confirmation-dialog", inputs: ["isOpen", "config"], outputs: ["confirm", "cancel"] }, { kind: "component", type: GenericSidebarComponent, selector: "core-generic-sidebar", inputs: ["config", "position", "customTemplate"], outputs: ["itemClicked", "subItemClicked"] }, { kind: "component", type: GenericModalComponent, selector: "core-generic-modal", inputs: ["isOpen", "mode", "data", "fields", "tabs", "steps", "title", "isMultiple", "customTemplate", "customViewTemplate", "finalStepTemplate", "buttonConfig", "modelFactory", "errors", "validators", "customHasChanges", "stepValidationEnabled", "allowFreeNavigation", "autoMarkCompleted"], outputs: ["save", "close", "modalData"] }, { kind: "component", type: ImageModalComponent, selector: "core-image-modal", outputs: ["modalClosed"] }, { kind: "component", type: GalleryModalComponent, selector: "core-gallery-modal" }, { kind: "component", type: SidebarCustomModalComponent, selector: "core-sidebar-custom-modal" }, { kind: "component", type: GenericFixedActionsComponent, selector: "core-generic-fixed-actions" }, { kind: "component", type: FixedActionsMobileModalComponent, selector: "core-fixed-actions-mobile-modal" }] });
16983
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, deps: [{ token: i0.RendererFactory2 }, { token: DataStoreService }], target: i0.ɵɵFactoryTarget.Injectable });
16984
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, providedIn: 'root' });
16865
16985
  }
16866
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutComponent, decorators: [{
16867
- type: Component,
16868
- args: [{ selector: 'core-layout', imports: [
16869
- MainNavComponent,
16870
- HeaderComponent,
16871
- MobileHeaderComponent,
16872
- CommonModule,
16873
- ConfirmationDialogComponent,
16874
- GenericSidebarComponent,
16875
- GenericModalComponent,
16876
- ImageModalComponent,
16877
- GalleryModalComponent,
16878
- SidebarCustomModalComponent,
16879
- GenericFixedActionsComponent,
16880
- FixedActionsMobileModalComponent
16881
- ], hostDirectives: [CoreHostDirective], template: "<div class=\"o-layout\" \n [attr.data-layout]=\"layoutService.dataAttributes()['data-layout']\"\n [attr.data-sidebar-left]=\"getEffectiveLeftSidebarVisibility()\"\n [attr.data-sidebar-left-w]=\"getEffectiveLeftSidebarWidth()\"\n [attr.data-sidebar-left-h]=\"getEffectiveLeftSidebarHeight()\"\n [attr.data-sidebar-right]=\"getEffectiveRightSidebarVisibility()\"\n [attr.data-sidebar-right-w]=\"getEffectiveRightSidebarWidth()\"\n [attr.data-sidebar-right-h]=\"getEffectiveRightSidebarHeight()\"\n >\n\n <!-- Nav -->\n <core-main-nav class=\"o-layout__nav\" \n (toggleSidebar)=\"toggleSidebar()\"\n [navItems]=\"navItems()\"\n [navConfig]=\"navConfig()\"\n [bottomNavItems]=\"bottomNavItems()\"\n [logoImagesConfig]=\"logoImagesConfig()\"\n [collapsedLogo]=\"collapsedLogo()\"\n [expandedLogo]=\"expandedLogo()\"\n (onLogout)=\"logout()\"\n >\n </core-main-nav>\n\n <!-- Main -->\n <div class=\"o-layout__body\">\n \n @if(shouldShowMobileHeader() && mobileHeaderConfig()) {\n <core-mobile-header\n class=\"o-layout__header c-header-mobile\"\n [config]=\"mobileHeaderConfig()!\"\n (menuClick)=\"onMobileMenuClick()\"\n (refreshClick)=\"onMobileRefreshClick()\"\n (filterClick)=\"onMobileFilterClick()\">\n </core-mobile-header>\n }\n\n @if(layoutStateService.isHeaderVisible$() | async) {\n @if(!shouldShowMobileHeader()) {\n <core-header\n [class]=\"getHeaderClasses()\"\n (filterRequested)=\"onFilterRequested()\"\n (createRequested)=\"onCreateRequested()\"\n (globalActionTriggered)=\"onGlobalActionTriggered($event)\">\n </core-header>\n }\n }\n\n @if(layoutService.sidebarLeft().visibility === SidebarVisibility.SHOW && leftSidebarConfig && shouldRenderLeftSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--left\"\n [config]=\"leftSidebarConfig\">\n </core-generic-sidebar>\n }\n\n <ng-content></ng-content>\n\n @if(layoutService.sidebarRight().visibility === SidebarVisibility.SHOW && rightSidebarConfig && shouldRenderRightSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--right\"\n [config]=\"rightSidebarConfig\">\n </core-generic-sidebar>\n }\n\n\n @if(dialogService.isOpen$()) {\n <core-confirmation-dialog\n [isOpen]=\"dialogService.isOpen$()\"\n [config]=\"dialogService.config$()\"\n (confirm)=\"dialogService.confirm($event)\"\n (cancel)=\"dialogService.cancel()\"\n ></core-confirmation-dialog>\n }\n\n @if(sidebarMobileModalService.isOpen()) {\n <core-generic-modal\n [isOpen]=\"sidebarMobileModalService.isOpen()\"\n [mode]=\"ModalMode.CREATE\"\n [title]=\"getSidebarModalTitle()\"\n [customTemplate]=\"sidebarModalContentTemplate\"\n (close)=\"sidebarMobileModalService.closeModal()\"\n [buttonConfig]=\"getSidebarModalButtons()\">\n </core-generic-modal>\n }\n\n </div> <!-- .o-layout__body -->\n</div> <!-- .o-layout -->\n\n<!-- Fixed Actions (Mobile) -->\n<core-generic-fixed-actions class=\"c-fixed-actions c-fixed-actions--right\"/>\n\n<!-- Fixed Actions Mobile Modal -->\n<core-fixed-actions-mobile-modal />\n\n<!-- Sidebar Custom Modal Global -->\n<core-sidebar-custom-modal></core-sidebar-custom-modal>\n\n<!-- Image Modal Global -->\n<core-image-modal></core-image-modal>\n\n<!-- Gallery Modal Global -->\n<core-gallery-modal></core-gallery-modal>\n\n<!-- ! Refactor: End -->" }]
16882
- }], propDecorators: { mainNavComponent: [{
16883
- type: ViewChild,
16884
- args: [MainNavComponent]
16885
- }], onResize: [{
16886
- type: HostListener,
16887
- args: ['window:resize', ['$event']]
16888
- }] } });
16986
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, decorators: [{
16987
+ type: Injectable,
16988
+ args: [{
16989
+ providedIn: 'root'
16990
+ }]
16991
+ }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: DataStoreService }] });
16889
16992
 
16890
- class LayoutAuth {
16891
- config = input.required();
16892
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutAuth, deps: [], target: i0.ɵɵFactoryTarget.Component });
16893
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: LayoutAuth, isStandalone: true, selector: "core-layout-auth", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"c-login\">\n @if (config().patternUrl) {\n <picture class=\"c-login__bg\">\n <img [src]=\"config().patternUrl!\" alt=\"Background pattern\" width=\"1044\" height=\"889\" />\n </picture>\n }\n\n @if (config().mainLogoUrl) {\n <picture class=\"c-login__logo\">\n <img [src]=\"config().mainLogoUrl!\" alt=\"Main logo\">\n </picture>\n }\n \n <div class=\"c-login__main c-entry-group\">\n <ng-content></ng-content>\n </div>\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
16894
- }
16895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutAuth, decorators: [{
16896
- type: Component,
16897
- args: [{ selector: 'core-layout-auth', imports: [
16898
- CommonModule
16899
- ], hostDirectives: [CoreHostDirective], template: "<div class=\"c-login\">\n @if (config().patternUrl) {\n <picture class=\"c-login__bg\">\n <img [src]=\"config().patternUrl!\" alt=\"Background pattern\" width=\"1044\" height=\"889\" />\n </picture>\n }\n\n @if (config().mainLogoUrl) {\n <picture class=\"c-login__logo\">\n <img [src]=\"config().mainLogoUrl!\" alt=\"Main logo\">\n </picture>\n }\n \n <div class=\"c-login__main c-entry-group\">\n <ng-content></ng-content>\n </div>\n</div>" }]
16900
- }] });
16901
-
16902
- var RatingSize;
16903
- (function (RatingSize) {
16904
- RatingSize["SMALL"] = "small";
16905
- RatingSize["MEDIUM"] = "medium";
16906
- RatingSize["LARGE"] = "large";
16907
- })(RatingSize || (RatingSize = {}));
16908
-
16909
- var RatingType;
16910
- (function (RatingType) {
16911
- RatingType["STARS"] = "stars";
16912
- RatingType["NUMBERS"] = "numbers";
16913
- RatingType["CUSTOM"] = "custom";
16914
- })(RatingType || (RatingType = {}));
16915
-
16916
- class RatingService {
16917
- apiService = inject(ApiService);
16918
- /**
16919
- * Submit a rating to the specified endpoint
16920
- * @param endpoint - The API endpoint to submit the rating to
16921
- * @param ratingData - The rating data to submit
16922
- * @returns Observable with the API response
16923
- */
16924
- submitRating(endpoint, ratingData) {
16925
- return this.apiService.createObj(endpoint, ratingData, false);
16993
+ class GenericFixedActionsComponent {
16994
+ headerService = inject(HeaderService);
16995
+ fixedActionsMobileModalService = inject(FixedActionsMobileModalService);
16996
+ permissionService = inject(PermissionWrapperService);
16997
+ mobileResolutionService = inject(MobileResolutionService);
16998
+ customClassService = inject(CustomClassService);
16999
+ elementRef = inject(ElementRef);
17000
+ cdr = inject(ChangeDetectorRef);
17001
+ constructor() {
17002
+ effect(() => {
17003
+ const actions = this.visibleActions();
17004
+ this.cdr.markForCheck();
17005
+ });
16926
17006
  }
16927
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
16928
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, providedIn: 'root' });
16929
- }
16930
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, decorators: [{
16931
- type: Injectable,
16932
- args: [{
16933
- providedIn: 'root'
16934
- }]
16935
- }] });
16936
-
16937
- class GenericRatingComponent {
16938
- ratingService = inject(RatingService);
16939
- config = input.required();
16940
- ratingChange = output();
16941
- selectedRating = signal(0);
16942
- hoveredRating = signal(0);
16943
- stars = signal([]);
16944
- loading = signal(false);
16945
- uniqueId = signal('');
16946
- RatingSize = RatingSize;
16947
- RatingType = RatingType;
16948
- ngOnInit() {
16949
- this.initializeStars();
16950
- this.generateUniqueId();
16951
- this.initializeDefaultRating();
17007
+ ngAfterViewInit() {
17008
+ // Asegurar que los botones tengan pointer-events: auto
17009
+ // aunque el contenedor tenga pointer-events: none
16952
17010
  setTimeout(() => {
16953
- this.updateStarVisuals(this.selectedRating());
17011
+ const buttons = this.elementRef.nativeElement.querySelectorAll('button');
17012
+ buttons.forEach((button) => {
17013
+ if (!button.style.pointerEvents) {
17014
+ button.style.pointerEvents = 'auto';
17015
+ }
17016
+ });
16954
17017
  }, 0);
16955
17018
  }
16956
- generateUniqueId() {
16957
- const timestamp = Date.now();
16958
- const random1 = Math.floor(Math.random() * 10000);
16959
- const random2 = Math.floor(Math.random() * 10000);
16960
- const performanceTime = performance.now();
16961
- const instanceId = Math.random().toString(36).substring(2, 15);
16962
- this.uniqueId.set(`rating-${timestamp}-${random1}-${random2}-${performanceTime.toString().replace('.', '')}-${instanceId}`);
16963
- }
16964
- initializeDefaultRating() {
16965
- const config = this.config();
16966
- if (config.defaultRating && config.defaultRating > 0 && config.defaultRating <= config.totalStars) {
16967
- this.selectedRating.set(config.defaultRating);
16968
- }
16969
- }
16970
- getUniqueName() {
16971
- return `star-${this.uniqueId()}`;
16972
- }
16973
- getUniqueStarId(starValue) {
16974
- return `star-${this.uniqueId()}-${starValue}`;
16975
- }
16976
- initializeStars() {
16977
- const config = this.config();
16978
- const totalStars = config.totalStars || 5;
16979
- const starsArray = [];
16980
- for (let i = totalStars; i >= 1; i--) {
16981
- starsArray.push({
16982
- value: i,
16983
- label: config.starLabels?.[i] || `${i}`,
16984
- id: `star-${i}`
17019
+ shouldShow = this.mobileResolutionService.shouldShowMobileHeader;
17020
+ outsideActions = computed(() => {
17021
+ const actions = this.headerService.getCustomActions()()
17022
+ .filter(action => {
17023
+ if (!action.mobileConfig)
17024
+ return false;
17025
+ return action.mobileConfig.showOutsideFixedActions === true;
17026
+ })
17027
+ .filter(action => {
17028
+ if (action.requiredPermission) {
17029
+ return this.permissionService.hasPermission(action.requiredPermission.resource, action.requiredPermission.action);
17030
+ }
17031
+ return true;
17032
+ })
17033
+ .filter(action => {
17034
+ const visibleValue = action.visible;
17035
+ if (typeof visibleValue === 'function') {
17036
+ return visibleValue();
17037
+ }
17038
+ return visibleValue !== false;
17039
+ });
17040
+ return actions;
17041
+ });
17042
+ modalActions = computed(() => {
17043
+ const actions = this.headerService.getCustomActions()()
17044
+ .filter(action => {
17045
+ if (!action.mobileConfig)
17046
+ return false;
17047
+ return action.mobileConfig.showInsideModal === true;
17048
+ })
17049
+ .filter(action => {
17050
+ if (action.requiredPermission) {
17051
+ return this.permissionService.hasPermission(action.requiredPermission.resource, action.requiredPermission.action);
17052
+ }
17053
+ return true;
17054
+ })
17055
+ .filter(action => {
17056
+ const visibleValue = action.visible;
17057
+ if (typeof visibleValue === 'function') {
17058
+ return visibleValue();
17059
+ }
17060
+ return visibleValue !== false;
17061
+ });
17062
+ return actions;
17063
+ });
17064
+ hasModalActions = computed(() => {
17065
+ const has = this.modalActions().length > 0;
17066
+ return has;
17067
+ });
17068
+ visibleActions = computed(() => {
17069
+ const actions = [];
17070
+ this.outsideActions().forEach(action => {
17071
+ actions.push({
17072
+ id: action.id,
17073
+ icon: action.icon,
17074
+ label: action.label,
17075
+ class: action.class,
17076
+ tooltip: action.tooltip,
17077
+ callback: action.callback,
17078
+ requiredPermission: action.requiredPermission
16985
17079
  });
17080
+ });
17081
+ const modalActionsArray = this.modalActions();
17082
+ if (modalActionsArray.length > 0) {
17083
+ const plusButtonAction = {
17084
+ id: 'header-more-actions',
17085
+ icon: 'icon-add-clean',
17086
+ class: 'c-btn',
17087
+ tooltip: 'Más acciones',
17088
+ callback: () => this.openModalActions()
17089
+ };
17090
+ actions.push(plusButtonAction);
16986
17091
  }
16987
- this.stars.set(starsArray);
16988
- }
16989
- onStarClick(rating) {
16990
- const config = this.config();
16991
- if (config.readonly) {
16992
- return;
16993
- }
16994
- this.selectedRating.set(rating);
16995
- this.updateStarVisuals(rating);
16996
- const event = {
16997
- rating,
16998
- label: this.stars().find(star => star.value === rating)?.label || '',
16999
- endpoint: config.endpoint
17000
- };
17001
- this.ratingChange.emit(event);
17002
- if (config.endpoint && config.endpoint.trim() !== '') {
17003
- this.submitRating(event);
17004
- }
17092
+ return actions;
17093
+ });
17094
+ getActionClass(action) {
17095
+ const baseClass = 'c-fixed-actions__btn';
17096
+ const iconClass = action.icon || '';
17097
+ const customClass = action.class || 'c-btn';
17098
+ return `${baseClass} ${customClass} ${iconClass}`.trim();
17005
17099
  }
17006
- onStarHover(rating) {
17007
- const config = this.config();
17008
- if (config.readonly) {
17009
- return;
17010
- }
17011
- this.hoveredRating.set(rating);
17012
- this.updateStarVisuals(rating);
17100
+ isActionDisabled(action) {
17101
+ return false;
17013
17102
  }
17014
- onStarLeave() {
17015
- const config = this.config();
17016
- if (config.readonly) {
17017
- return;
17103
+ onActionClick(action) {
17104
+ if (action.callback) {
17105
+ action.callback();
17018
17106
  }
17019
- this.hoveredRating.set(0);
17020
- this.updateStarVisuals(this.selectedRating());
17021
17107
  }
17022
- updateStarVisuals(targetRating) {
17023
- const container = document.querySelector(`[data-rating-id="${this.uniqueId()}"]`);
17024
- if (!container)
17108
+ openModalActions() {
17109
+ const actions = this.modalActions();
17110
+ if (actions.length === 0)
17025
17111
  return;
17026
- const stars = container.querySelectorAll('.c-rating__filled-star');
17027
- stars.forEach((star, index) => {
17028
- const starValue = this.stars().length - index;
17029
- const element = star;
17030
- if (starValue <= targetRating) {
17031
- element.style.opacity = '1';
17032
- element.style.display = 'block';
17033
- }
17034
- else {
17035
- element.style.opacity = '0';
17036
- element.style.display = 'none';
17112
+ const fixedActions = actions.map(action => ({
17113
+ id: action.id,
17114
+ label: action.label,
17115
+ icon: action.icon,
17116
+ class: action.class,
17117
+ callback: action.callback,
17118
+ requiredPermission: action.requiredPermission,
17119
+ customAction: {
17120
+ label: action.label,
17121
+ title: action.label,
17122
+ icon: action.icon,
17123
+ callback: () => {
17124
+ if (action.callback) {
17125
+ action.callback();
17126
+ }
17127
+ },
17128
+ requiredPermission: action.requiredPermission,
17129
+ shouldShow: () => action.visible !== false,
17130
+ shouldDisable: () => action.disabled === true
17037
17131
  }
17132
+ }));
17133
+ this.fixedActionsMobileModalService.open({
17134
+ title: 'Acciones',
17135
+ actions: fixedActions
17038
17136
  });
17039
17137
  }
17040
- submitRating(event) {
17041
- this.loading.set(true);
17042
- this.ratingService.submitRating(event.endpoint, {
17043
- rating: event.rating,
17044
- label: event.label
17045
- }).subscribe({
17046
- next: (response) => {
17047
- this.loading.set(false);
17048
- },
17049
- error: (error) => {
17050
- console.error('Error submitting rating:', error);
17051
- this.loading.set(false);
17052
- }
17053
- });
17054
- }
17055
- getCurrentLabel() {
17056
- const config = this.config();
17057
- const currentRating = config.readonly
17058
- ? this.selectedRating()
17059
- : (this.hoveredRating() || this.selectedRating());
17060
- if (currentRating === 0) {
17061
- return config.defaultLabel || '';
17138
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericFixedActionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17139
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: GenericFixedActionsComponent, isStandalone: true, selector: "core-generic-fixed-actions", host: { classAttribute: "c-fixed-actions c-fixed-actions--right" }, ngImport: i0, template: `
17140
+ @if (shouldShow() && visibleActions().length > 0) {
17141
+ @for (action of visibleActions(); track action.id) {
17142
+ <button
17143
+ type="button"
17144
+ [ngClass]="getActionClass(action)"
17145
+ [disabled]="isActionDisabled(action)"
17146
+ [title]="action.tooltip || action.label || ''"
17147
+ [attr.aria-label]="action.tooltip || action.label || ''"
17148
+ (click)="onActionClick(action)"
17149
+ style="pointer-events: auto;">
17150
+ </button>
17062
17151
  }
17063
- const star = this.stars().find(s => s.value === currentRating);
17064
- return star?.label || '';
17065
17152
  }
17066
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericRatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17067
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: GenericRatingComponent, isStandalone: true, selector: "core-generic-rating", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { ratingChange: "ratingChange" }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "@if (config().title) {\n <p class=\"u-text\"><strong>{{ config().title }}</strong></p>\n}\n\n<div class=\"c-rating\" [attr.data-rating-id]=\"uniqueId()\">\n \n <div class=\"c-rating__stars\">\n @for (star of stars(); track star.id) {\n <input \n type=\"radio\" \n [name]=\"getUniqueName()\" \n [id]=\"getUniqueStarId(star.value)\" \n [value]=\"star.value\"\n [disabled]=\"config().readonly || loading()\"\n (click)=\"onStarClick(star.value)\" />\n \n <label \n [for]=\"getUniqueStarId(star.value)\" \n [title]=\"star.label + ' estrellas'\"\n class=\"icon-star\"\n [class.c-rating__readonly]=\"config().readonly\"\n [style.cursor]=\"config().readonly ? 'default' : 'pointer'\"\n (mouseenter)=\"!config().readonly && onStarHover(star.value)\"\n (mouseleave)=\"!config().readonly && onStarLeave()\">\n <span class=\"c-rating__filled-star icon-star-filled\"></span>\n </label>\n }\n </div>\n \n @if (config().showLabels !== false) {\n <span class=\"c-rating__text\">{{ getCurrentLabel() }}</span>\n }\n</div> ", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }] });
17068
- }
17069
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericRatingComponent, decorators: [{
17070
- type: Component,
17071
- args: [{ selector: 'core-generic-rating', standalone: true, imports: [CommonModule, TranslateModule], hostDirectives: [CoreHostDirective], template: "@if (config().title) {\n <p class=\"u-text\"><strong>{{ config().title }}</strong></p>\n}\n\n<div class=\"c-rating\" [attr.data-rating-id]=\"uniqueId()\">\n \n <div class=\"c-rating__stars\">\n @for (star of stars(); track star.id) {\n <input \n type=\"radio\" \n [name]=\"getUniqueName()\" \n [id]=\"getUniqueStarId(star.value)\" \n [value]=\"star.value\"\n [disabled]=\"config().readonly || loading()\"\n (click)=\"onStarClick(star.value)\" />\n \n <label \n [for]=\"getUniqueStarId(star.value)\" \n [title]=\"star.label + ' estrellas'\"\n class=\"icon-star\"\n [class.c-rating__readonly]=\"config().readonly\"\n [style.cursor]=\"config().readonly ? 'default' : 'pointer'\"\n (mouseenter)=\"!config().readonly && onStarHover(star.value)\"\n (mouseleave)=\"!config().readonly && onStarLeave()\">\n <span class=\"c-rating__filled-star icon-star-filled\"></span>\n </label>\n }\n </div>\n \n @if (config().showLabels !== false) {\n <span class=\"c-rating__text\">{{ getCurrentLabel() }}</span>\n }\n</div> " }]
17072
- }] });
17073
-
17074
- var ProgressBarSize;
17075
- (function (ProgressBarSize) {
17076
- ProgressBarSize["NORMAL"] = "";
17077
- ProgressBarSize["SMALL"] = "xs";
17078
- ProgressBarSize["LARGE"] = "xl";
17079
- })(ProgressBarSize || (ProgressBarSize = {}));
17080
-
17081
- class ProgressBarComponent {
17082
- progress = input(0);
17083
- size = input(ProgressBarSize.NORMAL);
17084
- percentage = computed(() => {
17085
- return this.progress() / 100;
17086
- });
17087
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17088
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.6", type: ProgressBarComponent, isStandalone: true, selector: "core-progress-bar", inputs: { progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"c-progress-bar c-progress-bar--{{ size() }}\" style=\"--progress: {{ percentage() }}\">\n <div class=\"c-progress-bar__bar\"></div>\n</div>" });
17089
- }
17090
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ProgressBarComponent, decorators: [{
17091
- type: Component,
17092
- args: [{ selector: 'core-progress-bar', standalone: true, imports: [], hostDirectives: [CoreHostDirective], template: "<div class=\"c-progress-bar c-progress-bar--{{ size() }}\" style=\"--progress: {{ percentage() }}\">\n <div class=\"c-progress-bar__bar\"></div>\n</div>" }]
17093
- }] });
17094
-
17095
- class CardComponent {
17096
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17097
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: CardComponent, isStandalone: true, selector: "core-card", hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: `
17098
- <div class="u-card">
17099
- <ng-content></ng-content>
17100
- </div>`, isInline: true });
17153
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
17101
17154
  }
17102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardComponent, decorators: [{
17155
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericFixedActionsComponent, decorators: [{
17103
17156
  type: Component,
17104
17157
  args: [{
17105
- selector: 'core-card',
17158
+ selector: 'core-generic-fixed-actions',
17106
17159
  standalone: true,
17107
- imports: [],
17108
- hostDirectives: [CoreHostDirective],
17160
+ imports: [CommonModule],
17109
17161
  template: `
17110
- <div class="u-card">
17111
- <ng-content></ng-content>
17112
- </div>`
17113
- }]
17114
- }] });
17115
-
17116
- class CarouselComponent {
17117
- images = input([]);
17118
- config = input({});
17119
- carouselHolder = viewChild('carouselHolder');
17120
- carouselViewport = viewChild('carouselViewport');
17121
- currentIndex = signal(0);
17122
- timer = signal(null);
17123
- autoplay = computed(() => this.config().autoplay ?? false);
17124
- interval = computed(() => this.config().interval ?? 3000);
17125
- perView = computed(() => Math.max(1, this.config().perView ?? 1));
17126
- step = computed(() => Math.max(1, this.config().step ?? this.perView()));
17127
- showDots = computed(() => this.config().showDots ?? true);
17128
- showArrows = computed(() => this.config().showArrows ?? true);
17129
- arrowsOutside = computed(() => this.config().arrowsOutside ?? false);
17130
- itemsGap = computed(() => this.config().itemsGap ?? '10px');
17131
- controlsOffset = computed(() => this.config().controlsOffset ?? '2rem');
17132
- controlsSize = computed(() => this.config().controlsSize ?? '2.5rem');
17133
- ariaLabel = computed(() => this.config().ariaLabel ?? 'Galería de imágenes');
17134
- maxIndex = computed(() => Math.max(0, this.images().length - this.perView()));
17135
- pagesLength = computed(() => Math.max(1, Math.ceil(this.images().length / this.perView())));
17136
- dots = computed(() => Array.from({ length: this.pagesLength() }, (_, i) => i));
17137
- currentPage = computed(() => Math.min(this.pagesLength() - 1, Math.floor(this.currentIndex() / this.perView())));
17138
- carouselClasses = computed(() => {
17139
- const classes = ['c-img-carousel', 'js-img-carousel'];
17140
- if (this.arrowsOutside()) {
17141
- classes.push('c-img-carousel--arrows-out');
17142
- }
17143
- return classes;
17144
- });
17145
- constructor() {
17146
- effect(() => {
17147
- const viewport = this.carouselViewport();
17148
- if (viewport) {
17149
- const element = viewport.nativeElement;
17150
- element.style.setProperty('--per-view', this.perView().toString());
17151
- element.style.setProperty('--items-gap', this.itemsGap());
17152
- element.style.setProperty('--controls-offset', this.controlsOffset());
17153
- element.style.setProperty('--controls-size', this.controlsSize());
17154
- }
17155
- });
17156
- effect(() => {
17157
- const shouldAutoplay = this.autoplay() && this.images().length > 1;
17158
- const currentTimer = this.timer();
17159
- if (shouldAutoplay && !currentTimer) {
17160
- this.startAutoplay();
17161
- }
17162
- else if (!shouldAutoplay && currentTimer) {
17163
- this.stopAutoplay();
17164
- }
17165
- });
17166
- effect(() => {
17167
- const holder = this.carouselHolder();
17168
- const index = this.currentIndex();
17169
- if (holder) {
17170
- const element = holder.nativeElement;
17171
- const percentage = -(index * (100 / this.perView()));
17172
- element.style.transform = `translateX(${percentage}%)`;
17173
- }
17174
- });
17175
- }
17176
- ngAfterViewInit() {
17177
- this.goToSlide(0, false);
17178
- }
17179
- ngOnDestroy() {
17180
- this.stopAutoplay();
17181
- }
17182
- goToSlide(index, animate = true, fromAutoplay = false) {
17183
- if (index < 0) {
17184
- index = this.maxIndex();
17185
- }
17186
- else if (index > this.maxIndex()) {
17187
- index = 0;
17188
- }
17189
- const holder = this.carouselHolder();
17190
- if (holder) {
17191
- holder.nativeElement.style.transition = animate ? 'transform 350ms ease' : 'none';
17192
- }
17193
- this.currentIndex.set(index);
17194
- if (!fromAutoplay && this.autoplay()) {
17195
- this.restartAutoplay();
17196
- }
17197
- }
17198
- goToPage(pageIndex) {
17199
- const targetSlide = Math.min(this.maxIndex(), Math.max(0, pageIndex * this.perView()));
17200
- this.goToSlide(targetSlide, true, false);
17201
- }
17202
- goToNextSlide(fromAutoplay = false) {
17203
- this.goToSlide(this.currentIndex() + this.step(), true, fromAutoplay);
17204
- }
17205
- goToPrevSlide() {
17206
- this.goToSlide(this.currentIndex() - this.step(), true, false);
17207
- }
17208
- isDotActive(dotIndex) {
17209
- return dotIndex === this.currentPage();
17210
- }
17211
- startAutoplay() {
17212
- const currentTimer = this.timer();
17213
- if (currentTimer) {
17214
- clearInterval(currentTimer);
17215
- }
17216
- const intervalId = setInterval(() => {
17217
- this.goToNextSlide(true);
17218
- }, this.interval());
17219
- this.timer.set(intervalId);
17220
- }
17221
- stopAutoplay() {
17222
- const timerId = this.timer();
17223
- if (timerId) {
17224
- clearInterval(timerId);
17225
- this.timer.set(null);
17226
- }
17227
- }
17228
- restartAutoplay() {
17229
- if (this.autoplay()) {
17230
- this.startAutoplay();
17231
- }
17232
- }
17233
- onResize() {
17234
- this.goToSlide(this.currentIndex(), false);
17235
- }
17236
- onKeyDown(event) {
17237
- if (event.key === 'ArrowLeft') {
17238
- this.goToPrevSlide();
17239
- }
17240
- else if (event.key === 'ArrowRight') {
17241
- this.goToNextSlide();
17242
- }
17243
- }
17244
- getSlideStyle(index) {
17245
- return {
17246
- 'flex': `0 0 ${100 / this.perView()}%`
17247
- };
17248
- }
17249
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17250
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: CarouselComponent, isStandalone: true, selector: "core-carousel", inputs: { images: { classPropertyName: "images", publicName: "images", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:resize": "onResize()", "keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "carouselHolder", first: true, predicate: ["carouselHolder"], descendants: true, isSignal: true }, { propertyName: "carouselViewport", first: true, predicate: ["carouselViewport"], descendants: true, isSignal: true }], ngImport: i0, template: "<div \n [ngClass]=\"carouselClasses()\"\n [attr.aria-label]=\"ariaLabel()\"\n tabindex=\"0\"\n #carouselViewport\n [class.is-multiple]=\"perView() > 1\">\n \n <div class=\"c-img-carousel__viewport\">\n <div class=\"c-img-carousel__holder js-img-carousel-holder\" #carouselHolder>\n <div \n *ngFor=\"let image of images(); let i = index\"\n class=\"c-img-carousel__slide js-img-carousel-slide\">\n <div class=\"c-img-carousel__slide-inner\">\n <core-image-preview\n [src]=\"image.url\"\n [alt]=\"image.alt || 'Image ' + (i + 1)\"\n [title]=\"image.title || image.alt || 'Image ' + (i + 1)\">\n </core-image-preview>\n </div>\n </div>\n </div>\n \n @if (!config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n \n <div \n *ngIf=\"showDots()\"\n class=\"c-img-carousel__dots js-img-carousel-nav\"\n aria-label=\"Navegaci\u00F3n\">\n <button\n *ngFor=\"let page of dots(); let i = index\"\n class=\"c-img-carousel__dot js-img-carousel-dot\"\n type=\"button\"\n (click)=\"goToPage(i)\"\n [class.c-img-carousel__dot--active]=\"currentPage() === i\"\n [attr.aria-label]=\"'Ir a p\u00E1gina ' + (i + 1)\"\n [attr.aria-current]=\"currentPage() === i ? 'true' : 'false'\">\n </button>\n </div>\n </div>\n @if(config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ImagePreviewComponent, selector: "core-image-preview", inputs: ["src", "alt", "title", "width", "height", "objectFit", "borderRadius", "cursor", "loading", "isRelative", "showSkeleton", "skeletonAnimation"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
17251
- }
17252
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CarouselComponent, decorators: [{
17253
- type: Component,
17254
- args: [{ selector: 'core-carousel', standalone: true, imports: [CommonModule, ImagePreviewComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div \n [ngClass]=\"carouselClasses()\"\n [attr.aria-label]=\"ariaLabel()\"\n tabindex=\"0\"\n #carouselViewport\n [class.is-multiple]=\"perView() > 1\">\n \n <div class=\"c-img-carousel__viewport\">\n <div class=\"c-img-carousel__holder js-img-carousel-holder\" #carouselHolder>\n <div \n *ngFor=\"let image of images(); let i = index\"\n class=\"c-img-carousel__slide js-img-carousel-slide\">\n <div class=\"c-img-carousel__slide-inner\">\n <core-image-preview\n [src]=\"image.url\"\n [alt]=\"image.alt || 'Image ' + (i + 1)\"\n [title]=\"image.title || image.alt || 'Image ' + (i + 1)\">\n </core-image-preview>\n </div>\n </div>\n </div>\n \n @if (!config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n \n <div \n *ngIf=\"showDots()\"\n class=\"c-img-carousel__dots js-img-carousel-nav\"\n aria-label=\"Navegaci\u00F3n\">\n <button\n *ngFor=\"let page of dots(); let i = index\"\n class=\"c-img-carousel__dot js-img-carousel-dot\"\n type=\"button\"\n (click)=\"goToPage(i)\"\n [class.c-img-carousel__dot--active]=\"currentPage() === i\"\n [attr.aria-label]=\"'Ir a p\u00E1gina ' + (i + 1)\"\n [attr.aria-current]=\"currentPage() === i ? 'true' : 'false'\">\n </button>\n </div>\n </div>\n @if(config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n</div>" }]
17255
- }], ctorParameters: () => [], propDecorators: { onResize: [{
17256
- type: HostListener,
17257
- args: ['window:resize']
17258
- }], onKeyDown: [{
17259
- type: HostListener,
17260
- args: ['keydown', ['$event']]
17261
- }] } });
17262
-
17263
- var ChatMessageType;
17264
- (function (ChatMessageType) {
17265
- ChatMessageType["TEXT"] = "text";
17266
- ChatMessageType["IMAGE"] = "image";
17267
- ChatMessageType["FILE"] = "file";
17268
- ChatMessageType["SYSTEM"] = "system";
17269
- ChatMessageType["NOTIFICATION"] = "notification";
17270
- ChatMessageType["CUSTOM"] = "custom";
17271
- })(ChatMessageType || (ChatMessageType = {}));
17272
-
17273
- var ChatMessagePosition;
17274
- (function (ChatMessagePosition) {
17275
- ChatMessagePosition["LEFT"] = "left";
17276
- ChatMessagePosition["RIGHT"] = "right";
17277
- })(ChatMessagePosition || (ChatMessagePosition = {}));
17278
-
17279
- var FilePreviewActionType;
17280
- (function (FilePreviewActionType) {
17281
- FilePreviewActionType["DOWNLOAD"] = "download";
17282
- FilePreviewActionType["DELETE"] = "delete";
17283
- FilePreviewActionType["PREVIEW"] = "preview";
17284
- })(FilePreviewActionType || (FilePreviewActionType = {}));
17285
-
17286
- class GenericChatService {
17287
- constructor() { }
17288
- formatTimestamp(timestamp, format) {
17289
- if (!timestamp)
17290
- return '';
17291
- const timeFormat = format || 'dd/MM/yyyy HH:mm';
17292
- if (timeFormat === 'dd/MM/yyyy HH:mm') {
17293
- const day = timestamp.getDate().toString().padStart(2, '0');
17294
- const month = (timestamp.getMonth() + 1).toString().padStart(2, '0');
17295
- const year = timestamp.getFullYear();
17296
- const hours = timestamp.getHours().toString().padStart(2, '0');
17297
- const minutes = timestamp.getMinutes().toString().padStart(2, '0');
17298
- return `${day}/${month}/${year} ${hours}:${minutes}`;
17299
- }
17300
- if (timeFormat === 'HH:mm') {
17301
- const hours = timestamp.getHours().toString().padStart(2, '0');
17302
- const minutes = timestamp.getMinutes().toString().padStart(2, '0');
17303
- return `${hours}:${minutes}`;
17304
- }
17305
- return timestamp.toLocaleTimeString();
17306
- }
17307
- formatDate(timestamp, format) {
17308
- if (!timestamp)
17309
- return '';
17310
- const dateFormat = format || 'dd/MM/yyyy';
17311
- if (dateFormat === 'dd/MM/yyyy') {
17312
- const day = timestamp.getDate().toString().padStart(2, '0');
17313
- const month = (timestamp.getMonth() + 1).toString().padStart(2, '0');
17314
- const year = timestamp.getFullYear();
17315
- return `${day}/${month}/${year}`;
17162
+ @if (shouldShow() && visibleActions().length > 0) {
17163
+ @for (action of visibleActions(); track action.id) {
17164
+ <button
17165
+ type="button"
17166
+ [ngClass]="getActionClass(action)"
17167
+ [disabled]="isActionDisabled(action)"
17168
+ [title]="action.tooltip || action.label || ''"
17169
+ [attr.aria-label]="action.tooltip || action.label || ''"
17170
+ (click)="onActionClick(action)"
17171
+ style="pointer-events: auto;">
17172
+ </button>
17316
17173
  }
17317
- return timestamp.toLocaleDateString();
17318
- }
17319
- shouldUseCustomTemplate(message, config) {
17320
- return message.type === ChatMessageType.CUSTOM &&
17321
- !!config.customMessageTemplates &&
17322
- !!message.customData?.templateKey &&
17323
- !!config.customMessageTemplates.has(message.customData.templateKey);
17324
- }
17325
- getMessageClasses(message, config) {
17326
- const baseClass = 'c-chat-bubble';
17327
- const positionClass = message.position === 'right' ? 'c-chat-bubble--right' : '';
17328
- const customClass = message.customClass || '';
17329
- const configClass = config.customCssClasses?.messageItem || '';
17330
- return [baseClass, positionClass, customClass, configClass]
17331
- .filter(cls => cls.length > 0)
17332
- .join(' ');
17333
17174
  }
17334
- getContentClasses(message, config) {
17335
- const baseClass = 'c-chat-bubble__content';
17336
- const typeClass = message.type ? `c-chat-bubble__content--${message.type}` : '';
17337
- const configClass = config.customCssClasses?.messageItem || '';
17338
- return [baseClass, typeClass, configClass]
17339
- .filter(cls => cls.length > 0)
17340
- .join(' ');
17341
- }
17342
- getTimestampClasses(config) {
17343
- const baseClass = 'c-chat-bubble__timestamp';
17344
- const configClass = config.customCssClasses?.messageItem || '';
17345
- return [baseClass, configClass]
17346
- .filter(cls => cls.length > 0)
17347
- .join(' ');
17348
- }
17349
- getImageClasses(config) {
17350
- const baseClass = 'c-chat-bubble__image';
17351
- const configClass = config.customCssClasses?.messageItem || '';
17352
- return [baseClass, configClass]
17353
- .filter(cls => cls.length > 0)
17354
- .join(' ');
17355
- }
17356
- validateMessage(message) {
17357
- if (!message)
17358
- return false;
17359
- if (!message.id || !message.content)
17360
- return false;
17361
- if (!message.timestamp)
17362
- return false;
17363
- if (!message.type)
17364
- return false;
17365
- return true;
17366
- }
17367
- getDefaultConfig() {
17368
- return {
17369
- maxHeight: '400px',
17370
- placeholder: 'Escribe tu mensaje...',
17371
- showTimestamps: true,
17372
- showAvatars: true,
17373
- showTypingIndicator: false,
17374
- allowFileAttachments: false,
17375
- allowEmojis: false,
17376
- maxMessages: 100,
17377
- readOnly: false,
17378
- autoScroll: true,
17379
- dateFormat: 'dd/MM/yyyy',
17380
- timeFormat: 'HH:mm',
17381
- groupByDate: false,
17382
- theme: 'light'
17383
- };
17384
- }
17385
- mergeConfig(userConfig) {
17386
- return { ...this.getDefaultConfig(), ...userConfig };
17387
- }
17388
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17389
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, providedIn: 'root' });
17390
- }
17391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, decorators: [{
17392
- type: Injectable,
17393
- args: [{
17394
- providedIn: 'root'
17175
+ `,
17176
+ host: {
17177
+ 'class': 'c-fixed-actions c-fixed-actions--right'
17178
+ }
17395
17179
  }]
17396
17180
  }], ctorParameters: () => [] });
17397
17181
 
17398
- class CoreUiTranslateService {
17399
- translateService = inject(TranslateService);
17400
- initialize(defaultLang = 'es', currentLang) {
17401
- this.translateService.setDefaultLang(defaultLang);
17402
- this.translateService.use(currentLang || defaultLang);
17403
- }
17404
- changeLanguage(lang) {
17405
- return this.translateService.use(lang);
17182
+ class LayoutComponent {
17183
+ navItems = input([]);
17184
+ bottomNavItems = input([]);
17185
+ collapsedLogo = input('');
17186
+ expandedLogo = input('');
17187
+ logoImagesConfig = input(null);
17188
+ navConfig = input({});
17189
+ mobileHeaderConfig = input(null);
17190
+ onLogout = output();
17191
+ onMobileRefresh = output();
17192
+ onMobileFilter = output();
17193
+ dialogService = inject(ConfirmationDialogService);
17194
+ mainNavService = inject(MainNavService);
17195
+ layoutService = inject(LayoutService);
17196
+ layoutStateService = inject(LayoutStateService);
17197
+ sidebarMobileModalService = inject(SidebarMobileModalService);
17198
+ templateRegistry = inject(SidebarTemplateRegistryService);
17199
+ headerService = inject(HeaderService);
17200
+ mobileResolutionService = inject(MobileResolutionService);
17201
+ SidebarVisibility = SidebarVisibility;
17202
+ ModalMode = ModalMode;
17203
+ SidebarMobileType = SidebarMobileType;
17204
+ screenWidth = signal(typeof window !== 'undefined' ? window.innerWidth : 1024);
17205
+ isSidebarCollapsed = false;
17206
+ isHeaderVisible = false;
17207
+ isMobile = this.mobileResolutionService.isMobile;
17208
+ shouldShowMobileHeader = this.mobileResolutionService.shouldShowMobileHeader;
17209
+ mainNavComponent;
17210
+ get leftSidebarConfig() {
17211
+ return this.layoutStateService.getLeftSidebarConfig()();
17406
17212
  }
17407
- instant(key, params) {
17408
- return this.translateService.instant(key, params);
17213
+ get rightSidebarConfig() {
17214
+ return this.layoutStateService.getRightSidebarConfig()();
17409
17215
  }
17410
- get(key, params) {
17411
- return this.translateService.get(key, params);
17216
+ ngOnInit() {
17217
+ this.mainNavService.isCollapsed$.subscribe(isCollapsed => {
17218
+ this.isSidebarCollapsed = isCollapsed;
17219
+ });
17220
+ this.layoutStateService.isHeaderVisible$().subscribe(isVisible => {
17221
+ this.isHeaderVisible = isVisible;
17222
+ });
17223
+ this.updateScreenWidth();
17412
17224
  }
17413
- getMany(keys, params) {
17414
- return this.translateService.get(keys, params);
17225
+ onResize(event) {
17226
+ this.updateScreenWidth();
17415
17227
  }
17416
- getCurrentLang() {
17417
- return this.translateService.currentLang;
17228
+ updateScreenWidth() {
17229
+ if (typeof window !== 'undefined') {
17230
+ this.screenWidth.set(window.innerWidth);
17231
+ }
17418
17232
  }
17419
- getDefaultLang() {
17420
- return this.translateService.getDefaultLang();
17233
+ isMobileView(config) {
17234
+ const responsiveConfig = config?.responsiveConfig;
17235
+ const maxBreakpoint = responsiveConfig?.maxMobileBreakpoint ?? this.mobileResolutionService.breakpoint();
17236
+ const minBreakpoint = responsiveConfig?.minMobileBreakpoint ?? 0;
17237
+ return this.screenWidth() <= maxBreakpoint && this.screenWidth() >= minBreakpoint;
17421
17238
  }
17422
- getTranslateService() {
17423
- return this.translateService;
17239
+ shouldRenderLeftSidebar() {
17240
+ const config = this.leftSidebarConfig;
17241
+ const responsiveConfig = config?.responsiveConfig;
17242
+ if (!responsiveConfig)
17243
+ return true;
17244
+ if (this.isMobileView(config) && responsiveConfig.mobileType === SidebarMobileType.MODAL) {
17245
+ return false;
17246
+ }
17247
+ return true;
17424
17248
  }
17425
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17426
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, providedIn: 'root' });
17427
- }
17428
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, decorators: [{
17429
- type: Injectable,
17430
- args: [{
17431
- providedIn: 'root'
17432
- }]
17433
- }] });
17434
-
17435
- class DataStoreService {
17436
- stores = new Map();
17437
- defaultIdSelector(item) {
17438
- if (item && typeof item === 'object' && 'id' in item) {
17439
- const idVal = item.id;
17440
- if (typeof idVal === 'string' || typeof idVal === 'number') {
17441
- return idVal;
17442
- }
17249
+ shouldRenderRightSidebar() {
17250
+ const config = this.rightSidebarConfig;
17251
+ const responsiveConfig = config?.responsiveConfig;
17252
+ if (!responsiveConfig)
17253
+ return true;
17254
+ if (this.isMobileView(config) && responsiveConfig.mobileType === SidebarMobileType.MODAL) {
17255
+ return false;
17443
17256
  }
17444
- throw new Error('No se encontró una propiedad id (string o number) y no se pasó idSelector.');
17257
+ return true;
17445
17258
  }
17446
- ensureStore(key, idSelector) {
17447
- if (!this.stores.has(key)) {
17448
- this.stores.set(key, {
17449
- items: signal([]),
17450
- index: new Map(),
17451
- idSelector: idSelector ?? this.defaultIdSelector,
17452
- });
17259
+ getEffectiveLeftSidebarVisibility() {
17260
+ if (!this.shouldRenderLeftSidebar()) {
17261
+ return SidebarVisibility.HIDE;
17453
17262
  }
17454
- else if (idSelector) {
17455
- this.stores.get(key).idSelector = idSelector;
17263
+ return this.layoutService.sidebarLeft().visibility;
17264
+ }
17265
+ getEffectiveLeftSidebarWidth() {
17266
+ if (!this.shouldRenderLeftSidebar()) {
17267
+ return SidebarWidth.DEFAULT;
17456
17268
  }
17457
- return this.stores.get(key);
17269
+ return this.layoutService.sidebarLeft().width;
17458
17270
  }
17459
- hydrate(key, items, idSelector) {
17460
- const store = this.ensureStore(key, idSelector);
17461
- const copy = [...items];
17462
- const idx = new Map();
17463
- for (const it of copy) {
17464
- idx.set(String(store.idSelector(it)), it);
17271
+ getEffectiveLeftSidebarHeight() {
17272
+ if (!this.shouldRenderLeftSidebar()) {
17273
+ return SidebarHeight.DEFAULT;
17465
17274
  }
17466
- store.items.set(copy);
17467
- store.index = idx;
17275
+ return this.layoutService.sidebarLeft().height;
17468
17276
  }
17469
- upsertOne(key, item, idSelector) {
17470
- const store = this.ensureStore(key, idSelector);
17471
- const id = String(store.idSelector(item));
17472
- const current = store.items();
17473
- const pos = current.findIndex((i) => String(store.idSelector(i)) === id);
17474
- if (pos >= 0) {
17475
- const next = [...current];
17476
- next[pos] = item;
17477
- store.items.set(next);
17277
+ getEffectiveRightSidebarVisibility() {
17278
+ if (!this.shouldRenderRightSidebar()) {
17279
+ return SidebarVisibility.HIDE;
17478
17280
  }
17479
- else {
17480
- store.items.set([...current, item]);
17281
+ return this.layoutService.sidebarRight().visibility;
17282
+ }
17283
+ getEffectiveRightSidebarWidth() {
17284
+ if (!this.shouldRenderRightSidebar()) {
17285
+ return SidebarWidth.DEFAULT;
17481
17286
  }
17482
- store.index.set(id, item);
17287
+ return this.layoutService.sidebarRight().width;
17483
17288
  }
17484
- upsertMany(key, items, idSelector) {
17485
- for (const it of items) {
17486
- this.upsertOne(key, it, idSelector);
17289
+ getEffectiveRightSidebarHeight() {
17290
+ if (!this.shouldRenderRightSidebar()) {
17291
+ return SidebarHeight.DEFAULT;
17487
17292
  }
17293
+ return this.layoutService.sidebarRight().height;
17488
17294
  }
17489
- removeOne(key, id, idSelector) {
17490
- const store = this.ensureStore(key, idSelector);
17491
- const idStr = String(id);
17492
- const next = store
17493
- .items()
17494
- .filter((i) => String(store.idSelector(i)) !== idStr);
17495
- store.items.set(next);
17496
- store.index.delete(idStr);
17295
+ toggleSidebar() {
17296
+ this.mainNavService.toggleSidebarState();
17497
17297
  }
17498
- removeMany(key, ids, idSelector) {
17499
- const store = this.ensureStore(key, idSelector);
17500
- const idsSet = new Set(ids.map(String));
17501
- const next = store
17502
- .items()
17503
- .filter((i) => !idsSet.has(String(store.idSelector(i))));
17504
- store.items.set(next);
17505
- for (const id of ids) {
17506
- store.index.delete(String(id));
17507
- }
17298
+ getHeaderClasses() {
17299
+ const baseClass = 'o-layout__header';
17300
+ const customClass = this.headerService.getGlobalCustomClass()();
17301
+ return customClass ? `${baseClass} ${customClass}` : baseClass;
17508
17302
  }
17509
- clear(key, idSelector) {
17510
- const store = this.ensureStore(key, idSelector);
17511
- store.items.set([]);
17512
- store.index.clear();
17303
+ onFilterRequested() {
17304
+ const event = new CustomEvent('filterRequested');
17305
+ window.dispatchEvent(event);
17513
17306
  }
17514
- selectAll(key, idSelector) {
17515
- const store = this.ensureStore(key, idSelector);
17516
- return computed(() => store.items());
17307
+ onCreateRequested() {
17308
+ const event = new CustomEvent('createRequested');
17309
+ window.dispatchEvent(event);
17517
17310
  }
17518
- getById(key, id, idSelector) {
17519
- const store = this.ensureStore(key, idSelector);
17520
- return store.index.get(String(id));
17311
+ onGlobalActionTriggered(action) {
17312
+ const event = new CustomEvent('globalActionTriggered', { detail: action });
17313
+ window.dispatchEvent(event);
17521
17314
  }
17522
- selectById(key, id, idSelector) {
17523
- const store = this.ensureStore(key, idSelector);
17524
- const idStr = String(id);
17525
- return computed(() => {
17526
- store.items();
17527
- return store.index.get(idStr);
17528
- });
17315
+ onMobileMenuClick() {
17316
+ this.mainNavComponent?.toggleMobileNav();
17529
17317
  }
17530
- count(key, idSelector) {
17531
- const store = this.ensureStore(key, idSelector);
17532
- return store.items().length;
17318
+ onMobileRefreshClick() {
17319
+ const refreshCallback = this.headerService.getRefreshCallback()();
17320
+ if (refreshCallback) {
17321
+ refreshCallback();
17322
+ }
17323
+ this.onMobileRefresh.emit();
17533
17324
  }
17534
- hasData(key) {
17535
- return this.stores.has(key) && this.stores.get(key).items().length > 0;
17325
+ onMobileFilterClick() {
17326
+ const event = new CustomEvent('filterRequested');
17327
+ window.dispatchEvent(event);
17328
+ this.onMobileFilter.emit();
17536
17329
  }
17537
- getStoreKeys() {
17538
- return Array.from(this.stores.keys());
17330
+ setLeftSidebarConfig(config) {
17331
+ this.layoutStateService.setLeftSidebarConfig(config);
17332
+ }
17333
+ setRightSidebarConfig(config) {
17334
+ this.layoutStateService.setRightSidebarConfig(config);
17335
+ }
17336
+ hideLeftSidebar() {
17337
+ this.layoutStateService.hideLeftSidebar();
17338
+ }
17339
+ hideRightSidebar() {
17340
+ this.layoutStateService.hideRightSidebar();
17341
+ }
17342
+ getSidebarModalTitle() {
17343
+ const modalState = this.sidebarMobileModalService.getModalState();
17344
+ const config = modalState.config();
17345
+ if (!config)
17346
+ return '';
17347
+ if (config.title) {
17348
+ return config.title;
17349
+ }
17350
+ if (config.templateKey) {
17351
+ return config.title || 'Sidebar';
17352
+ }
17353
+ return 'Menu';
17539
17354
  }
17540
- removeStore(key) {
17541
- this.stores.delete(key);
17355
+ getSidebarModalButtons() {
17356
+ return [
17357
+ {
17358
+ text: 'modal.cancel',
17359
+ action: () => this.sidebarMobileModalService.closeModal(),
17360
+ },
17361
+ ];
17542
17362
  }
17543
- flush(key) {
17544
- if (key) {
17545
- if (this.stores.has(key)) {
17546
- const store = this.stores.get(key);
17547
- store.items.set([]);
17548
- store.index.clear();
17549
- }
17363
+ get sidebarModalContentTemplate() {
17364
+ const modalState = this.sidebarMobileModalService.getModalState();
17365
+ const config = modalState.config();
17366
+ if (!config)
17367
+ return null;
17368
+ if (config.customTemplate) {
17369
+ return config.customTemplate;
17550
17370
  }
17551
- else {
17552
- for (const [storeKey, store] of this.stores.entries()) {
17553
- store.items.set([]);
17554
- store.index.clear();
17555
- }
17371
+ if (config.templateKey) {
17372
+ return this.templateRegistry.getTemplate(config.templateKey);
17556
17373
  }
17374
+ return null;
17557
17375
  }
17558
- flushAll() {
17559
- this.stores.clear();
17376
+ logout() {
17377
+ this.onLogout.emit();
17560
17378
  }
17561
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17562
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, providedIn: 'root' });
17379
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17380
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: LayoutComponent, isStandalone: true, selector: "core-layout", inputs: { navItems: { classPropertyName: "navItems", publicName: "navItems", isSignal: true, isRequired: false, transformFunction: null }, bottomNavItems: { classPropertyName: "bottomNavItems", publicName: "bottomNavItems", isSignal: true, isRequired: false, transformFunction: null }, collapsedLogo: { classPropertyName: "collapsedLogo", publicName: "collapsedLogo", isSignal: true, isRequired: false, transformFunction: null }, expandedLogo: { classPropertyName: "expandedLogo", publicName: "expandedLogo", isSignal: true, isRequired: false, transformFunction: null }, logoImagesConfig: { classPropertyName: "logoImagesConfig", publicName: "logoImagesConfig", isSignal: true, isRequired: false, transformFunction: null }, navConfig: { classPropertyName: "navConfig", publicName: "navConfig", isSignal: true, isRequired: false, transformFunction: null }, mobileHeaderConfig: { classPropertyName: "mobileHeaderConfig", publicName: "mobileHeaderConfig", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onLogout: "onLogout", onMobileRefresh: "onMobileRefresh", onMobileFilter: "onMobileFilter" }, host: { listeners: { "window:resize": "onResize($event)" } }, viewQueries: [{ propertyName: "mainNavComponent", first: true, predicate: MainNavComponent, descendants: true }], hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"o-layout\" \n [attr.data-layout]=\"layoutService.dataAttributes()['data-layout']\"\n [attr.data-sidebar-left]=\"getEffectiveLeftSidebarVisibility()\"\n [attr.data-sidebar-left-w]=\"getEffectiveLeftSidebarWidth()\"\n [attr.data-sidebar-left-h]=\"getEffectiveLeftSidebarHeight()\"\n [attr.data-sidebar-right]=\"getEffectiveRightSidebarVisibility()\"\n [attr.data-sidebar-right-w]=\"getEffectiveRightSidebarWidth()\"\n [attr.data-sidebar-right-h]=\"getEffectiveRightSidebarHeight()\"\n >\n\n <!-- Nav -->\n <core-main-nav class=\"o-layout__nav\" \n (toggleSidebar)=\"toggleSidebar()\"\n [navItems]=\"navItems()\"\n [navConfig]=\"navConfig()\"\n [bottomNavItems]=\"bottomNavItems()\"\n [logoImagesConfig]=\"logoImagesConfig()\"\n [collapsedLogo]=\"collapsedLogo()\"\n [expandedLogo]=\"expandedLogo()\"\n (onLogout)=\"logout()\"\n >\n </core-main-nav>\n\n <!-- Main -->\n <div class=\"o-layout__body\">\n \n @if(shouldShowMobileHeader() && mobileHeaderConfig()) {\n <core-mobile-header\n class=\"o-layout__header c-header-mobile\"\n [config]=\"mobileHeaderConfig()!\"\n (menuClick)=\"onMobileMenuClick()\"\n (refreshClick)=\"onMobileRefreshClick()\"\n (filterClick)=\"onMobileFilterClick()\">\n </core-mobile-header>\n }\n\n @if(layoutStateService.isHeaderVisible$() | async) {\n @if(!shouldShowMobileHeader()) {\n <core-header\n [class]=\"getHeaderClasses()\"\n (filterRequested)=\"onFilterRequested()\"\n (createRequested)=\"onCreateRequested()\"\n (globalActionTriggered)=\"onGlobalActionTriggered($event)\">\n </core-header>\n }\n }\n\n @if(layoutService.sidebarLeft().visibility === SidebarVisibility.SHOW && leftSidebarConfig && shouldRenderLeftSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--left\"\n [config]=\"leftSidebarConfig\">\n </core-generic-sidebar>\n }\n\n <ng-content></ng-content>\n\n @if(layoutService.sidebarRight().visibility === SidebarVisibility.SHOW && rightSidebarConfig && shouldRenderRightSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--right\"\n [config]=\"rightSidebarConfig\">\n </core-generic-sidebar>\n }\n\n\n @if(dialogService.isOpen$()) {\n <core-confirmation-dialog\n [isOpen]=\"dialogService.isOpen$()\"\n [config]=\"dialogService.config$()\"\n (confirm)=\"dialogService.confirm($event)\"\n (cancel)=\"dialogService.cancel()\"\n ></core-confirmation-dialog>\n }\n\n @if(sidebarMobileModalService.isOpen()) {\n <core-generic-modal\n [isOpen]=\"sidebarMobileModalService.isOpen()\"\n [mode]=\"ModalMode.CREATE\"\n [title]=\"getSidebarModalTitle()\"\n [customTemplate]=\"sidebarModalContentTemplate\"\n (close)=\"sidebarMobileModalService.closeModal()\"\n [buttonConfig]=\"getSidebarModalButtons()\">\n </core-generic-modal>\n }\n\n </div> <!-- .o-layout__body -->\n</div> <!-- .o-layout -->\n\n<!-- Fixed Actions (Mobile) -->\n<core-generic-fixed-actions class=\"c-fixed-actions c-fixed-actions--right\"/>\n\n<!-- Fixed Actions Mobile Modal -->\n<core-fixed-actions-mobile-modal />\n\n<!-- Sidebar Custom Modal Global -->\n<core-sidebar-custom-modal></core-sidebar-custom-modal>\n\n<!-- Image Modal Global -->\n<core-image-modal></core-image-modal>\n\n<!-- Gallery Modal Global -->\n<core-gallery-modal></core-gallery-modal>\n\n<!-- ! Refactor: End -->", dependencies: [{ kind: "component", type: MainNavComponent, selector: "core-main-nav", inputs: ["navConfig", "appVersion", "navItems", "bottomNavItems", "isProduction", "logoImagesConfig", "collapsedLogo", "expandedLogo"], outputs: ["onLogout"] }, { kind: "component", type: HeaderComponent, selector: "core-header", outputs: ["filterRequested", "createRequested", "globalActionTriggered"] }, { kind: "component", type: MobileHeaderComponent, selector: "core-mobile-header", inputs: ["config"], outputs: ["menuClick", "refreshClick", "filterClick"] }, { kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }, { kind: "component", type: ConfirmationDialogComponent, selector: "core-confirmation-dialog", inputs: ["isOpen", "config"], outputs: ["confirm", "cancel"] }, { kind: "component", type: GenericSidebarComponent, selector: "core-generic-sidebar", inputs: ["config", "position", "customTemplate"], outputs: ["itemClicked", "subItemClicked"] }, { kind: "component", type: GenericModalComponent, selector: "core-generic-modal", inputs: ["isOpen", "mode", "data", "fields", "tabs", "steps", "title", "isMultiple", "customTemplate", "customViewTemplate", "finalStepTemplate", "buttonConfig", "modelFactory", "errors", "validators", "customHasChanges", "stepValidationEnabled", "allowFreeNavigation", "autoMarkCompleted"], outputs: ["save", "close", "modalData"] }, { kind: "component", type: ImageModalComponent, selector: "core-image-modal", outputs: ["modalClosed"] }, { kind: "component", type: GalleryModalComponent, selector: "core-gallery-modal" }, { kind: "component", type: SidebarCustomModalComponent, selector: "core-sidebar-custom-modal" }, { kind: "component", type: GenericFixedActionsComponent, selector: "core-generic-fixed-actions" }, { kind: "component", type: FixedActionsMobileModalComponent, selector: "core-fixed-actions-mobile-modal" }] });
17563
17381
  }
17564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: DataStoreService, decorators: [{
17382
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutComponent, decorators: [{
17383
+ type: Component,
17384
+ args: [{ selector: 'core-layout', imports: [
17385
+ MainNavComponent,
17386
+ HeaderComponent,
17387
+ MobileHeaderComponent,
17388
+ CommonModule,
17389
+ ConfirmationDialogComponent,
17390
+ GenericSidebarComponent,
17391
+ GenericModalComponent,
17392
+ ImageModalComponent,
17393
+ GalleryModalComponent,
17394
+ SidebarCustomModalComponent,
17395
+ GenericFixedActionsComponent,
17396
+ FixedActionsMobileModalComponent
17397
+ ], hostDirectives: [CoreHostDirective], template: "<div class=\"o-layout\" \n [attr.data-layout]=\"layoutService.dataAttributes()['data-layout']\"\n [attr.data-sidebar-left]=\"getEffectiveLeftSidebarVisibility()\"\n [attr.data-sidebar-left-w]=\"getEffectiveLeftSidebarWidth()\"\n [attr.data-sidebar-left-h]=\"getEffectiveLeftSidebarHeight()\"\n [attr.data-sidebar-right]=\"getEffectiveRightSidebarVisibility()\"\n [attr.data-sidebar-right-w]=\"getEffectiveRightSidebarWidth()\"\n [attr.data-sidebar-right-h]=\"getEffectiveRightSidebarHeight()\"\n >\n\n <!-- Nav -->\n <core-main-nav class=\"o-layout__nav\" \n (toggleSidebar)=\"toggleSidebar()\"\n [navItems]=\"navItems()\"\n [navConfig]=\"navConfig()\"\n [bottomNavItems]=\"bottomNavItems()\"\n [logoImagesConfig]=\"logoImagesConfig()\"\n [collapsedLogo]=\"collapsedLogo()\"\n [expandedLogo]=\"expandedLogo()\"\n (onLogout)=\"logout()\"\n >\n </core-main-nav>\n\n <!-- Main -->\n <div class=\"o-layout__body\">\n \n @if(shouldShowMobileHeader() && mobileHeaderConfig()) {\n <core-mobile-header\n class=\"o-layout__header c-header-mobile\"\n [config]=\"mobileHeaderConfig()!\"\n (menuClick)=\"onMobileMenuClick()\"\n (refreshClick)=\"onMobileRefreshClick()\"\n (filterClick)=\"onMobileFilterClick()\">\n </core-mobile-header>\n }\n\n @if(layoutStateService.isHeaderVisible$() | async) {\n @if(!shouldShowMobileHeader()) {\n <core-header\n [class]=\"getHeaderClasses()\"\n (filterRequested)=\"onFilterRequested()\"\n (createRequested)=\"onCreateRequested()\"\n (globalActionTriggered)=\"onGlobalActionTriggered($event)\">\n </core-header>\n }\n }\n\n @if(layoutService.sidebarLeft().visibility === SidebarVisibility.SHOW && leftSidebarConfig && shouldRenderLeftSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--left\"\n [config]=\"leftSidebarConfig\">\n </core-generic-sidebar>\n }\n\n <ng-content></ng-content>\n\n @if(layoutService.sidebarRight().visibility === SidebarVisibility.SHOW && rightSidebarConfig && shouldRenderRightSidebar()) {\n <core-generic-sidebar \n class=\"o-layout__sidebar--right\"\n [config]=\"rightSidebarConfig\">\n </core-generic-sidebar>\n }\n\n\n @if(dialogService.isOpen$()) {\n <core-confirmation-dialog\n [isOpen]=\"dialogService.isOpen$()\"\n [config]=\"dialogService.config$()\"\n (confirm)=\"dialogService.confirm($event)\"\n (cancel)=\"dialogService.cancel()\"\n ></core-confirmation-dialog>\n }\n\n @if(sidebarMobileModalService.isOpen()) {\n <core-generic-modal\n [isOpen]=\"sidebarMobileModalService.isOpen()\"\n [mode]=\"ModalMode.CREATE\"\n [title]=\"getSidebarModalTitle()\"\n [customTemplate]=\"sidebarModalContentTemplate\"\n (close)=\"sidebarMobileModalService.closeModal()\"\n [buttonConfig]=\"getSidebarModalButtons()\">\n </core-generic-modal>\n }\n\n </div> <!-- .o-layout__body -->\n</div> <!-- .o-layout -->\n\n<!-- Fixed Actions (Mobile) -->\n<core-generic-fixed-actions class=\"c-fixed-actions c-fixed-actions--right\"/>\n\n<!-- Fixed Actions Mobile Modal -->\n<core-fixed-actions-mobile-modal />\n\n<!-- Sidebar Custom Modal Global -->\n<core-sidebar-custom-modal></core-sidebar-custom-modal>\n\n<!-- Image Modal Global -->\n<core-image-modal></core-image-modal>\n\n<!-- Gallery Modal Global -->\n<core-gallery-modal></core-gallery-modal>\n\n<!-- ! Refactor: End -->" }]
17398
+ }], propDecorators: { mainNavComponent: [{
17399
+ type: ViewChild,
17400
+ args: [MainNavComponent]
17401
+ }], onResize: [{
17402
+ type: HostListener,
17403
+ args: ['window:resize', ['$event']]
17404
+ }] } });
17405
+
17406
+ class LayoutAuth {
17407
+ config = input.required();
17408
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutAuth, deps: [], target: i0.ɵɵFactoryTarget.Component });
17409
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: LayoutAuth, isStandalone: true, selector: "core-layout-auth", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"c-login\">\n @if (config().patternUrl) {\n <picture class=\"c-login__bg\">\n <img [src]=\"config().patternUrl!\" alt=\"Background pattern\" width=\"1044\" height=\"889\" />\n </picture>\n }\n\n @if (config().mainLogoUrl) {\n <picture class=\"c-login__logo\">\n <img [src]=\"config().mainLogoUrl!\" alt=\"Main logo\">\n </picture>\n }\n \n <div class=\"c-login__main c-entry-group\">\n <ng-content></ng-content>\n </div>\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
17410
+ }
17411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: LayoutAuth, decorators: [{
17412
+ type: Component,
17413
+ args: [{ selector: 'core-layout-auth', imports: [
17414
+ CommonModule
17415
+ ], hostDirectives: [CoreHostDirective], template: "<div class=\"c-login\">\n @if (config().patternUrl) {\n <picture class=\"c-login__bg\">\n <img [src]=\"config().patternUrl!\" alt=\"Background pattern\" width=\"1044\" height=\"889\" />\n </picture>\n }\n\n @if (config().mainLogoUrl) {\n <picture class=\"c-login__logo\">\n <img [src]=\"config().mainLogoUrl!\" alt=\"Main logo\">\n </picture>\n }\n \n <div class=\"c-login__main c-entry-group\">\n <ng-content></ng-content>\n </div>\n</div>" }]
17416
+ }] });
17417
+
17418
+ var RatingSize;
17419
+ (function (RatingSize) {
17420
+ RatingSize["SMALL"] = "small";
17421
+ RatingSize["MEDIUM"] = "medium";
17422
+ RatingSize["LARGE"] = "large";
17423
+ })(RatingSize || (RatingSize = {}));
17424
+
17425
+ var RatingType;
17426
+ (function (RatingType) {
17427
+ RatingType["STARS"] = "stars";
17428
+ RatingType["NUMBERS"] = "numbers";
17429
+ RatingType["CUSTOM"] = "custom";
17430
+ })(RatingType || (RatingType = {}));
17431
+
17432
+ class RatingService {
17433
+ apiService = inject(ApiService);
17434
+ /**
17435
+ * Submit a rating to the specified endpoint
17436
+ * @param endpoint - The API endpoint to submit the rating to
17437
+ * @param ratingData - The rating data to submit
17438
+ * @returns Observable with the API response
17439
+ */
17440
+ submitRating(endpoint, ratingData) {
17441
+ return this.apiService.createObj(endpoint, ratingData, false);
17442
+ }
17443
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17444
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, providedIn: 'root' });
17445
+ }
17446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: RatingService, decorators: [{
17565
17447
  type: Injectable,
17566
- args: [{ providedIn: 'root' }]
17448
+ args: [{
17449
+ providedIn: 'root'
17450
+ }]
17567
17451
  }] });
17568
17452
 
17569
- class CustomClassService {
17570
- rendererFactory;
17571
- dataStore;
17572
- renderer;
17573
- STORE_KEY = 'custom-class-operations';
17574
- operationCounter = 0;
17575
- constructor(rendererFactory, dataStore) {
17576
- this.rendererFactory = rendererFactory;
17577
- this.dataStore = dataStore;
17578
- this.renderer = this.rendererFactory.createRenderer(null, null);
17579
- // Initialize the store
17580
- this.dataStore.hydrate(this.STORE_KEY, []);
17453
+ class GenericRatingComponent {
17454
+ ratingService = inject(RatingService);
17455
+ config = input.required();
17456
+ ratingChange = output();
17457
+ selectedRating = signal(0);
17458
+ hoveredRating = signal(0);
17459
+ stars = signal([]);
17460
+ loading = signal(false);
17461
+ uniqueId = signal('');
17462
+ RatingSize = RatingSize;
17463
+ RatingType = RatingType;
17464
+ ngOnInit() {
17465
+ this.initializeStars();
17466
+ this.generateUniqueId();
17467
+ this.initializeDefaultRating();
17468
+ setTimeout(() => {
17469
+ this.updateStarVisuals(this.selectedRating());
17470
+ }, 0);
17581
17471
  }
17582
- ngOnDestroy() {
17583
- this.clearHistory();
17584
- this.dataStore.removeStore(this.STORE_KEY);
17472
+ generateUniqueId() {
17473
+ const timestamp = Date.now();
17474
+ const random1 = Math.floor(Math.random() * 10000);
17475
+ const random2 = Math.floor(Math.random() * 10000);
17476
+ const performanceTime = performance.now();
17477
+ const instanceId = Math.random().toString(36).substring(2, 15);
17478
+ this.uniqueId.set(`rating-${timestamp}-${random1}-${random2}-${performanceTime.toString().replace('.', '')}-${instanceId}`);
17585
17479
  }
17586
- addClass(target, classNames, parent) {
17587
- const elements = this.resolveElements(target, parent);
17588
- if (elements.length === 0) {
17589
- this.recordOperation('add', target, classNames, false);
17590
- return false;
17480
+ initializeDefaultRating() {
17481
+ const config = this.config();
17482
+ if (config.defaultRating && config.defaultRating > 0 && config.defaultRating <= config.totalStars) {
17483
+ this.selectedRating.set(config.defaultRating);
17591
17484
  }
17592
- const classes = Array.isArray(classNames) ? classNames : [classNames];
17593
- elements.forEach(element => {
17594
- classes.forEach(className => {
17595
- if (className && className.trim()) {
17596
- this.renderer.addClass(element, className.trim());
17597
- }
17598
- });
17599
- });
17600
- this.recordOperation('add', target, classes, true);
17601
- return true;
17602
17485
  }
17603
- removeClass(target, classNames, parent) {
17604
- const elements = this.resolveElements(target, parent);
17605
- if (elements.length === 0) {
17606
- this.recordOperation('remove', target, classNames, false);
17607
- return false;
17608
- }
17609
- const classes = Array.isArray(classNames) ? classNames : [classNames];
17610
- elements.forEach(element => {
17611
- classes.forEach(className => {
17612
- if (className && className.trim()) {
17613
- this.renderer.removeClass(element, className.trim());
17614
- }
17615
- });
17616
- });
17617
- this.recordOperation('remove', target, classes, true);
17618
- return true;
17486
+ getUniqueName() {
17487
+ return `star-${this.uniqueId()}`;
17619
17488
  }
17620
- toggleClass(target, classNames, parent) {
17621
- const elements = this.resolveElements(target, parent);
17622
- if (elements.length === 0) {
17623
- this.recordOperation('toggle', target, classNames, false);
17624
- return false;
17625
- }
17626
- const classes = Array.isArray(classNames) ? classNames : [classNames];
17627
- elements.forEach(element => {
17628
- classes.forEach(className => {
17629
- if (className && className.trim()) {
17630
- const trimmedClass = className.trim();
17631
- if (element.classList.contains(trimmedClass)) {
17632
- this.renderer.removeClass(element, trimmedClass);
17633
- }
17634
- else {
17635
- this.renderer.addClass(element, trimmedClass);
17636
- }
17637
- }
17489
+ getUniqueStarId(starValue) {
17490
+ return `star-${this.uniqueId()}-${starValue}`;
17491
+ }
17492
+ initializeStars() {
17493
+ const config = this.config();
17494
+ const totalStars = config.totalStars || 5;
17495
+ const starsArray = [];
17496
+ for (let i = totalStars; i >= 1; i--) {
17497
+ starsArray.push({
17498
+ value: i,
17499
+ label: config.starLabels?.[i] || `${i}`,
17500
+ id: `star-${i}`
17638
17501
  });
17639
- });
17640
- this.recordOperation('toggle', target, classes, true);
17641
- return true;
17502
+ }
17503
+ this.stars.set(starsArray);
17642
17504
  }
17643
- hasClass(target, className, parent) {
17644
- const elements = this.resolveElements(target, parent);
17645
- if (elements.length === 0) {
17646
- return false;
17505
+ onStarClick(rating) {
17506
+ const config = this.config();
17507
+ if (config.readonly) {
17508
+ return;
17509
+ }
17510
+ this.selectedRating.set(rating);
17511
+ this.updateStarVisuals(rating);
17512
+ const event = {
17513
+ rating,
17514
+ label: this.stars().find(star => star.value === rating)?.label || '',
17515
+ endpoint: config.endpoint
17516
+ };
17517
+ this.ratingChange.emit(event);
17518
+ if (config.endpoint && config.endpoint.trim() !== '') {
17519
+ this.submitRating(event);
17647
17520
  }
17648
- const element = elements[0];
17649
- return element.classList.contains(className.trim());
17650
17521
  }
17651
- replaceClass(target, oldClass, newClass, parent) {
17652
- const elements = this.resolveElements(target, parent);
17653
- if (elements.length === 0) {
17654
- this.recordOperation('replace', target, [newClass], false, oldClass);
17655
- return false;
17522
+ onStarHover(rating) {
17523
+ const config = this.config();
17524
+ if (config.readonly) {
17525
+ return;
17526
+ }
17527
+ this.hoveredRating.set(rating);
17528
+ this.updateStarVisuals(rating);
17529
+ }
17530
+ onStarLeave() {
17531
+ const config = this.config();
17532
+ if (config.readonly) {
17533
+ return;
17656
17534
  }
17657
- elements.forEach(element => {
17658
- if (oldClass && oldClass.trim()) {
17659
- this.renderer.removeClass(element, oldClass.trim());
17535
+ this.hoveredRating.set(0);
17536
+ this.updateStarVisuals(this.selectedRating());
17537
+ }
17538
+ updateStarVisuals(targetRating) {
17539
+ const container = document.querySelector(`[data-rating-id="${this.uniqueId()}"]`);
17540
+ if (!container)
17541
+ return;
17542
+ const stars = container.querySelectorAll('.c-rating__filled-star');
17543
+ stars.forEach((star, index) => {
17544
+ const starValue = this.stars().length - index;
17545
+ const element = star;
17546
+ if (starValue <= targetRating) {
17547
+ element.style.opacity = '1';
17548
+ element.style.display = 'block';
17660
17549
  }
17661
- if (newClass && newClass.trim()) {
17662
- this.renderer.addClass(element, newClass.trim());
17550
+ else {
17551
+ element.style.opacity = '0';
17552
+ element.style.display = 'none';
17663
17553
  }
17664
17554
  });
17665
- this.recordOperation('replace', target, [newClass], true, oldClass);
17666
- return true;
17667
17555
  }
17668
- setClass(target, classNames, parent) {
17669
- const elements = this.resolveElements(target, parent);
17670
- if (elements.length === 0) {
17671
- this.recordOperation('set', target, classNames, false);
17672
- return false;
17673
- }
17674
- const classes = Array.isArray(classNames) ? classNames : [classNames];
17675
- elements.forEach(element => {
17676
- // Clear all existing classes
17677
- element.className = '';
17678
- // Add new classes
17679
- classes.forEach(className => {
17680
- if (className && className.trim()) {
17681
- this.renderer.addClass(element, className.trim());
17682
- }
17683
- });
17556
+ submitRating(event) {
17557
+ this.loading.set(true);
17558
+ this.ratingService.submitRating(event.endpoint, {
17559
+ rating: event.rating,
17560
+ label: event.label
17561
+ }).subscribe({
17562
+ next: (response) => {
17563
+ this.loading.set(false);
17564
+ },
17565
+ error: (error) => {
17566
+ console.error('Error submitting rating:', error);
17567
+ this.loading.set(false);
17568
+ }
17684
17569
  });
17685
- this.recordOperation('set', target, classes, true);
17686
- return true;
17687
17570
  }
17688
- resolveElements(target, parent) {
17689
- let searchContext = document;
17690
- // Resolve parent context if provided
17691
- if (parent) {
17692
- if (parent instanceof ElementRef) {
17693
- searchContext = parent.nativeElement;
17571
+ getCurrentLabel() {
17572
+ const config = this.config();
17573
+ const currentRating = config.readonly
17574
+ ? this.selectedRating()
17575
+ : (this.hoveredRating() || this.selectedRating());
17576
+ if (currentRating === 0) {
17577
+ return config.defaultLabel || '';
17578
+ }
17579
+ const star = this.stars().find(s => s.value === currentRating);
17580
+ return star?.label || '';
17581
+ }
17582
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericRatingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17583
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: GenericRatingComponent, isStandalone: true, selector: "core-generic-rating", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { ratingChange: "ratingChange" }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "@if (config().title) {\n <p class=\"u-text\"><strong>{{ config().title }}</strong></p>\n}\n\n<div class=\"c-rating\" [attr.data-rating-id]=\"uniqueId()\">\n \n <div class=\"c-rating__stars\">\n @for (star of stars(); track star.id) {\n <input \n type=\"radio\" \n [name]=\"getUniqueName()\" \n [id]=\"getUniqueStarId(star.value)\" \n [value]=\"star.value\"\n [disabled]=\"config().readonly || loading()\"\n (click)=\"onStarClick(star.value)\" />\n \n <label \n [for]=\"getUniqueStarId(star.value)\" \n [title]=\"star.label + ' estrellas'\"\n class=\"icon-star\"\n [class.c-rating__readonly]=\"config().readonly\"\n [style.cursor]=\"config().readonly ? 'default' : 'pointer'\"\n (mouseenter)=\"!config().readonly && onStarHover(star.value)\"\n (mouseleave)=\"!config().readonly && onStarLeave()\">\n <span class=\"c-rating__filled-star icon-star-filled\"></span>\n </label>\n }\n </div>\n \n @if (config().showLabels !== false) {\n <span class=\"c-rating__text\">{{ getCurrentLabel() }}</span>\n }\n</div> ", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: TranslateModule }] });
17584
+ }
17585
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericRatingComponent, decorators: [{
17586
+ type: Component,
17587
+ args: [{ selector: 'core-generic-rating', standalone: true, imports: [CommonModule, TranslateModule], hostDirectives: [CoreHostDirective], template: "@if (config().title) {\n <p class=\"u-text\"><strong>{{ config().title }}</strong></p>\n}\n\n<div class=\"c-rating\" [attr.data-rating-id]=\"uniqueId()\">\n \n <div class=\"c-rating__stars\">\n @for (star of stars(); track star.id) {\n <input \n type=\"radio\" \n [name]=\"getUniqueName()\" \n [id]=\"getUniqueStarId(star.value)\" \n [value]=\"star.value\"\n [disabled]=\"config().readonly || loading()\"\n (click)=\"onStarClick(star.value)\" />\n \n <label \n [for]=\"getUniqueStarId(star.value)\" \n [title]=\"star.label + ' estrellas'\"\n class=\"icon-star\"\n [class.c-rating__readonly]=\"config().readonly\"\n [style.cursor]=\"config().readonly ? 'default' : 'pointer'\"\n (mouseenter)=\"!config().readonly && onStarHover(star.value)\"\n (mouseleave)=\"!config().readonly && onStarLeave()\">\n <span class=\"c-rating__filled-star icon-star-filled\"></span>\n </label>\n }\n </div>\n \n @if (config().showLabels !== false) {\n <span class=\"c-rating__text\">{{ getCurrentLabel() }}</span>\n }\n</div> " }]
17588
+ }] });
17589
+
17590
+ var ProgressBarSize;
17591
+ (function (ProgressBarSize) {
17592
+ ProgressBarSize["NORMAL"] = "";
17593
+ ProgressBarSize["SMALL"] = "xs";
17594
+ ProgressBarSize["LARGE"] = "xl";
17595
+ })(ProgressBarSize || (ProgressBarSize = {}));
17596
+
17597
+ class ProgressBarComponent {
17598
+ progress = input(0);
17599
+ size = input(ProgressBarSize.NORMAL);
17600
+ percentage = computed(() => {
17601
+ return this.progress() / 100;
17602
+ });
17603
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ProgressBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17604
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.6", type: ProgressBarComponent, isStandalone: true, selector: "core-progress-bar", inputs: { progress: { classPropertyName: "progress", publicName: "progress", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: "<div class=\"c-progress-bar c-progress-bar--{{ size() }}\" style=\"--progress: {{ percentage() }}\">\n <div class=\"c-progress-bar__bar\"></div>\n</div>" });
17605
+ }
17606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: ProgressBarComponent, decorators: [{
17607
+ type: Component,
17608
+ args: [{ selector: 'core-progress-bar', standalone: true, imports: [], hostDirectives: [CoreHostDirective], template: "<div class=\"c-progress-bar c-progress-bar--{{ size() }}\" style=\"--progress: {{ percentage() }}\">\n <div class=\"c-progress-bar__bar\"></div>\n</div>" }]
17609
+ }] });
17610
+
17611
+ class CardComponent {
17612
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17613
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.6", type: CardComponent, isStandalone: true, selector: "core-card", hostDirectives: [{ directive: CoreHostDirective }], ngImport: i0, template: `
17614
+ <div class="u-card">
17615
+ <ng-content></ng-content>
17616
+ </div>`, isInline: true });
17617
+ }
17618
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CardComponent, decorators: [{
17619
+ type: Component,
17620
+ args: [{
17621
+ selector: 'core-card',
17622
+ standalone: true,
17623
+ imports: [],
17624
+ hostDirectives: [CoreHostDirective],
17625
+ template: `
17626
+ <div class="u-card">
17627
+ <ng-content></ng-content>
17628
+ </div>`
17629
+ }]
17630
+ }] });
17631
+
17632
+ class CarouselComponent {
17633
+ images = input([]);
17634
+ config = input({});
17635
+ carouselHolder = viewChild('carouselHolder');
17636
+ carouselViewport = viewChild('carouselViewport');
17637
+ currentIndex = signal(0);
17638
+ timer = signal(null);
17639
+ autoplay = computed(() => this.config().autoplay ?? false);
17640
+ interval = computed(() => this.config().interval ?? 3000);
17641
+ perView = computed(() => Math.max(1, this.config().perView ?? 1));
17642
+ step = computed(() => Math.max(1, this.config().step ?? this.perView()));
17643
+ showDots = computed(() => this.config().showDots ?? true);
17644
+ showArrows = computed(() => this.config().showArrows ?? true);
17645
+ arrowsOutside = computed(() => this.config().arrowsOutside ?? false);
17646
+ itemsGap = computed(() => this.config().itemsGap ?? '10px');
17647
+ controlsOffset = computed(() => this.config().controlsOffset ?? '2rem');
17648
+ controlsSize = computed(() => this.config().controlsSize ?? '2.5rem');
17649
+ ariaLabel = computed(() => this.config().ariaLabel ?? 'Galería de imágenes');
17650
+ maxIndex = computed(() => Math.max(0, this.images().length - this.perView()));
17651
+ pagesLength = computed(() => Math.max(1, Math.ceil(this.images().length / this.perView())));
17652
+ dots = computed(() => Array.from({ length: this.pagesLength() }, (_, i) => i));
17653
+ currentPage = computed(() => Math.min(this.pagesLength() - 1, Math.floor(this.currentIndex() / this.perView())));
17654
+ carouselClasses = computed(() => {
17655
+ const classes = ['c-img-carousel', 'js-img-carousel'];
17656
+ if (this.arrowsOutside()) {
17657
+ classes.push('c-img-carousel--arrows-out');
17658
+ }
17659
+ return classes;
17660
+ });
17661
+ constructor() {
17662
+ effect(() => {
17663
+ const viewport = this.carouselViewport();
17664
+ if (viewport) {
17665
+ const element = viewport.nativeElement;
17666
+ element.style.setProperty('--per-view', this.perView().toString());
17667
+ element.style.setProperty('--items-gap', this.itemsGap());
17668
+ element.style.setProperty('--controls-offset', this.controlsOffset());
17669
+ element.style.setProperty('--controls-size', this.controlsSize());
17694
17670
  }
17695
- else if (parent instanceof HTMLElement) {
17696
- searchContext = parent;
17671
+ });
17672
+ effect(() => {
17673
+ const shouldAutoplay = this.autoplay() && this.images().length > 1;
17674
+ const currentTimer = this.timer();
17675
+ if (shouldAutoplay && !currentTimer) {
17676
+ this.startAutoplay();
17697
17677
  }
17698
- else if (parent && parent.nativeElement instanceof HTMLElement) {
17699
- searchContext = parent.nativeElement;
17678
+ else if (!shouldAutoplay && currentTimer) {
17679
+ this.stopAutoplay();
17700
17680
  }
17701
- else if (typeof parent === 'string') {
17702
- const parentElement = document.querySelector(parent);
17703
- if (parentElement instanceof HTMLElement) {
17704
- searchContext = parentElement;
17705
- }
17681
+ });
17682
+ effect(() => {
17683
+ const holder = this.carouselHolder();
17684
+ const index = this.currentIndex();
17685
+ if (holder) {
17686
+ const element = holder.nativeElement;
17687
+ const percentage = -(index * (100 / this.perView()));
17688
+ element.style.transform = `translateX(${percentage}%)`;
17706
17689
  }
17690
+ });
17691
+ }
17692
+ ngAfterViewInit() {
17693
+ this.goToSlide(0, false);
17694
+ }
17695
+ ngOnDestroy() {
17696
+ this.stopAutoplay();
17697
+ }
17698
+ goToSlide(index, animate = true, fromAutoplay = false) {
17699
+ if (index < 0) {
17700
+ index = this.maxIndex();
17707
17701
  }
17708
- // ElementRef from ViewChild
17709
- if (target instanceof ElementRef) {
17710
- const element = target.nativeElement;
17711
- // If parent is specified, check if element is within parent
17712
- if (parent && searchContext !== document) {
17713
- return searchContext.contains(element) ? [element] : [];
17714
- }
17715
- return [element];
17702
+ else if (index > this.maxIndex()) {
17703
+ index = 0;
17716
17704
  }
17717
- // Direct HTMLElement
17718
- if (target instanceof HTMLElement) {
17719
- // If parent is specified, check if element is within parent
17720
- if (parent && searchContext !== document) {
17721
- return searchContext.contains(target) ? [target] : [];
17722
- }
17723
- return [target];
17705
+ const holder = this.carouselHolder();
17706
+ if (holder) {
17707
+ holder.nativeElement.style.transition = animate ? 'transform 350ms ease' : 'none';
17724
17708
  }
17725
- // NodeList or HTMLCollection
17726
- if (target instanceof NodeList || target instanceof HTMLCollection) {
17727
- const elements = Array.from(target);
17728
- // Filter by parent if specified
17729
- if (parent && searchContext !== document) {
17730
- return elements.filter(el => searchContext.contains(el));
17731
- }
17732
- return elements;
17709
+ this.currentIndex.set(index);
17710
+ if (!fromAutoplay && this.autoplay()) {
17711
+ this.restartAutoplay();
17733
17712
  }
17734
- // CSS Selector string
17735
- if (typeof target === 'string') {
17736
- const elements = searchContext.querySelectorAll(target);
17737
- return Array.from(elements);
17713
+ }
17714
+ goToPage(pageIndex) {
17715
+ const targetSlide = Math.min(this.maxIndex(), Math.max(0, pageIndex * this.perView()));
17716
+ this.goToSlide(targetSlide, true, false);
17717
+ }
17718
+ goToNextSlide(fromAutoplay = false) {
17719
+ this.goToSlide(this.currentIndex() + this.step(), true, fromAutoplay);
17720
+ }
17721
+ goToPrevSlide() {
17722
+ this.goToSlide(this.currentIndex() - this.step(), true, false);
17723
+ }
17724
+ isDotActive(dotIndex) {
17725
+ return dotIndex === this.currentPage();
17726
+ }
17727
+ startAutoplay() {
17728
+ const currentTimer = this.timer();
17729
+ if (currentTimer) {
17730
+ clearInterval(currentTimer);
17731
+ }
17732
+ const intervalId = setInterval(() => {
17733
+ this.goToNextSlide(true);
17734
+ }, this.interval());
17735
+ this.timer.set(intervalId);
17736
+ }
17737
+ stopAutoplay() {
17738
+ const timerId = this.timer();
17739
+ if (timerId) {
17740
+ clearInterval(timerId);
17741
+ this.timer.set(null);
17738
17742
  }
17739
- // If it has a nativeElement property (custom wrapper)
17740
- if (target && target.nativeElement instanceof HTMLElement) {
17741
- const element = target.nativeElement;
17742
- // If parent is specified, check if element is within parent
17743
- if (parent && searchContext !== document) {
17744
- return searchContext.contains(element) ? [element] : [];
17745
- }
17746
- return [element];
17743
+ }
17744
+ restartAutoplay() {
17745
+ if (this.autoplay()) {
17746
+ this.startAutoplay();
17747
17747
  }
17748
- return [];
17749
17748
  }
17750
- recordOperation(operation, target, classNames, success, oldClass) {
17751
- const classes = Array.isArray(classNames) ? classNames : [classNames];
17752
- const targetId = this.getTargetIdentifier(target);
17753
- const record = {
17754
- id: `op-${++this.operationCounter}-${Date.now()}`,
17755
- timestamp: Date.now(),
17756
- operation,
17757
- target: targetId,
17758
- classNames: classes,
17759
- oldClass,
17760
- success
17761
- };
17762
- this.dataStore.upsertOne(this.STORE_KEY, record);
17749
+ onResize() {
17750
+ this.goToSlide(this.currentIndex(), false);
17763
17751
  }
17764
- getTargetIdentifier(target) {
17765
- if (typeof target === 'string') {
17766
- return target;
17752
+ onKeyDown(event) {
17753
+ if (event.key === 'ArrowLeft') {
17754
+ this.goToPrevSlide();
17767
17755
  }
17768
- if (target instanceof ElementRef) {
17769
- return this.getElementSelector(target.nativeElement);
17756
+ else if (event.key === 'ArrowRight') {
17757
+ this.goToNextSlide();
17770
17758
  }
17771
- if (target instanceof HTMLElement) {
17772
- return this.getElementSelector(target);
17759
+ }
17760
+ getSlideStyle(index) {
17761
+ return {
17762
+ 'flex': `0 0 ${100 / this.perView()}%`
17763
+ };
17764
+ }
17765
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CarouselComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
17766
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.6", type: CarouselComponent, isStandalone: true, selector: "core-carousel", inputs: { images: { classPropertyName: "images", publicName: "images", isSignal: true, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:resize": "onResize()", "keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "carouselHolder", first: true, predicate: ["carouselHolder"], descendants: true, isSignal: true }, { propertyName: "carouselViewport", first: true, predicate: ["carouselViewport"], descendants: true, isSignal: true }], ngImport: i0, template: "<div \n [ngClass]=\"carouselClasses()\"\n [attr.aria-label]=\"ariaLabel()\"\n tabindex=\"0\"\n #carouselViewport\n [class.is-multiple]=\"perView() > 1\">\n \n <div class=\"c-img-carousel__viewport\">\n <div class=\"c-img-carousel__holder js-img-carousel-holder\" #carouselHolder>\n <div \n *ngFor=\"let image of images(); let i = index\"\n class=\"c-img-carousel__slide js-img-carousel-slide\">\n <div class=\"c-img-carousel__slide-inner\">\n <core-image-preview\n [src]=\"image.url\"\n [alt]=\"image.alt || 'Image ' + (i + 1)\"\n [title]=\"image.title || image.alt || 'Image ' + (i + 1)\">\n </core-image-preview>\n </div>\n </div>\n </div>\n \n @if (!config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n \n <div \n *ngIf=\"showDots()\"\n class=\"c-img-carousel__dots js-img-carousel-nav\"\n aria-label=\"Navegaci\u00F3n\">\n <button\n *ngFor=\"let page of dots(); let i = index\"\n class=\"c-img-carousel__dot js-img-carousel-dot\"\n type=\"button\"\n (click)=\"goToPage(i)\"\n [class.c-img-carousel__dot--active]=\"currentPage() === i\"\n [attr.aria-label]=\"'Ir a p\u00E1gina ' + (i + 1)\"\n [attr.aria-current]=\"currentPage() === i ? 'true' : 'false'\">\n </button>\n </div>\n </div>\n @if(config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ImagePreviewComponent, selector: "core-image-preview", inputs: ["src", "alt", "title", "width", "height", "objectFit", "borderRadius", "cursor", "loading", "isRelative", "showSkeleton", "skeletonAnimation"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
17767
+ }
17768
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CarouselComponent, decorators: [{
17769
+ type: Component,
17770
+ args: [{ selector: 'core-carousel', standalone: true, imports: [CommonModule, ImagePreviewComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div \n [ngClass]=\"carouselClasses()\"\n [attr.aria-label]=\"ariaLabel()\"\n tabindex=\"0\"\n #carouselViewport\n [class.is-multiple]=\"perView() > 1\">\n \n <div class=\"c-img-carousel__viewport\">\n <div class=\"c-img-carousel__holder js-img-carousel-holder\" #carouselHolder>\n <div \n *ngFor=\"let image of images(); let i = index\"\n class=\"c-img-carousel__slide js-img-carousel-slide\">\n <div class=\"c-img-carousel__slide-inner\">\n <core-image-preview\n [src]=\"image.url\"\n [alt]=\"image.alt || 'Image ' + (i + 1)\"\n [title]=\"image.title || image.alt || 'Image ' + (i + 1)\">\n </core-image-preview>\n </div>\n </div>\n </div>\n \n @if (!config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n \n <div \n *ngIf=\"showDots()\"\n class=\"c-img-carousel__dots js-img-carousel-nav\"\n aria-label=\"Navegaci\u00F3n\">\n <button\n *ngFor=\"let page of dots(); let i = index\"\n class=\"c-img-carousel__dot js-img-carousel-dot\"\n type=\"button\"\n (click)=\"goToPage(i)\"\n [class.c-img-carousel__dot--active]=\"currentPage() === i\"\n [attr.aria-label]=\"'Ir a p\u00E1gina ' + (i + 1)\"\n [attr.aria-current]=\"currentPage() === i ? 'true' : 'false'\">\n </button>\n </div>\n </div>\n @if(config().arrowsOutside) {\n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--prev icon-arrow-left\"\n type=\"button\"\n (click)=\"goToPrevSlide()\"\n [attr.aria-label]=\"'Anterior'\"\n data-control=\"prevBtn\">\n </button>\n \n <button \n *ngIf=\"showArrows()\"\n class=\"c-img-carousel__btn c-img-carousel__btn--next icon-arrow-right\"\n type=\"button\"\n (click)=\"goToNextSlide()\"\n [attr.aria-label]=\"'Siguiente'\"\n data-control=\"nextBtn\">\n </button>\n }\n</div>" }]
17771
+ }], ctorParameters: () => [], propDecorators: { onResize: [{
17772
+ type: HostListener,
17773
+ args: ['window:resize']
17774
+ }], onKeyDown: [{
17775
+ type: HostListener,
17776
+ args: ['keydown', ['$event']]
17777
+ }] } });
17778
+
17779
+ var ChatMessageType;
17780
+ (function (ChatMessageType) {
17781
+ ChatMessageType["TEXT"] = "text";
17782
+ ChatMessageType["IMAGE"] = "image";
17783
+ ChatMessageType["FILE"] = "file";
17784
+ ChatMessageType["SYSTEM"] = "system";
17785
+ ChatMessageType["NOTIFICATION"] = "notification";
17786
+ ChatMessageType["CUSTOM"] = "custom";
17787
+ })(ChatMessageType || (ChatMessageType = {}));
17788
+
17789
+ var ChatMessagePosition;
17790
+ (function (ChatMessagePosition) {
17791
+ ChatMessagePosition["LEFT"] = "left";
17792
+ ChatMessagePosition["RIGHT"] = "right";
17793
+ })(ChatMessagePosition || (ChatMessagePosition = {}));
17794
+
17795
+ var FilePreviewActionType;
17796
+ (function (FilePreviewActionType) {
17797
+ FilePreviewActionType["DOWNLOAD"] = "download";
17798
+ FilePreviewActionType["DELETE"] = "delete";
17799
+ FilePreviewActionType["PREVIEW"] = "preview";
17800
+ })(FilePreviewActionType || (FilePreviewActionType = {}));
17801
+
17802
+ class GenericChatService {
17803
+ constructor() { }
17804
+ formatTimestamp(timestamp, format) {
17805
+ if (!timestamp)
17806
+ return '';
17807
+ const timeFormat = format || 'dd/MM/yyyy HH:mm';
17808
+ if (timeFormat === 'dd/MM/yyyy HH:mm') {
17809
+ const day = timestamp.getDate().toString().padStart(2, '0');
17810
+ const month = (timestamp.getMonth() + 1).toString().padStart(2, '0');
17811
+ const year = timestamp.getFullYear();
17812
+ const hours = timestamp.getHours().toString().padStart(2, '0');
17813
+ const minutes = timestamp.getMinutes().toString().padStart(2, '0');
17814
+ return `${day}/${month}/${year} ${hours}:${minutes}`;
17773
17815
  }
17774
- if (target && target.nativeElement instanceof HTMLElement) {
17775
- return this.getElementSelector(target.nativeElement);
17816
+ if (timeFormat === 'HH:mm') {
17817
+ const hours = timestamp.getHours().toString().padStart(2, '0');
17818
+ const minutes = timestamp.getMinutes().toString().padStart(2, '0');
17819
+ return `${hours}:${minutes}`;
17776
17820
  }
17777
- return 'unknown-target';
17821
+ return timestamp.toLocaleTimeString();
17778
17822
  }
17779
- getElementSelector(element) {
17780
- if (element.id) {
17781
- return `#${element.id}`;
17782
- }
17783
- const classes = Array.from(element.classList).join('.');
17784
- if (classes) {
17785
- return `.${classes}`;
17823
+ formatDate(timestamp, format) {
17824
+ if (!timestamp)
17825
+ return '';
17826
+ const dateFormat = format || 'dd/MM/yyyy';
17827
+ if (dateFormat === 'dd/MM/yyyy') {
17828
+ const day = timestamp.getDate().toString().padStart(2, '0');
17829
+ const month = (timestamp.getMonth() + 1).toString().padStart(2, '0');
17830
+ const year = timestamp.getFullYear();
17831
+ return `${day}/${month}/${year}`;
17786
17832
  }
17787
- return element.tagName.toLowerCase();
17833
+ return timestamp.toLocaleDateString();
17788
17834
  }
17789
- getOperationHistory() {
17790
- return [...this.dataStore.selectAll(this.STORE_KEY)()];
17835
+ shouldUseCustomTemplate(message, config) {
17836
+ return message.type === ChatMessageType.CUSTOM &&
17837
+ !!config.customMessageTemplates &&
17838
+ !!message.customData?.templateKey &&
17839
+ !!config.customMessageTemplates.has(message.customData.templateKey);
17791
17840
  }
17792
- getOperationsByType(operation) {
17793
- return this.getOperationHistory().filter(op => op.operation === operation);
17841
+ getMessageClasses(message, config) {
17842
+ const baseClass = 'c-chat-bubble';
17843
+ const positionClass = message.position === 'right' ? 'c-chat-bubble--right' : '';
17844
+ const customClass = message.customClass || '';
17845
+ const configClass = config.customCssClasses?.messageItem || '';
17846
+ return [baseClass, positionClass, customClass, configClass]
17847
+ .filter(cls => cls.length > 0)
17848
+ .join(' ');
17794
17849
  }
17795
- getOperationsByTarget(target) {
17796
- return this.getOperationHistory().filter(op => op.target === target);
17850
+ getContentClasses(message, config) {
17851
+ const baseClass = 'c-chat-bubble__content';
17852
+ const typeClass = message.type ? `c-chat-bubble__content--${message.type}` : '';
17853
+ const configClass = config.customCssClasses?.messageItem || '';
17854
+ return [baseClass, typeClass, configClass]
17855
+ .filter(cls => cls.length > 0)
17856
+ .join(' ');
17797
17857
  }
17798
- getSuccessfulOperations() {
17799
- return this.getOperationHistory().filter(op => op.success);
17858
+ getTimestampClasses(config) {
17859
+ const baseClass = 'c-chat-bubble__timestamp';
17860
+ const configClass = config.customCssClasses?.messageItem || '';
17861
+ return [baseClass, configClass]
17862
+ .filter(cls => cls.length > 0)
17863
+ .join(' ');
17800
17864
  }
17801
- getFailedOperations() {
17802
- return this.getOperationHistory().filter(op => !op.success);
17865
+ getImageClasses(config) {
17866
+ const baseClass = 'c-chat-bubble__image';
17867
+ const configClass = config.customCssClasses?.messageItem || '';
17868
+ return [baseClass, configClass]
17869
+ .filter(cls => cls.length > 0)
17870
+ .join(' ');
17803
17871
  }
17804
- getOperationCount() {
17805
- return this.dataStore.count(this.STORE_KEY);
17872
+ validateMessage(message) {
17873
+ if (!message)
17874
+ return false;
17875
+ if (!message.id || !message.content)
17876
+ return false;
17877
+ if (!message.timestamp)
17878
+ return false;
17879
+ if (!message.type)
17880
+ return false;
17881
+ return true;
17806
17882
  }
17807
- clearHistory() {
17808
- this.dataStore.clear(this.STORE_KEY);
17809
- this.operationCounter = 0;
17883
+ getDefaultConfig() {
17884
+ return {
17885
+ maxHeight: '400px',
17886
+ placeholder: 'Escribe tu mensaje...',
17887
+ showTimestamps: true,
17888
+ showAvatars: true,
17889
+ showTypingIndicator: false,
17890
+ allowFileAttachments: false,
17891
+ allowEmojis: false,
17892
+ maxMessages: 100,
17893
+ readOnly: false,
17894
+ autoScroll: true,
17895
+ dateFormat: 'dd/MM/yyyy',
17896
+ timeFormat: 'HH:mm',
17897
+ groupByDate: false,
17898
+ theme: 'light'
17899
+ };
17810
17900
  }
17811
- getRecentOperations(limit = 10) {
17812
- const all = this.getOperationHistory();
17813
- return all.slice(-limit).reverse();
17901
+ mergeConfig(userConfig) {
17902
+ return { ...this.getDefaultConfig(), ...userConfig };
17814
17903
  }
17815
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, deps: [{ token: i0.RendererFactory2 }, { token: DataStoreService }], target: i0.ɵɵFactoryTarget.Injectable });
17816
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, providedIn: 'root' });
17904
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17905
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, providedIn: 'root' });
17817
17906
  }
17818
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CustomClassService, decorators: [{
17907
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: GenericChatService, decorators: [{
17819
17908
  type: Injectable,
17820
17909
  args: [{
17821
17910
  providedIn: 'root'
17822
17911
  }]
17823
- }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: DataStoreService }] });
17912
+ }], ctorParameters: () => [] });
17913
+
17914
+ class CoreUiTranslateService {
17915
+ translateService = inject(TranslateService);
17916
+ initialize(defaultLang = 'es', currentLang) {
17917
+ this.translateService.setDefaultLang(defaultLang);
17918
+ this.translateService.use(currentLang || defaultLang);
17919
+ }
17920
+ changeLanguage(lang) {
17921
+ return this.translateService.use(lang);
17922
+ }
17923
+ instant(key, params) {
17924
+ return this.translateService.instant(key, params);
17925
+ }
17926
+ get(key, params) {
17927
+ return this.translateService.get(key, params);
17928
+ }
17929
+ getMany(keys, params) {
17930
+ return this.translateService.get(keys, params);
17931
+ }
17932
+ getCurrentLang() {
17933
+ return this.translateService.currentLang;
17934
+ }
17935
+ getDefaultLang() {
17936
+ return this.translateService.getDefaultLang();
17937
+ }
17938
+ getTranslateService() {
17939
+ return this.translateService;
17940
+ }
17941
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
17942
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, providedIn: 'root' });
17943
+ }
17944
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: CoreUiTranslateService, decorators: [{
17945
+ type: Injectable,
17946
+ args: [{
17947
+ providedIn: 'root'
17948
+ }]
17949
+ }] });
17824
17950
 
17825
17951
  const PERMISSION_RESOURCES_PROVIDER = new InjectionToken('PERMISSION_RESOURCES_PROVIDER');
17826
17952
  const PERMISSION_ACTIONS_PROVIDER = new InjectionToken('PERMISSION_ACTIONS_PROVIDER');