oasys-lib 2.33.1 → 2.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Directive, Injectable, DOCUMENT, Inject, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, InjectionToken, HostListener, input, output, viewChild, signal, computed, EventEmitter, ViewChild, ContentChild, Output, NgModule, HostBinding, model, forwardRef, CUSTOM_ELEMENTS_SCHEMA, viewChildren, ContentChildren } from '@angular/core';
2
+ import { inject, ElementRef, Directive, Injectable, DOCUMENT, Inject, Input, ChangeDetectionStrategy, ViewEncapsulation, Component, InjectionToken, HostListener, input, output, viewChild, signal, computed, EventEmitter, ViewChild, ContentChild, Output, NgModule, HostBinding, model, forwardRef, CUSTOM_ELEMENTS_SCHEMA, viewChildren, ContentChildren, contentChildren, effect } from '@angular/core';
3
3
  import { BehaviorSubject, Subject, Observable } from 'rxjs';
4
4
  import { takeUntil, take, map } from 'rxjs/operators';
5
5
  import * as i1 from '@angular/cdk/layout';
@@ -4179,6 +4179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4179
4179
  }] } });
4180
4180
 
4181
4181
  class OasysFormErrorsSummaryItemComponent {
4182
+ elementRef = inject(ElementRef);
4182
4183
  itemId = signal('errors-summary-item', ...(ngDevMode ? [{ debugName: "itemId" }] : []));
4183
4184
  abstractControl = input(...(ngDevMode ? [undefined, { debugName: "abstractControl" }] : []));
4184
4185
  error_messages = input({}, ...(ngDevMode ? [{ debugName: "error_messages" }] : []));
@@ -4191,16 +4192,38 @@ class OasysFormErrorsSummaryItemComponent {
4191
4192
  // Find the ui-text-input component with the matching ng-reflect-name
4192
4193
  const textInputComponent = document.querySelector(`ui-text-input[ng-reflect-name="${controlName}"]`);
4193
4194
  if (textInputComponent) {
4194
- // Find the input element inside the ui-text-input component
4195
4195
  const inputElement = textInputComponent.querySelector('input');
4196
4196
  if (inputElement) {
4197
4197
  inputElement.focus();
4198
4198
  inputElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
4199
+ this.trapShiftTab(inputElement);
4199
4200
  }
4200
4201
  }
4201
4202
  }
4202
4203
  }
4203
4204
  }
