@quadrel-enterprise-ui/framework 21.8.0 → 21.8.1

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.
@@ -33246,7 +33246,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
33246
33246
  args: ['data-test-id']
33247
33247
  }] } });
33248
33248
 
33249
- // @ts-strict-ignore
33250
33249
  /**
33251
33250
  * The **QdPageTab** is a single tab inside the **QdPageTabs** within a **QdPage**.
33252
33251
  *
@@ -33263,25 +33262,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
33263
33262
  * description: The only place for a tab. The tabs component collects them and renders the selected one.
33264
33263
  */
33265
33264
  class QdPageTabComponent {
33266
- _pageTabs = inject(forwardRef(() => QdPageTabsComponent));
33267
33265
  /**
33268
- * Configuration of QdPageTabComponent.
33269
- *
33270
- * * @note The use of CDK attributes is not permitted. Please configure this component here.
33266
+ * Configuration of the tab: label, name, id, counters and disabled state.
33271
33267
  */
33272
33268
  config;
33273
- /** Form control for this tab. */
33274
- set tabControl(tabControl) {
33275
- this.stepControl = tabControl;
33276
- }
33269
+ /**
33270
+ * Form control of this tab. Drives the error state of the tab header and is
33271
+ * marked as touched on submit. Leave it out for tabs without a form.
33272
+ */
33277
33273
  get tabControl() {
33278
- return this.stepControl;
33274
+ return this._control;
33275
+ }
33276
+ set tabControl(tabControl) {
33277
+ this._control = tabControl;
33279
33278
  }
33279
+ /**
33280
+ * The `qd-page-info-banner` elements projected into this tab.
33281
+ * They render above the tab content while the tab is selected.
33282
+ */
33280
33283
  infoBanners;
33284
+ /**
33285
+ * Template with the projected tab content. QdPageTabs renders it for the selected tab.
33286
+ */
33281
33287
  content;
33282
- stepControl;
33283
33288
  interacted = false;
33284
33289
  editable = true;
33290
+ _pageTabs = inject(forwardRef(() => QdPageTabsComponent));
33291
+ _destroyRef = inject(DestroyRef);
33292
+ _control;
33285
33293
  get completed() {
33286
33294
  if (!this.interacted)
33287
33295
  return false;
@@ -33293,53 +33301,45 @@ class QdPageTabComponent {
33293
33301
  get hasError() {
33294
33302
  return this.interacted && !!this.tabControl?.invalid;
33295
33303
  }
33296
- _destroyed$ = new Subject();
33297
- select() {
33298
- const index = this._pageTabs.tabs.toArray().indexOf(this);
33299
- if (index >= 0)
33300
- this._pageTabs.selectedIndex = index;
33301
- }
33302
33304
  ngOnInit() {
33303
33305
  this.validateLabel();
33304
33306
  if (this.tabControl)
33305
33307
  this.initErrorCheck();
33306
33308
  }
33307
- ngOnChanges(changes) {
33308
- ['label', 'errorMessage', 'state']
33309
- .filter(inputName => !!changes[inputName])
33310
- .forEach(inputName => this.blockCdkInput(inputName));
33311
- }
33312
- ngOnDestroy() {
33313
- this._destroyed$.complete();
33314
- }
33315
- blockCdkInput(inputName) {
33316
- throw new Error(`Quadrel Framework | QdPageTab - The use of the "${inputName}" attribute is not permitted. Please use QdPageTabConfig instead.`);
33309
+ /**
33310
+ * Selects this tab in the surrounding QdPageTabs.
33311
+ */
33312
+ select() {
33313
+ const index = this._pageTabs.tabs.toArray().indexOf(this);
33314
+ if (index >= 0)
33315
+ this._pageTabs.selectedIndex = index;
33317
33316
  }
33318
33317
  validateLabel() {
33319
33318
  if (!this.config?.label?.i18n)
33320
33319
  console.error('Quadrel Framework | QdPageTab - Please provide a label for the tab.');
33321
33320
  }
33322
33321
  initErrorCheck() {
33323
- this.tabControl.statusChanges.pipe(takeUntil$1(this._destroyed$)).subscribe(() => {
33324
- if (this.hasAnyError(this.tabControl)) {
33325
- this.interacted = true;
33326
- }
33322
+ this.markInteractedOnError();
33323
+ this.tabControl.statusChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
33324
+ this.markInteractedOnError();
33327
33325
  this._pageTabs._stateChanged();
33328
33326
  });
33329
33327
  }
33328
+ markInteractedOnError() {
33329
+ if (this.hasAnyError(this.tabControl))
33330
+ this.interacted = true;
33331
+ }
33330
33332
  hasAnyError(control) {
33331
33333
  if (control.errors && control.touched)
33332
33334
  return true;
33333
- if (control instanceof FormGroup) {
33334
- return Object.values(control.controls).some(control => this.hasAnyError(control));
33335
- }
33336
- if (control instanceof FormArray) {
33337
- return control.controls.some(control => this.hasAnyError(control));
33338
- }
33335
+ if (control instanceof FormGroup)
33336
+ return Object.values(control.controls).some(child => this.hasAnyError(child));
33337
+ if (control instanceof FormArray)
33338
+ return control.controls.some(child => this.hasAnyError(child));
33339
33339
  return false;
33340
33340
  }
33341
33341
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
33342
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageTabComponent, isStandalone: true, selector: "qd-page-tab", inputs: { config: "config", tabControl: "tabControl" }, queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template>\n <div class=\"page-info-banners\">\n <ng-content select=\"qd-page-info-banner\"></ng-content>\n </div>\n\n <ng-content></ng-content>\n</ng-template>\n", styles: [".page-info-banners:has(>qd-page-info-banner:not(.qd-page-info-banner-empty)){padding:1rem 1.25rem .5rem;border-bottom:rgb(213,213,213) solid .0625rem;background-color:#fff}.page-info-banners>qd-page-info-banner:last-child{margin-bottom:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
33342
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageTabComponent, isStandalone: true, selector: "qd-page-tab", inputs: { config: "config", tabControl: "tabControl" }, queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: "<ng-template>\n <div class=\"page-info-banners\">\n <ng-content select=\"qd-page-info-banner\"></ng-content>\n </div>\n\n <ng-content></ng-content>\n</ng-template>\n", styles: [".page-info-banners:has(>qd-page-info-banner:not(.qd-page-info-banner-empty)){padding:1rem 1.25rem .5rem;border-bottom:rgb(213,213,213) solid .0625rem;background-color:#fff}.page-info-banners>qd-page-info-banner:last-child{margin-bottom:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
33343
33343
  }
33344
33344
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageTabComponent, decorators: [{
33345
33345
  type: Component,