/*! * devextreme-angular-test * Version: 17.2.8 * Build date: Mon Feb 05 2018 * * Copyright (c) 2012 - 2018 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-angular */ import { Component, NgModule, ElementRef, NgZone, Input, Output, OnDestroy, Injector, EventEmitter, OnChanges, DoCheck, SimpleChanges } from '@angular/core'; import DevExpress from 'devextreme/bundles/dx.all'; import DxPivotGrid from 'devextreme/ui/pivot_grid'; import { DxComponent } from '../core/component'; import { DxTemplateHost } from '../core/template-host'; import { DxTemplateModule } from '../core/template'; import { EventsRegistrator } from '../core/events-strategy'; import { NestedOptionHost } from '../core/nested-option'; import { WatcherHelper } from '../core/watcher-helper'; import { IterableDifferHelper } from '../core/iterable-differ-helper'; import { DxoDataSourceModule } from './nested/data-source'; import { DxiFieldModule } from './nested/field-dxi'; import { DxoFormatModule } from './nested/format'; import { DxoHeaderFilterModule } from './nested/header-filter'; import { DxoStoreModule } from './nested/store'; import { DxoExportModule } from './nested/export'; import { DxoFieldChooserModule } from './nested/field-chooser'; import { DxoTextsModule } from './nested/texts'; import { DxoFieldPanelModule } from './nested/field-panel'; import { DxoLoadPanelModule } from './nested/load-panel'; import { DxoScrollingModule } from './nested/scrolling'; import { DxoStateStoringModule } from './nested/state-storing'; /** * The PivotGrid is a widget that allows you to display and analyze multi-dimensional data from a local storage or an OLAP cube. */ @Component({ selector: 'dx-pivot-grid', template: '', providers: [ DxTemplateHost, WatcherHelper, NestedOptionHost, IterableDifferHelper ] }) export class DxPivotGridComponent extends DxComponent implements OnDestroy, OnChanges, DoCheck { instance: DxPivotGrid; /** * Allows an end-user to expand/collapse all header items within a header level. */ @Input() get allowExpandAll(): boolean { return this._getOption('allowExpandAll'); } set allowExpandAll(value: boolean) { this._setOption('allowExpandAll', value); } /** * Allows a user to filter fields by selecting or deselecting values in the popup menu. */ @Input() get allowFiltering(): boolean { return this._getOption('allowFiltering'); } set allowFiltering(value: boolean) { this._setOption('allowFiltering', value); } /** * Allows an end-user to change sorting options. */ @Input() get allowSorting(): boolean { return this._getOption('allowSorting'); } set allowSorting(value: boolean) { this._setOption('allowSorting', value); } /** * Allows an end-user to sort columns by summary values. */ @Input() get allowSortingBySummary(): boolean { return this._getOption('allowSortingBySummary'); } set allowSortingBySummary(value: boolean) { this._setOption('allowSortingBySummary', value); } /** * Specifies the area to which data field headers must belong. */ @Input() get dataFieldArea(): string { return this._getOption('dataFieldArea'); } set dataFieldArea(value: string) { this._setOption('dataFieldArea', value); } /** * Specifies a data source for the pivot grid. */ @Input() get dataSource(): DevExpress.data.PivotGridDataSource| DevExpress.data.PivotGridDataSourceOptions| Array { return this._getOption('dataSource'); } set dataSource(value: DevExpress.data.PivotGridDataSource| DevExpress.data.PivotGridDataSourceOptions| Array) { this._setOption('dataSource', value); } /** * Specifies whether the widget responds to user interaction. */ @Input() get disabled(): boolean { return this._getOption('disabled'); } set disabled(value: boolean) { this._setOption('disabled', value); } /** * Specifies the attributes to be attached to the widget's root element. */ @Input() get elementAttr(): any { return this._getOption('elementAttr'); } set elementAttr(value: any) { this._setOption('elementAttr', value); } /** * Configures client-side exporting. */ @Input() get export(): any { return this._getOption('export'); } set export(value: any) { this._setOption('export', value); } /** * The Field Chooser configuration options. */ @Input() get fieldChooser(): any { return this._getOption('fieldChooser'); } set fieldChooser(value: any) { this._setOption('fieldChooser', value); } /** * Configures the field panel. */ @Input() get fieldPanel(): any { return this._getOption('fieldPanel'); } set fieldPanel(value: any) { this._setOption('fieldPanel', value); } /** * Configures the header filter feature. */ @Input() get headerFilter(): any { return this._getOption('headerFilter'); } set headerFilter(value: any) { this._setOption('headerFilter', value); } /** * Specifies the widget's height. */ @Input() get height(): number| Function| string { return this._getOption('height'); } set height(value: number| Function| string) { this._setOption('height', value); } /** * Specifies whether or not to hide rows and columns with no data. */ @Input() get hideEmptySummaryCells(): boolean { return this._getOption('hideEmptySummaryCells'); } set hideEmptySummaryCells(value: boolean) { this._setOption('hideEmptySummaryCells', value); } /** * Specifies text for a hint that appears when a user pauses on the widget. */ @Input() get hint(): string { return this._getOption('hint'); } set hint(value: string) { this._setOption('hint', value); } /** * Specifies options configuring the load panel. */ @Input() get loadPanel(): any { return this._getOption('loadPanel'); } set loadPanel(value: any) { this._setOption('loadPanel', value); } /** * Specifies the layout of items in the row header. */ @Input() get rowHeaderLayout(): string { return this._getOption('rowHeaderLayout'); } set rowHeaderLayout(value: string) { this._setOption('rowHeaderLayout', value); } /** * Switches the widget to a right-to-left representation. */ @Input() get rtlEnabled(): boolean { return this._getOption('rtlEnabled'); } set rtlEnabled(value: boolean) { this._setOption('rtlEnabled', value); } /** * A configuration object specifying scrolling options. */ @Input() get scrolling(): any { return this._getOption('scrolling'); } set scrolling(value: any) { this._setOption('scrolling', value); } /** * Specifies whether the outer borders of the grid are visible or not. */ @Input() get showBorders(): boolean { return this._getOption('showBorders'); } set showBorders(value: boolean) { this._setOption('showBorders', value); } /** * Specifies whether to display the Grand Total column. */ @Input() get showColumnGrandTotals(): boolean { return this._getOption('showColumnGrandTotals'); } set showColumnGrandTotals(value: boolean) { this._setOption('showColumnGrandTotals', value); } /** * Specifies whether to display the Total columns. */ @Input() get showColumnTotals(): boolean { return this._getOption('showColumnTotals'); } set showColumnTotals(value: boolean) { this._setOption('showColumnTotals', value); } /** * Specifies whether to display the Grand Total row. */ @Input() get showRowGrandTotals(): boolean { return this._getOption('showRowGrandTotals'); } set showRowGrandTotals(value: boolean) { this._setOption('showRowGrandTotals', value); } /** * Specifies whether to display the Total rows. Applies only if rowHeaderLayout is "standard". */ @Input() get showRowTotals(): boolean { return this._getOption('showRowTotals'); } set showRowTotals(value: boolean) { this._setOption('showRowTotals', value); } /** * Specifies where to show the total rows or columns. Applies only if rowHeaderLayout is "standard". */ @Input() get showTotalsPrior(): string { return this._getOption('showTotalsPrior'); } set showTotalsPrior(value: string) { this._setOption('showTotalsPrior', value); } /** * A configuration object specifying options related to state storing. */ @Input() get stateStoring(): any { return this._getOption('stateStoring'); } set stateStoring(value: any) { this._setOption('stateStoring', value); } /** * Specifies the number of the element when the Tab key is used for navigating. */ @Input() get tabIndex(): number { return this._getOption('tabIndex'); } set tabIndex(value: number) { this._setOption('tabIndex', value); } /** * Strings that can be changed or localized in the PivotGrid widget. */ @Input() get texts(): any { return this._getOption('texts'); } set texts(value: any) { this._setOption('texts', value); } @Input() get useNativeScrolling(): boolean| string { return this._getOption('useNativeScrolling'); } set useNativeScrolling(value: boolean| string) { this._setOption('useNativeScrolling', value); } /** * Specifies whether the widget is visible. */ @Input() get visible(): boolean { return this._getOption('visible'); } set visible(value: boolean) { this._setOption('visible', value); } /** * Specifies the widget's width. */ @Input() get width(): number| Function| string { return this._getOption('width'); } set width(value: number| Function| string) { this._setOption('width', value); } /** * Specifies whether long text in header items should be wrapped. */ @Input() get wordWrapEnabled(): boolean { return this._getOption('wordWrapEnabled'); } set wordWrapEnabled(value: boolean) { this._setOption('wordWrapEnabled', value); } /** * A handler for the cellClick event. */ @Output() onCellClick: EventEmitter; /** * A handler for the cellPrepared event. */ @Output() onCellPrepared: EventEmitter; /** * A handler for the contentReady event. Executed when the widget's content is ready. This handler may be executed multiple times during the widget's lifetime depending on the number of times its content changes. */ @Output() onContentReady: EventEmitter; /** * A handler for the contextMenuPreparing event. */ @Output() onContextMenuPreparing: EventEmitter; /** * A handler for the disposing event. Executed when the widget is removed from the DOM using the remove(), empty(), or html() jQuery methods only. */ @Output() onDisposing: EventEmitter; /** * A handler for the exported event. */ @Output() onExported: EventEmitter; /** * A handler for the exporting event. */ @Output() onExporting: EventEmitter; /** * A handler for the fileSaving event. */ @Output() onFileSaving: EventEmitter; /** * A handler for the initialized event. Executed only once, after the widget is initialized. */ @Output() onInitialized: EventEmitter; /** * A handler for the optionChanged event. Executed after an option of the widget is changed. */ @Output() onOptionChanged: EventEmitter; /** * A handler for the allowExpandAllChange event. */ @Output() allowExpandAllChange: EventEmitter; /** * A handler for the allowFilteringChange event. */ @Output() allowFilteringChange: EventEmitter; /** * A handler for the allowSortingChange event. */ @Output() allowSortingChange: EventEmitter; /** * A handler for the allowSortingBySummaryChange event. */ @Output() allowSortingBySummaryChange: EventEmitter; /** * A handler for the dataFieldAreaChange event. */ @Output() dataFieldAreaChange: EventEmitter; /** * A handler for the dataSourceChange event. */ @Output() dataSourceChange: EventEmitter>; /** * A handler for the disabledChange event. */ @Output() disabledChange: EventEmitter; /** * A handler for the elementAttrChange event. */ @Output() elementAttrChange: EventEmitter; /** * A handler for the exportChange event. */ @Output() exportChange: EventEmitter; /** * A handler for the fieldChooserChange event. */ @Output() fieldChooserChange: EventEmitter; /** * A handler for the fieldPanelChange event. */ @Output() fieldPanelChange: EventEmitter; /** * A handler for the headerFilterChange event. */ @Output() headerFilterChange: EventEmitter; /** * A handler for the heightChange event. */ @Output() heightChange: EventEmitter; /** * A handler for the hideEmptySummaryCellsChange event. */ @Output() hideEmptySummaryCellsChange: EventEmitter; /** * A handler for the hintChange event. */ @Output() hintChange: EventEmitter; /** * A handler for the loadPanelChange event. */ @Output() loadPanelChange: EventEmitter; /** * A handler for the rowHeaderLayoutChange event. */ @Output() rowHeaderLayoutChange: EventEmitter; /** * A handler for the rtlEnabledChange event. */ @Output() rtlEnabledChange: EventEmitter; /** * A handler for the scrollingChange event. */ @Output() scrollingChange: EventEmitter; /** * A handler for the showBordersChange event. */ @Output() showBordersChange: EventEmitter; /** * A handler for the showColumnGrandTotalsChange event. */ @Output() showColumnGrandTotalsChange: EventEmitter; /** * A handler for the showColumnTotalsChange event. */ @Output() showColumnTotalsChange: EventEmitter; /** * A handler for the showRowGrandTotalsChange event. */ @Output() showRowGrandTotalsChange: EventEmitter; /** * A handler for the showRowTotalsChange event. */ @Output() showRowTotalsChange: EventEmitter; /** * A handler for the showTotalsPriorChange event. */ @Output() showTotalsPriorChange: EventEmitter; /** * A handler for the stateStoringChange event. */ @Output() stateStoringChange: EventEmitter; /** * A handler for the tabIndexChange event. */ @Output() tabIndexChange: EventEmitter; /** * A handler for the textsChange event. */ @Output() textsChange: EventEmitter; /** * A handler for the useNativeScrollingChange event. */ @Output() useNativeScrollingChange: EventEmitter; /** * A handler for the visibleChange event. */ @Output() visibleChange: EventEmitter; /** * A handler for the widthChange event. */ @Output() widthChange: EventEmitter; /** * A handler for the wordWrapEnabledChange event. */ @Output() wordWrapEnabledChange: EventEmitter; constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost, injector: Injector, private _watcherHelper: WatcherHelper, private _idh: IterableDifferHelper, optionHost: NestedOptionHost) { super(elementRef, ngZone, templateHost, _watcherHelper); injector.get(EventsRegistrator); this._createEventEmitters([ { subscribe: 'cellClick', emit: 'onCellClick' }, { subscribe: 'cellPrepared', emit: 'onCellPrepared' }, { subscribe: 'contentReady', emit: 'onContentReady' }, { subscribe: 'contextMenuPreparing', emit: 'onContextMenuPreparing' }, { subscribe: 'disposing', emit: 'onDisposing' }, { subscribe: 'exported', emit: 'onExported' }, { subscribe: 'exporting', emit: 'onExporting' }, { subscribe: 'fileSaving', emit: 'onFileSaving' }, { subscribe: 'initialized', emit: 'onInitialized' }, { subscribe: 'optionChanged', emit: 'onOptionChanged' }, { emit: 'allowExpandAllChange' }, { emit: 'allowFilteringChange' }, { emit: 'allowSortingChange' }, { emit: 'allowSortingBySummaryChange' }, { emit: 'dataFieldAreaChange' }, { emit: 'dataSourceChange' }, { emit: 'disabledChange' }, { emit: 'elementAttrChange' }, { emit: 'exportChange' }, { emit: 'fieldChooserChange' }, { emit: 'fieldPanelChange' }, { emit: 'headerFilterChange' }, { emit: 'heightChange' }, { emit: 'hideEmptySummaryCellsChange' }, { emit: 'hintChange' }, { emit: 'loadPanelChange' }, { emit: 'rowHeaderLayoutChange' }, { emit: 'rtlEnabledChange' }, { emit: 'scrollingChange' }, { emit: 'showBordersChange' }, { emit: 'showColumnGrandTotalsChange' }, { emit: 'showColumnTotalsChange' }, { emit: 'showRowGrandTotalsChange' }, { emit: 'showRowTotalsChange' }, { emit: 'showTotalsPriorChange' }, { emit: 'stateStoringChange' }, { emit: 'tabIndexChange' }, { emit: 'textsChange' }, { emit: 'useNativeScrollingChange' }, { emit: 'visibleChange' }, { emit: 'widthChange' }, { emit: 'wordWrapEnabledChange' } ]); this._idh.setHost(this); optionHost.setHost(this); } protected _createInstance(element, options) { return new DxPivotGrid(element, options); } ngOnDestroy() { this._destroyWidget(); } ngOnChanges(changes: SimpleChanges) { super.ngOnChanges(changes); this.setupChanges('dataSource', changes); } setupChanges(prop: string, changes: SimpleChanges) { if (!(prop in this._optionsToUpdate)) { this._idh.setup(prop, changes); } } ngDoCheck() { this._idh.doCheck('dataSource'); this._watcherHelper.checkWatchers(); super.ngDoCheck(); } _setOption(name: string, value: any) { let isSetup = this._idh.setupSingle(name, value); let isChanged = this._idh.getChanges(name, value) !== null; if (isSetup || isChanged) { super._setOption(name, value); } } } @NgModule({ imports: [ DxoDataSourceModule, DxiFieldModule, DxoFormatModule, DxoHeaderFilterModule, DxoStoreModule, DxoExportModule, DxoFieldChooserModule, DxoTextsModule, DxoFieldPanelModule, DxoLoadPanelModule, DxoScrollingModule, DxoStateStoringModule, DxTemplateModule ], declarations: [ DxPivotGridComponent ], exports: [ DxPivotGridComponent, DxoDataSourceModule, DxiFieldModule, DxoFormatModule, DxoHeaderFilterModule, DxoStoreModule, DxoExportModule, DxoFieldChooserModule, DxoTextsModule, DxoFieldPanelModule, DxoLoadPanelModule, DxoScrollingModule, DxoStateStoringModule, DxTemplateModule ], providers: [EventsRegistrator] }) export class DxPivotGridModule { }