4205
+ trapShiftTab(inputElement) {
4206
+ const liElement = this.elementRef.nativeElement.querySelector('li');
4207
+ if (!liElement)
4208
+ return;
4209
+ let cleaned = false;
4210
+ const cleanup = () => {
4211
+ if (cleaned)
4212
+ return;
4213
+ cleaned = true;
4214
+ inputElement.removeEventListener('keydown', onShiftTab);
4215
+ inputElement.removeEventListener('blur', cleanup);
4216
+ };
4217
+ const onShiftTab = (event) => {
4218
+ if (event.key === 'Tab' && event.shiftKey) {
4219
+ event.preventDefault();
4220
+ liElement.focus();
4221
+ cleanup();
4222
+ }
4223
+ };
4224
+ inputElement.addEventListener('keydown', onShiftTab);
4225
+ inputElement.addEventListener('blur', cleanup);
4226
+ }
4204
4227
  errorMessage = computed(() => {
4205
4228
  const currentErrors = this.abstractControl()?.errors;
4206
4229
  const messages = this.error_messages() ?? {};
@@ -4223,30 +4246,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4223
4246
 
4224
4247
  class OasysFormErrorsSummaryComponent {
4225
4248
  formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : []));
4226
- errorsSummaryItems;
4227
- hasErrorsSummaryItems = computed(() => this.errorsSummaryItems.length > 0, ...(ngDevMode ? [{ debugName: "hasErrorsSummaryItems" }] : []));
4228
- ngAfterContentInit() {
4229
- if (this.errorsSummaryItems.length === 0) {
4230
- console.error('ui-form-errors-summary: No ui-form-errors-summary-item components found. Please add at least one ui-form-errors-summary-item.');
4231
- }
4232
- this.errorsSummaryItems.forEach((item, index) => {
4233
- item.itemId.set(`errors-summary-item-${index}`);
4249
+ errorsSummaryItems = contentChildren(OasysFormErrorsSummaryItemComponent, ...(ngDevMode ? [{ debugName: "errorsSummaryItems" }] : []));
4250
+ hasErrorsSummaryItems = computed(() => this.errorsSummaryItems().length > 0, ...(ngDevMode ? [{ debugName: "hasErrorsSummaryItems" }] : []));
4251
+ constructor() {
4252
+ effect(() => {
4253
+ const items = this.errorsSummaryItems();
4254
+ if (items.length === 0) {
4255
+ console.error('ui-form-errors-summary: No ui-form-errors-summary-item components found. Please add at least one ui-form-errors-summary-item.');
4256
+ }
4257
+ items.forEach((item, index) => {
4258
+ item.itemId.set(`errors-summary-item-${index}`);
4259
+ });
4234
4260
  });
4235
4261
  }
4236
4262
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4237
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: OasysFormErrorsSummaryComponent, isStandalone: true, selector: "ui-form-errors-summary", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null } }, queries: [{ propertyName: "errorsSummaryItems", predicate: OasysFormErrorsSummaryItemComponent }], ngImport: i0, template: "<div #errorsSummary>\n @if (!formGroup().valid && hasErrorsSummaryItems()) {\n <ui-box class=\"ui-form-errors-summary\" box_space=\"near\" box_align_x=\"center\">\n <ui-stack stack_direction=\"x\" stack_gap=\"near\">\n <div class=\"badge\">\n <ui-icon icon_name=\"error\" icon_size_override=\"2\"></ui-icon>\n </div>\n\n <ui-stack stack_gap=\"near\">\n <ui-stack stack_gap=\"tight\" class=\"content\" stack_direction=\"y\">\n <div class=\"text-label--secondary\" id=\"errors-summary-title\">\n <ng-content select=\"ui-form-errors-summary-title\"></ng-content>\n </div>\n <ul>\n <ng-content></ng-content>\n </ul>\n </ui-stack>\n </ui-stack>\n </ui-stack>\n </ui-box>\n }\n</div>\n", styles: [":host{display:contents}.ui-form-errors-summary{margin-bottom:var(--oasys-spacing-near);background-color:var(--oasys-color-system-background-negative)}.ui-form-errors-summary .badge{padding:2px;border-radius:9999px;color:var(--oasys-color-brand-foreground-primary-on-dark);background-color:var(--oasys-color-system-foreground-negative)}.ui-form-errors-summary .badge ui-icon{fill:currentColor}.ui-form-errors-summary .content{gap:var(--oasys-spacing-tiny)}.ui-form-errors-summary ul{margin:0}\n"], dependencies: [{ kind: "component", type: LayoutBoxComponent, selector: "ui-box", inputs: ["box_space", "box_role", "box_space_top", "box_space_right", "box_space_bottom", "box_space_left", "box_align_x", "box_align_y", "box_fill_mode", "box_background", "box_content_fill_width", "box_border_color", "box_border_width", "box_border_style", "box_border_radius"] }, { kind: "component", type: LayoutStackComponent, selector: "ui-stack", inputs: ["stack_gap", "stack_align", "stack_direction", "stack_distribute", "stack_wrap", "stack_collapse_below", "stack_as_list"] }, { kind: "component", type: IconComponent, selector: "ui-icon", inputs: ["icon_size", "icon_size_override", "icon_name", "icon_context", "alt_text", "icon_class"] }] });
4263
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.21", type: OasysFormErrorsSummaryComponent, isStandalone: true, selector: "ui-form-errors-summary", inputs: { formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null } }, queries: [{ propertyName: "errorsSummaryItems", predicate: OasysFormErrorsSummaryItemComponent, isSignal: true }], ngImport: i0, template: "<div #errorsSummary>\n @if (!formGroup().valid && hasErrorsSummaryItems()) {\n <ui-box class=\"ui-form-errors-summary\" box_space=\"near\" box_align_x=\"center\">\n <ui-stack stack_direction=\"x\" stack_gap=\"near\">\n <div class=\"badge\">\n <ui-icon icon_name=\"error\" icon_size_override=\"2\"></ui-icon>\n </div>\n\n <ui-stack stack_gap=\"near\">\n <ui-stack stack_gap=\"tight\" class=\"content\" stack_direction=\"y\">\n <div class=\"text-label--secondary\" id=\"errors-summary-title\">\n <ng-content select=\"ui-form-errors-summary-title\"></ng-content>\n </div>\n <ul>\n <ng-content></ng-content>\n </ul>\n </ui-stack>\n </ui-stack>\n </ui-stack>\n </ui-box>\n }\n</div>\n", styles: [":host{display:contents}.ui-form-errors-summary{margin-bottom:var(--oasys-spacing-near);background-color:var(--oasys-color-system-background-negative)}.ui-form-errors-summary .badge{padding:2px;border-radius:9999px;color:var(--oasys-color-brand-foreground-primary-on-dark);background-color:var(--oasys-color-system-foreground-negative)}.ui-form-errors-summary .badge ui-icon{fill:currentColor}.ui-form-errors-summary .content{gap:var(--oasys-spacing-tiny)}.ui-form-errors-summary ul{margin:0}\n"], dependencies: [{ kind: "component", type: LayoutBoxComponent, selector: "ui-box", inputs: ["box_space", "box_role", "box_space_top", "box_space_right", "box_space_bottom", "box_space_left", "box_align_x", "box_align_y", "box_fill_mode", "box_background", "box_content_fill_width", "box_border_color", "box_border_width", "box_border_style", "box_border_radius"] }, { kind: "component", type: LayoutStackComponent, selector: "ui-stack", inputs: ["stack_gap", "stack_align", "stack_direction", "stack_distribute", "stack_wrap", "stack_collapse_below", "stack_as_list"] }, { kind: "component", type: IconComponent, selector: "ui-icon", inputs: ["icon_size", "icon_size_override", "icon_name", "icon_context", "alt_text", "icon_class"] }] });
4238
4264
  }
