|
| 1 | +/* tslint:disable:max-line-length */ |
| 2 | + |
| 3 | + |
| 4 | +import { |
| 5 | + Component, |
| 6 | + NgModule, |
| 7 | + Host, |
| 8 | + SkipSelf, |
| 9 | + Input |
| 10 | +} from '@angular/core'; |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +import { dxButtonOptions } from 'devextreme/ui/button'; |
| 16 | +import { HorizontalAlignment, VerticalAlignment } from 'devextreme/common'; |
| 17 | +import { FormItemType, FormPredefinedButtonItem } from 'devextreme/ui/form'; |
| 18 | + |
| 19 | +import { |
| 20 | + DxIntegrationModule, |
| 21 | + NestedOptionHost, |
| 22 | +} from 'devextreme-angular/core'; |
| 23 | +import { CollectionNestedOption } from 'devextreme-angular/core'; |
| 24 | + |
| 25 | +import { PROPERTY_TOKEN_items } from 'devextreme-angular/core/tokens'; |
| 26 | + |
| 27 | +@Component({ |
| 28 | + selector: 'dxi-data-grid-button-item', |
| 29 | + standalone: true, |
| 30 | + template: '', |
| 31 | + styles: [''], |
| 32 | + imports: [ DxIntegrationModule ], |
| 33 | + providers: [ |
| 34 | + NestedOptionHost, |
| 35 | + { |
| 36 | + provide: PROPERTY_TOKEN_items, |
| 37 | + useExisting: DxiDataGridButtonItemComponent, |
| 38 | + } |
| 39 | + ] |
| 40 | +}) |
| 41 | +export class DxiDataGridButtonItemComponent extends CollectionNestedOption { |
| 42 | + @Input() |
| 43 | + get buttonOptions(): dxButtonOptions | undefined { |
| 44 | + return this._getOption('buttonOptions'); |
| 45 | + } |
| 46 | + set buttonOptions(value: dxButtonOptions | undefined) { |
| 47 | + this._setOption('buttonOptions', value); |
| 48 | + } |
| 49 | + |
| 50 | + @Input() |
| 51 | + get colSpan(): number | undefined { |
| 52 | + return this._getOption('colSpan'); |
| 53 | + } |
| 54 | + set colSpan(value: number | undefined) { |
| 55 | + this._setOption('colSpan', value); |
| 56 | + } |
| 57 | + |
| 58 | + @Input() |
| 59 | + get cssClass(): string | undefined { |
| 60 | + return this._getOption('cssClass'); |
| 61 | + } |
| 62 | + set cssClass(value: string | undefined) { |
| 63 | + this._setOption('cssClass', value); |
| 64 | + } |
| 65 | + |
| 66 | + @Input() |
| 67 | + get horizontalAlignment(): HorizontalAlignment { |
| 68 | + return this._getOption('horizontalAlignment'); |
| 69 | + } |
| 70 | + set horizontalAlignment(value: HorizontalAlignment) { |
| 71 | + this._setOption('horizontalAlignment', value); |
| 72 | + } |
| 73 | + |
| 74 | + @Input() |
| 75 | + get itemType(): FormItemType { |
| 76 | + return this._getOption('itemType'); |
| 77 | + } |
| 78 | + set itemType(value: FormItemType) { |
| 79 | + this._setOption('itemType', value); |
| 80 | + } |
| 81 | + |
| 82 | + @Input() |
| 83 | + get name(): FormPredefinedButtonItem | string | undefined { |
| 84 | + return this._getOption('name'); |
| 85 | + } |
| 86 | + set name(value: FormPredefinedButtonItem | string | undefined) { |
| 87 | + this._setOption('name', value); |
| 88 | + } |
| 89 | + |
| 90 | + @Input() |
| 91 | + get verticalAlignment(): VerticalAlignment { |
| 92 | + return this._getOption('verticalAlignment'); |
| 93 | + } |
| 94 | + set verticalAlignment(value: VerticalAlignment) { |
| 95 | + this._setOption('verticalAlignment', value); |
| 96 | + } |
| 97 | + |
| 98 | + @Input() |
| 99 | + get visible(): boolean { |
| 100 | + return this._getOption('visible'); |
| 101 | + } |
| 102 | + set visible(value: boolean) { |
| 103 | + this._setOption('visible', value); |
| 104 | + } |
| 105 | + |
| 106 | + @Input() |
| 107 | + get visibleIndex(): number | undefined { |
| 108 | + return this._getOption('visibleIndex'); |
| 109 | + } |
| 110 | + set visibleIndex(value: number | undefined) { |
| 111 | + this._setOption('visibleIndex', value); |
| 112 | + } |
| 113 | + |
| 114 | + |
| 115 | + protected get _optionPath() { |
| 116 | + return 'items'; |
| 117 | + } |
| 118 | + |
| 119 | + |
| 120 | + constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost, |
| 121 | + @Host() optionHost: NestedOptionHost) { |
| 122 | + super(); |
| 123 | + parentOptionHost.setNestedOption(this); |
| 124 | + optionHost.setHost(this, this._fullOptionPath.bind(this)); |
| 125 | + this.itemType = 'button'; |
| 126 | + |
| 127 | + } |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + ngOnDestroy() { |
| 132 | + this._deleteRemovedOptions(this._fullOptionPath()); |
| 133 | + } |
| 134 | + |
| 135 | +} |
| 136 | + |
| 137 | +@NgModule({ |
| 138 | + imports: [ |
| 139 | + DxiDataGridButtonItemComponent |
| 140 | + ], |
| 141 | + exports: [ |
| 142 | + DxiDataGridButtonItemComponent |
| 143 | + ], |
| 144 | +}) |
| 145 | +export class DxiDataGridButtonItemModule { } |
0 commit comments