|
1 | | -import { ChangeDetectionStrategy, Component } from '@angular/core'; |
| 1 | +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; |
2 | 2 |
|
3 | 3 | import { defineCustomElement } from '@cg/ui/dist/components/cg-icon-btn'; |
4 | | -import { DefineCustomElement } from '../../define-custom-element'; |
| 4 | +import { defineCustomElementComponent } from '../../custom-element-component'; |
| 5 | + |
| 6 | +type CustomElement = HTMLCgIconBtnElement; |
5 | 7 |
|
6 | | -@DefineCustomElement(defineCustomElement) |
7 | 8 | @Component({ |
8 | 9 | selector: 'cg-icon-btn', |
9 | 10 | changeDetection: ChangeDetectionStrategy.OnPush, |
10 | 11 | template: `<ng-content />`, |
11 | 12 | }) |
12 | | -export class IconBtnComponent {} |
| 13 | +export class IconBtnComponent extends defineCustomElementComponent<CustomElement>( |
| 14 | + defineCustomElement, |
| 15 | +) { |
| 16 | + public readonly type = input<CustomElement['type']>('button'); |
| 17 | + public readonly disabled = input<CustomElement['disabled']>(false); |
| 18 | + public readonly ariaLabel = input.required<CustomElement['ariaLabel']>(); |
| 19 | + public readonly ariaHasPopup = input<CustomElement['ariaHasPopup']>(); |
| 20 | + public readonly ariaExpanded = input<CustomElement['ariaExpanded']>(); |
| 21 | + public readonly ariaControls = input<CustomElement['ariaControls']>(); |
| 22 | + |
| 23 | + constructor() { |
| 24 | + super(); |
| 25 | + |
| 26 | + this.elemProxyEffect(this.type, 'type'); |
| 27 | + this.elemProxyEffect(this.disabled, 'disabled'); |
| 28 | + this.elemProxyEffect(this.ariaLabel, 'ariaLabel'); |
| 29 | + this.elemProxyEffect(this.ariaHasPopup, 'ariaHasPopup'); |
| 30 | + this.elemProxyEffect(this.ariaExpanded, 'ariaExpanded'); |
| 31 | + this.elemProxyEffect(this.ariaControls, 'ariaControls'); |
| 32 | + } |
| 33 | +} |
0 commit comments