4239
4265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryComponent, decorators: [{
4240
4266
  type: Component,
4241
4267
  args: [{ selector: 'ui-form-errors-summary', standalone: true, imports: [LayoutBoxComponent, LayoutStackComponent, IconComponent], template: "<div #errorsSummary>\n @if (!formGroup().valid && hasErrorsSummaryItems()) {\n <ui-box class=\"ui-form-errors-summary\" box_space=\"near\" box_align_x=\"center\">\n <ui-stack stack_direction=\"x\" stack_gap=\"near\">\n <div class=\"badge\">\n <ui-icon icon_name=\"error\" icon_size_override=\"2\"></ui-icon>\n </div>\n\n <ui-stack stack_gap=\"near\">\n <ui-stack stack_gap=\"tight\" class=\"content\" stack_direction=\"y\">\n <div class=\"text-label--secondary\" id=\"errors-summary-title\">\n <ng-content select=\"ui-form-errors-summary-title\"></ng-content>\n </div>\n <ul>\n <ng-content></ng-content>\n </ul>\n </ui-stack>\n </ui-stack>\n </ui-stack>\n </ui-box>\n }\n</div>\n", styles: [":host{display:contents}.ui-form-errors-summary{margin-bottom:var(--oasys-spacing-near);background-color:var(--oasys-color-system-background-negative)}.ui-form-errors-summary .badge{padding:2px;border-radius:9999px;color:var(--oasys-color-brand-foreground-primary-on-dark);background-color:var(--oasys-color-system-foreground-negative)}.ui-form-errors-summary .badge ui-icon{fill:currentColor}.ui-form-errors-summary .content{gap:var(--oasys-spacing-tiny)}.ui-form-errors-summary ul{margin:0}\n"] }]
4242
- }], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], errorsSummaryItems: [{
4243
- type: ContentChildren,
4244
- args: [OasysFormErrorsSummaryItemComponent]
4245
- }] } });
4268
+ }], ctorParameters: () => [], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], errorsSummaryItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OasysFormErrorsSummaryItemComponent), { isSignal: true }] }] } });
4246
4269
 
4247
4270
  class OasysFormErrorsSummaryTitleComponent {
4248
4271
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4249
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.21", type: OasysFormErrorsSummaryTitleComponent, isStandalone: true, selector: "ui-form-errors-summary-title", host: { attributes: { "role": "alert", "aria-live": "polite" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4272
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.21", type: OasysFormErrorsSummaryTitleComponent, isStandalone: true, selector: "ui-form-errors-summary-title", host: { attributes: { "tabindex": "-1" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }] });
4250
4273
  }
4251
4274
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryTitleComponent, decorators: [{
4252
4275
  type: Component,
@@ -4256,8 +4279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4256
4279
  standalone: true,
4257
4280
  imports: [CommonModule],
4258
4281
  host: {
4259
- role: 'alert',
4260
- 'aria-live': 'polite',
4282
+ tabindex: '-1',
4261
4283
  },
4262
4284
  }]
4263
4285
  }] });