oasys-lib 2.33.0 → 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';
@@ -3454,9 +3454,7 @@ class OasysComboboxComponent {
3454
3454
  this.onChange(this.textValue());
3455
3455
  this.didChange.emit(this.selectedOption());
3456
3456
  this.onTouched();
3457
- if (this.type() === 'options') {
3458
- this.closePanel();
3459
- }
3457
+ this.closePanel();
3460
3458
  }
3461
3459
  /**
3462
3460
  * On Key Navigation
@@ -4181,6 +4179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4181
4179
  }] } });
4182
4180
 
4183
4181
  class OasysFormErrorsSummaryItemComponent {
4182
+ elementRef = inject(ElementRef);
4184
4183
  itemId = signal('errors-summary-item', ...(ngDevMode ? [{ debugName: "itemId" }] : []));
4185
4184
  abstractControl = input(...(ngDevMode ? [undefined, { debugName: "abstractControl" }] : []));
4186
4185
  error_messages = input({}, ...(ngDevMode ? [{ debugName: "error_messages" }] : []));
@@ -4193,16 +4192,38 @@ class OasysFormErrorsSummaryItemComponent {
4193
4192
  // Find the ui-text-input component with the matching ng-reflect-name
4194
4193
  const textInputComponent = document.querySelector(`ui-text-input[ng-reflect-name="${controlName}"]`);
4195
4194
  if (textInputComponent) {
4196
- // Find the input element inside the ui-text-input component
4197
4195
  const inputElement = textInputComponent.querySelector('input');
4198
4196
  if (inputElement) {
4199
4197
  inputElement.focus();
4200
4198
  inputElement.scrollIntoView({ behavior: 'smooth', block: 'center' });
4199
+ this.trapShiftTab(inputElement);
4201
4200
  }
4202
4201
  }
4203
4202
  }
4204
4203
  }
4205
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
+ }
4206
4227
  errorMessage = computed(() => {
4207
4228
  const currentErrors = this.abstractControl()?.errors;
4208
4229
  const messages = this.error_messages() ?? {};
@@ -4225,30 +4246,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4225
4246
 
4226
4247
  class OasysFormErrorsSummaryComponent {
4227
4248
  formGroup = input.required(...(ngDevMode ? [{ debugName: "formGroup" }] : []));
4228
- errorsSummaryItems;
4229
- hasErrorsSummaryItems = computed(() => this.errorsSummaryItems.length > 0, ...(ngDevMode ? [{ debugName: "hasErrorsSummaryItems" }] : []));
4230
- ngAfterContentInit() {
4231
- if (this.errorsSummaryItems.length === 0) {
4232
- console.error('ui-form-errors-summary: No ui-form-errors-summary-item components found. Please add at least one ui-form-errors-summary-item.');
4233
- }
4234
- this.errorsSummaryItems.forEach((item, index) => {
4235
- 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
+ });
4236
4260
  });
4237
4261
  }
4238
4262
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4239
- 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"] }] });
4240
4264
  }
4241
4265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryComponent, decorators: [{
4242
4266
  type: Component,
4243
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"] }]
4244
- }], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], errorsSummaryItems: [{
4245
- type: ContentChildren,
4246
- args: [OasysFormErrorsSummaryItemComponent]
4247
- }] } });
4268
+ }], ctorParameters: () => [], propDecorators: { formGroup: [{ type: i0.Input, args: [{ isSignal: true, alias: "formGroup", required: true }] }], errorsSummaryItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => OasysFormErrorsSummaryItemComponent), { isSignal: true }] }] } });
4248
4269
 
4249
4270
  class OasysFormErrorsSummaryTitleComponent {
4250
4271
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryTitleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4251
- 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 }] });
4252
4273
  }
4253
4274
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImport: i0, type: OasysFormErrorsSummaryTitleComponent, decorators: [{
4254
4275
  type: Component,
@@ -4258,8 +4279,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.21", ngImpo
4258
4279
  standalone: true,
4259
4280
  imports: [CommonModule],
4260
4281
  host: {
4261
- role: 'alert',
4262
- 'aria-live': 'polite',
4282
+ tabindex: '-1',
4263
4283
  },
4264
4284
  }]
4265
4285
  }] });