-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Synced from the Blueshift Repository
- Loading branch information
Blueshift Staff
committed
Oct 3, 2024
1 parent
8138221
commit 187e4db
Showing
16 changed files
with
122 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
projects/ngx-grid-core/src/lib/events/row/row-double-clicked.event.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IGridRowComponent } from '../../typings/interfaces' | ||
import { BaseGridEventAbstract } from '../base-grid-event.abstract' | ||
import { GridEventsService } from '../grid-events.service' | ||
|
||
export class RowDoubleClickedEvent extends BaseGridEventAbstract<IGridRowComponent> { | ||
public readonly eventName = 'RowDoubleClickedEvent' | ||
constructor(eventService: GridEventsService) { super(eventService) } | ||
} |
4 changes: 4 additions & 0 deletions
4
projects/ngx-grid-core/src/lib/typings/interfaces/icon-cell-value.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface IIconCellValue { | ||
key: string | ||
size: number | ||
} |
49 changes: 49 additions & 0 deletions
49
projects/ngx-grid-core/src/lib/ui/cell/cell-types/icon.cell-type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { BehaviorSubject } from 'rxjs' | ||
|
||
import { GridControllerService } from '../../../controller/grid-controller.service' | ||
import { GridOverlayService } from '../../../services/grid-overlay-service.service' | ||
import { ECellMode } from '../../../typings/enums/cell-mode.enum' | ||
import { IGridCellComponent } from '../../../typings/interfaces' | ||
import { BaseCellType } from './abstractions/base-cell-type.abstract' | ||
import { IIconCellValue } from '../../../typings/interfaces/icon-cell-value.interface' | ||
|
||
export class IconCellType extends BaseCellType { | ||
|
||
public mode = new BehaviorSubject<ECellMode>(ECellMode.Readonly) | ||
|
||
private _displayNode?: HTMLElement | ||
|
||
constructor( | ||
gridController: GridControllerService, | ||
overlayService: GridOverlayService, | ||
parentCell : IGridCellComponent | ||
) { super(overlayService, parentCell, gridController) } | ||
|
||
public get displayNode() { return this._displayNode ?? this._generateDisplayNode() } | ||
public get editableNode() { return this.displayNode } | ||
|
||
public override receiveValue(value: IIconCellValue | null = this.value): void { | ||
super.receiveValue(value) | ||
if (!this._displayNode) return; | ||
else | ||
{ | ||
this._displayNode.innerText = value?.key ?? '' | ||
this._displayNode.style.fontSize = value?.size + 'px' | ||
} | ||
if (!value) this._displayNode.style.display = 'none' | ||
else this._displayNode.style.display = '' | ||
} | ||
|
||
private _generateDisplayNode(): HTMLElement { | ||
const node = document.createElement('span') | ||
node.classList.add(this.gridController.iconClass) | ||
this._displayNode = node | ||
this.receiveValue() | ||
return this._displayNode | ||
} | ||
|
||
public override measureWidth(): number { | ||
return this.value?.size ?? 0 | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
projects/ngx-grid-core/src/lib/ui/cell/cell-types/value-parsing/parsers/icon.parser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { IGridValueParsingResult } from '../../../../../typings/interfaces' | ||
import { BaseParser } from './base-parser.abstract' | ||
import { IParsingTest } from './parsing-test.interface' | ||
|
||
export class IconParser extends BaseParser implements IParsingTest { | ||
constructor (public readonly initialValue: any) { super() } | ||
|
||
public run(): IGridValueParsingResult<any[]> { | ||
const val = this.initialValue | ||
// IIconCellValue | ||
if (typeof val === 'object' && val !== null && !Array.isArray(val) && 'key' in val && 'size' in val && typeof val.size === 'number') { | ||
return this.passed(val) | ||
} | ||
return this.failed() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters