UNPKG

@progress/kendo-angular-pivotgrid

Version:
54 lines (53 loc) 2.77 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { EventEmitter, Injectable, Output } from '@angular/core'; import { configuratorReducer } from '@progress/kendo-pivotgrid-common'; import { PivotGridDataService } from '../data-binding/pivotgrid-data.service'; import { PivotGridState } from './../models/configurator-settings'; import * as i0 from "@angular/core"; import * as i1 from "../data-binding/pivotgrid-data.service"; /** * @hidden */ export class ConfiguratorService { dataService; configuratorInstance; state; draggedElement; dropTargetElement; cueContainer; orientation; configuratorStateChange = new EventEmitter(); closeMenu = new EventEmitter(); constructor(dataService) { this.dataService = dataService; } parseConfiguratorState(action) { const newState = configuratorReducer({ filter: this.dataService.state.filter, sort: this.dataService.state.sort, rowAxes: this.dataService.state.rowAxes, columnAxes: this.dataService.state.columnAxes, measureAxes: this.dataService.state.measureAxes, dragItem: this.state.dragItem, dropDirection: this.state.dropDirection, dropTarget: this.state.dropTarget, dropZone: this.state.dropZone }, action); Object.keys(newState).forEach(key => newState[key] === undefined && delete newState[key]); this.state = { ...this.state, ...newState }; this.dataService.state = new PivotGridState(this.state.columnAxes, this.state.rowAxes, this.state.measureAxes, this.state.sort, this.state.filter); this.configuratorStateChange.emit(this.state); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfiguratorService, deps: [{ token: i1.PivotGridDataService }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfiguratorService }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ConfiguratorService, decorators: [{ type: Injectable }], ctorParameters: function () { return [{ type: i1.PivotGridDataService }]; }, propDecorators: { configuratorStateChange: [{ type: Output }], closeMenu: [{ type: Output }] } });