UNPKG

igniteui-react-grids

Version:

Ignite UI React grid components.

1,139 lines 202 kB
import { __extends, __values } from "tslib"; import * as React from 'react'; import { IgrSectionHeader } from './igr-section-header'; import { IgrSummaryRowRoot } from './igr-summary-row-root'; import { IgrSummaryRowSection } from './igr-summary-row-section'; import { IgrColumnWidth } from './igr-column-width'; import { ColumnWidth as ColumnWidth_internal } from './ColumnWidth'; import { HeaderClickAction_$type } from './HeaderClickAction'; import { ColumnShowingAnimationMode_$type } from './ColumnShowingAnimationMode'; import { ColumnPropertyUpdatingAnimationMode, ColumnPropertyUpdatingAnimationMode_$type } from './ColumnPropertyUpdatingAnimationMode'; import { CellDataLoadedAnimationMode_$type } from './CellDataLoadedAnimationMode'; import { RowSelectionAnimationMode_$type } from './RowSelectionAnimationMode'; import { ColumnMovingAnimationMode_$type } from './ColumnMovingAnimationMode'; import { ColumnHidingAnimationMode_$type } from './ColumnHidingAnimationMode'; import { CellSelectionAnimationMode_$type } from './CellSelectionAnimationMode'; import { ColumnExchangingAnimationMode_$type } from './ColumnExchangingAnimationMode'; import { RowHoverAnimationMode_$type } from './RowHoverAnimationMode'; import { DataGridSelectionMode_$type } from './DataGridSelectionMode'; import { GridActivationMode_$type } from './GridActivationMode'; import { GridSelectionBehavior_$type } from './GridSelectionBehavior'; import { IgrDataGridCellEventArgs } from './igr-data-grid-cell-event-args'; import { IgrGridColumnsAutoGeneratedEventArgs } from './igr-grid-columns-auto-generated-event-args'; import { IgrGridColumnsChangedEventArgs } from './igr-grid-columns-changed-event-args'; import { IgrGridSelectedItemsChangedEventArgs } from './igr-grid-selected-items-changed-event-args'; import { IgrGridSelectedKeysChangedEventArgs } from './igr-grid-selected-keys-changed-event-args'; import { IgrGridSelectedCellsChangedEventArgs } from './igr-grid-selected-cells-changed-event-args'; import { IgrGridSelectedCellRangesChangedEventArgs } from './igr-grid-selected-cell-ranges-changed-event-args'; import { IgrGridSortDescriptionsChangedEventArgs } from './igr-grid-sort-descriptions-changed-event-args'; import { IgrGridGroupDescriptionsChangedEventArgs } from './igr-grid-group-descriptions-changed-event-args'; import { IgrGridSummaryDescriptionsChangedEventArgs } from './igr-grid-summary-descriptions-changed-event-args'; import { DataGrid } from "./DataGrid"; import { ensureEnum, ensureBool, CollectionAdapter, toSpinal, brushToString, stringToBrush, initializePropertiesFromCss, NamePatcher, isValidProp, getModifiedProps } from "igniteui-react-core"; import { Thickness } from "igniteui-react-core"; import { ReactRenderer, ReactWrapper, PortalManager } from "igniteui-react-core"; import { DataGridColumn } from './DataGridColumn'; import { IgrDataGridColumn } from './igr-data-grid-column'; import { DataGridCellLayoutPanel } from './DataGridCellLayoutPanel'; import { Base } from "igniteui-react-core"; import { GridExternalWrapper } from './GridExternalWrapper'; import { BrowserTickProvider } from './BrowserTickProvider'; import { BrowserPixelConverter } from './BrowserPixelConverter'; import { DataGridPresenterManager } from './DataGridPresenterManager'; import { DataGridViewportManager } from './DataGridViewportManager'; import { DataGridDelayedExecutionManager } from './DataGridDelayedExecutionManager'; import { DataGridPropertySetter } from './DataGridPropertySetter'; import { IgrGridColumnCollection } from './igr-grid-column-collection'; import { SyncableObservableCollection$1 } from "igniteui-react-core"; import { NotifyCollectionChangedAction } from "igniteui-react-core"; import { Scroller } from "igniteui-react-core"; import { ScrollbarStyle_$type } from "igniteui-react-core"; import { Dragger } from "./Dragger"; import { DataGridStylingDefaults } from './DataGridStylingDefaults'; import { delegateCombine, delegateRemove } from "igniteui-react-core"; import { FontInfo } from "igniteui-react-core"; import { IgrColumnSortDescriptionCollection } from './igr-column-sort-description-collection'; import { IgrColumnGroupDescriptionCollection } from './igr-column-group-description-collection'; import { IgrColumnSummaryDescriptionCollection } from './igr-column-summary-description-collection'; import { IgrFilterExpressionCollection } from "igniteui-react-core"; import { IgrGridSelectedItemsCollection } from "./igr-grid-selected-items-collection"; import { IgrGridSelectedKeysCollection } from "./igr-grid-selected-keys-collection"; import { IgrGridSelectedCellsCollection } from "./igr-grid-selected-cells-collection"; import { IgrGridSelectedCellRangesCollection } from "./igr-grid-selected-cell-ranges-collection"; import { GridSelectedItemsCollection as GridSelectedItemsCollection_internal } from "./GridSelectedItemsCollection"; import { GridSelectedKeysCollection as GridSelectedKeysCollection_internal } from "./GridSelectedKeysCollection"; import { GridSelectedCellsCollection as GridSelectedCellsCollection_internal } from "./GridSelectedCellsCollection"; import { GridSelectedCellRangesCollection as GridSelectedCellRangesCollection_internal } from "./GridSelectedCellRangesCollection"; import { IgrColumnHiddenChangedEventArgs } from "./igr-column-hidden-changed-event-args"; import { PrimaryKeyValue } from "./PrimaryKeyValue"; import { CellKey } from "./CellKey"; import { CellRange } from "./CellRange"; import { IgrGridFilterExpressionsEventArgs } from './igr-grid-filter-expressions-event-args'; import { GridColumnCollection as GridColumnCollection_internal } from './GridColumnCollection'; import { ResponsiveStatesCollection as ResponsiveStatesCollection_internal } from './ResponsiveStatesCollection'; import { IgrResponsiveStatesCollection } from './igr-responsive-states-collection'; import { ResponsiveState } from './ResponsiveState'; import { IgrGridAnimationSettings } from './igr-grid-animation-settings'; import { IgrRowSeparator } from './igr-row-separator'; import { IgrHeaderRowSeparator } from './igr-header-row-separator'; import { ContentChildrenManager } from "igniteui-react-core"; import { IgrGridCellPosition } from "./igr-grid-cell-position"; import { IgrGridActiveCellChangedEventArgs } from "./igr-grid-active-cell-changed-event-args"; import { DataGridScrollerKeyboardListener } from "./DataGridScrollerKeyboardListener"; import { IgrHeaderSeparator } from "./igr-header-separator"; import { IgrColumnResizingSeparator } from "./igr-column-resizing-separator"; import { ColumnResizingMode_$type } from "./ColumnResizingMode"; import { ColumnResizingAnimationMode_$type } from "./ColumnResizingAnimationMode"; import { ColumnMovingMode_$type } from "./ColumnMovingMode"; import { IgrColumnMovingSeparator } from "./igr-column-moving-separator"; import { SortIndicatorStyle_$type } from "./SortIndicatorStyle"; import { GroupHeaderDisplayMode_$type } from "./GroupHeaderDisplayMode"; import { SummaryScope_$type } from "./SummaryScope"; import { GroupSummaryDisplayMode_$type } from "./GroupSummaryDisplayMode"; import { IgrPinnedAreaSeparator } from "./igr-pinned-area-separator"; import { fromRect } from "igniteui-react-core"; import { ColumnOptionsIconAlignment_$type } from "./ColumnOptionsIconAlignment"; import { ColumnOptionsIconBehavior_$type } from "./ColumnOptionsIconBehavior"; import { IgrColumnPinnedChangedEventArgs } from "./igr-column-pinned-changed-event-args"; import { ControlDisplayDensity_$type } from "igniteui-react-core"; import { CornerRadius } from "igniteui-react-core"; import { EditModeType_$type } from "./EditModeType"; import { EditModeClickAction_$type } from "./EditModeClickAction"; import { IgrGridCellValueChangingEventArgs } from "./igr-grid-cell-value-changing-event-args"; import { IgrGridDataCommittingEventArgs } from "./igr-grid-data-committing-event-args"; import { IgrGridDataCommittedEventArgs } from "./igr-grid-data-committed-event-args"; import { IgrGridSizeChangedEventArgs } from "./igr-grid-size-changed-event-args"; import { IgrGridColumnWidthChangedEventArgs } from "./igr-grid-column-width-changed-event-args"; import { DataGridAccessibilityLayoutPanel } from './DataGridAccessibilityLayoutPanel'; import { IgrGridCellEditStartedEventArgs } from "./igr-grid-cell-edit-started-event-args"; import { IgrGridCellEditEndedEventArgs } from "./igr-grid-cell-edit-ended-event-args"; import { IgrGridRowEditStartedEventArgs } from "./igr-grid-row-edit-started-event-args"; import { IgrGridRowEditEndedEventArgs } from "./igr-grid-row-edit-ended-event-args"; import { IgrGridSelectionChangedEventArgs } from "./igr-grid-selection-changed-event-args"; import { EnterKeyBehaviors_$type } from "./EnterKeyBehaviors"; import { EnterKeyBehaviorAfterEdit_$type } from "./EnterKeyBehaviorAfterEdit"; import { MergedCellMode_$type } from "./MergedCellMode"; import { MergedCellEvaluationCriteria_$type } from "./MergedCellEvaluationCriteria"; import { FilterUIType, FilterUIType_$type } from "./FilterUIType"; import { FilterLogicalOperator_$type } from "./FilterLogicalOperator"; import { FilterComparisonType_$type } from "./FilterComparisonType"; import { IgrGridCustomFilterRequestedEventArgs } from "./igr-grid-custom-filter-requested-event-args"; import { IgrColumnGrouping } from "./igr-column-grouping"; import { CellContentVerticalAlignment_$type } from "./CellContentVerticalAlignment"; import { IgrDateTimeCellInfo } from "./igr-date-time-cell-info"; import { IgrImageCellInfo } from "./igr-image-cell-info"; import { IgrNumericCellInfo } from "./igr-numeric-cell-info"; import { IgrRowSeparatorInfo } from "./igr-row-separator-info"; import { IgrSectionHeaderCellInfo } from "./igr-section-header-cell-info"; import { IgrTemplateCellInfo } from "./igr-template-cell-info"; import { IgrTemplateHeaderCellInfo } from "./igr-template-header-cell-info"; import { IgrTemplateSectionHeaderCellInfo } from "./igr-template-section-header-cell-info"; import { IgrTextCellInfo } from "./igr-text-cell-info"; import { IgrTextHeaderCellInfo } from "./igr-text-header-cell-info"; import { IgrFilterCellInfo } from "./igr-filter-cell-info"; import { IgrDataGridPager } from "./igr-data-grid-pager"; import { IgrDataGridToolbar } from './igr-data-grid-toolbar'; import { IgrDataSourceRootSummariesChangedEventArgs } from "igniteui-react-core"; var GridStylingDefaults = {}; var IgrDataGrid = /** @class */ /*@__PURE__*/ (function (_super) { __extends(IgrDataGrid, _super); function IgrDataGrid(props) { var _this = _super.call(this, props) || this; _this.contentColumns = []; /** * The columns actually present in the grid. Do not directly modify this array. * This array's contents can be modified by causing React to reproject the child content. * Or adding and removing columns from the manual columns collection on the columns property. */ _this.combinedColumns = []; _this._columns = null; _this._disableManualColumnSync = false; _this._mounted = false; _this._columnsAdapter = null; _this._renderer = null; _this._scroller = null; _this._dragger = null; _this._wrapper = null; _this._grid = null; _this._dataSource = null; _this._insetLeft = 0; _this._insetTop = 0; _this._insetRight = 0; _this._insetBottom = 0; _this._isPagerVisible = false; _this._selectedItems = null; _this._selectedKeys = null; _this._selectedCells = null; _this._selectedCellRanges = null; _this._pinnedItems = null; _this._pinnedKeys = null; _this._responsiveStates = null; _this._actualColumns = null; _this.__p = null; _this._hasUserValues = new Set(); _this._stylingContainer = null; _this._stylingParent = null; _this._inStyling = false; _this._filterExpressionsChanging = null; _this._filterExpressionsChanging_wrapped = null; _this._filterExpressionsChanged = null; _this._filterExpressionsChanged_wrapped = null; _this._cellPreviewPointerDown = null; _this._cellPreviewPointerDown_wrapped = null; _this._cellPreviewPointerUp = null; _this._cellPreviewPointerUp_wrapped = null; _this._cellPointerDown = null; _this._cellPointerDown_wrapped = null; _this._cellPointerUp = null; _this._cellPointerUp_wrapped = null; _this._cellClicked = null; _this._cellClicked_wrapped = null; _this._sortDescriptionsChanged = null; _this._sortDescriptionsChanged_wrapped = null; _this._groupDescriptionsChanged = null; _this._groupDescriptionsChanged_wrapped = null; _this._summaryDescriptionsChanged = null; _this._summaryDescriptionsChanged_wrapped = null; _this._columnHiddenChanged = null; _this._columnHiddenChanged_wrapped = null; _this._columnPinnedChanged = null; _this._columnPinnedChanged_wrapped = null; _this._cellValueChanging = null; _this._cellValueChanging_wrapped = null; _this._dataCommitted = null; _this._dataCommitted_wrapped = null; _this._dataCommitting = null; _this._dataCommitting_wrapped = null; _this._rootSummariesChanged = null; _this._rootSummariesChanged_wrapped = null; _this._sizeChanged = null; _this._sizeChanged_wrapped = null; _this._actualColumnsChanged = null; _this._actualColumnsChanged_wrapped = null; _this._columnsAutoGenerated = null; _this._columnsAutoGenerated_wrapped = null; _this._selectedItemsChanged = null; _this._selectedItemsChanged_wrapped = null; _this._selectedKeysChanged = null; _this._selectedKeysChanged_wrapped = null; _this._selectedCellsChanged = null; _this._selectedCellsChanged_wrapped = null; _this._selectionChanged = null; _this._selectionChanged_wrapped = null; _this._activeCellChanged = null; _this._activeCellChanged_wrapped = null; _this._selectedCellRangesChanged = null; _this._selectedCellRangesChanged_wrapped = null; _this._columnWidthChanged = null; _this._columnWidthChanged_wrapped = null; _this._cellEditStarted = null; _this._cellEditStarted_wrapped = null; _this._cellEditEnded = null; _this._cellEditEnded_wrapped = null; _this._rowEditStarted = null; _this._rowEditStarted_wrapped = null; _this._rowEditEnded = null; _this._rowEditEnded_wrapped = null; _this._customFilterRequested = null; _this._customFilterRequested_wrapped = null; _this._actualPrimaryKeyChange = null; _this._actualPrimaryKeyChange_wrapped = null; if (_this._styling) { NamePatcher.ensureStylablePatched(Object.getPrototypeOf(_this)); } _this._getMainRef = _this._getMainRef.bind(_this); _this._getFilterDialog = _this._getFilterDialog.bind(_this); _this._getColumnGroupingRef = _this._getColumnGroupingRef.bind(_this); _this._getContentAreaRef = _this._getContentAreaRef.bind(_this); _this._getPagerRef = _this._getPagerRef.bind(_this); _this._getToolbarRef = _this._getToolbarRef.bind(_this); _this._contentChildrenManager = new ContentChildrenManager(function (ch) { return ch.props.name || ch.key || ch.props.field; }, function (ch) { return ch.name || ch.key || ch.field; }, function () { return _this._updateContentChildren(); }); var useCanvas = false; if (props.useCanvas) { _this.useCanvas = true; useCanvas = true; } if (props.useAccessibility) { _this.useAccessibility = true; } if (document) { _this._container = document.createElement("div"); _this._container.style.display = "block"; _this._container.style.width = "100%"; _this._container.style.height = "100%"; _this._container.style.boxSizing = "border-box"; _this._container.style.overflow = "hidden"; } var root; root = _this._container; _this.requestRender = _this.requestRender.bind(_this); _this._portalManager = new PortalManager("filterDialog", _this.requestRender); _this._portalManager.disableContentPortal = true; _this._renderer = new ReactRenderer(root, document, true, DataGridStylingDefaults, _this._portalManager); _this._wrapper = _this._renderer; _this._implementation = new DataGrid(); var grid = _this.i; _this._grid = grid; _this._grid.externalObject = _this; _this._columnsAdapter = new CollectionAdapter(_this.contentColumns, _this.i.columns, _this.combinedColumns, function (c) { return c.i; }, function (i) { i._provideRenderer(_this._wrapper); if (_this._container && _this._container.parentElement) { i._styling(_this._container, _this, _this); } }, function (i) { i._provideRenderer(null); }, function (i) { return i.name || i.field; }); grid.externalGrid = new GridExternalWrapper(_this); grid.tickProvider = new BrowserTickProvider(_this._renderer); grid.platformPixelConverter = new BrowserPixelConverter(); if (_this.useAccessibility) { _this._contentLayout = new DataGridAccessibilityLayoutPanel(_this._renderer, new DataGridPresenterManager(_this._grid, false), window.devicePixelRatio); } else { _this._contentLayout = new DataGridCellLayoutPanel(_this._renderer, new DataGridPresenterManager(_this._grid, useCanvas), window.devicePixelRatio); } grid.renderingEngine = _this._contentLayout; grid.viewportManager = new DataGridViewportManager(_this); grid.delayedExecutionManager = new DataGridDelayedExecutionManager(_this._renderer); grid.propertySetter = new DataGridPropertySetter(); //grid.provideContainer(ren); var scroller = new Scroller(); scroller.scrollbarStyle = _this.scrollbarStyle; _this._scroller = scroller; _this._scroller.keyboardListener = new DataGridScrollerKeyboardListener(grid); scroller.provideContainer(_this._renderer); _this._content = (_this._contentLayout.element.getNativeElement()); scroller.provideContent(new ReactWrapper(_this._content, _this._renderer)); scroller.onScrolling = function () { return _this.onScroll(); }; scroller.onScrollStart = function () { return _this.onScrollStart(); }; scroller.onScrollStop = function () { return _this.onScrollStop(); }; scroller.viewportWidth = _this._container.clientWidth; scroller.viewportHeight = _this._container.clientHeight; grid.dragger = new Dragger(); grid.dragger.provideContainer(_this._renderer); grid.dragger.viewportWidth = _this._container.clientWidth; grid.dragger.viewportHeight = _this._container.clientHeight; _this.initializeProperties(); var isFilterRowEnabled = _this.filterUIType === FilterUIType.FilterRow; var filterRowHeight = isFilterRowEnabled ? _this.actualRowHeight + _this.rowSeparatorHeight : 0; scroller.verticalTrackStartInset = _this.actualHeaderHeight + _this.rowSeparatorHeight + filterRowHeight; _this._renderer.addSizeWatcher(function () { _this.containerResized(); }); _this._mounted = true; return _this; } IgrDataGrid.prototype._insertExternalColumnAtIndex = function (index, column) { //let contentCount = this.contentColumns.length; var contentCount = this._columnsAdapter.actualContent.length; this.columns.insert(index - contentCount, column); }; IgrDataGrid.prototype._removeExternalColumn = function (column) { var ind = -1; for (var i = 0; i < this.columns.count; i++) { if (this.columns.item(i) === column) { ind = i; break; } } if (ind >= 0) { this.columns.removeAt(ind); } }; IgrDataGrid.prototype._updateContentChildren = function () { this.contentColumns.length = 0; var contentChildrenActual = this._contentChildrenManager.contentChildrenActual; for (var i = 0; i < contentChildrenActual.length; i++) { if ((DataGridColumn.$type).isAssignableFrom(contentChildrenActual[i].i.$type)) { if (!contentChildrenActual[i]._iniailizedMarkup) { contentChildrenActual[i]._iniailizedMarkup = true; contentChildrenActual[i].isFromMarkup = true; } this.contentColumns.push(contentChildrenActual[i]); } } if (this._columnsAdapter !== null) { this._columnsAdapter.notifyContentChanged(); } }; Object.defineProperty(IgrDataGrid.prototype, "actualDataSource", { get: function () { return this.i.actualDataSource; }, enumerable: false, configurable: true }); IgrDataGrid.prototype._getMainRef = function (ref) { this._elRef = ref; this.i.syncBorder(); this._contentLayout.rootElement = this._elRef; }; IgrDataGrid.prototype._getContentAreaRef = function (ref) { this._contentAreaRef = ref; }; IgrDataGrid.prototype._getFilterDialog = function (ref) { this._filterDialogRef = ref; }; IgrDataGrid.prototype._getColumnGroupingRef = function (ref) { this._columnGroupingRef = ref; if (this._columnGroupingRef) this._columnGroupingRef.targetGrid = this; }; IgrDataGrid.prototype._getPagerRef = function (ref) { if (ref) { this._pagerRef = ref; this._pagerRef.targetGrid = this; this.i.pager = this._pagerRef.i; } else { this._pagerRef.targetGrid = null; this.i.pager = null; this._pagerRef = ref; // When the pager is shown it replaces the internal grid's datasource with a new paged one. So when hiding the pager // we need to assign back the original datasource. this._grid.itemsSource = this._dataSource; } }; IgrDataGrid.prototype._getToolbarRef = function (ref) { if (ref) { this.i.toolbar = ref.i; ref.targetGrid = this; } }; IgrDataGrid.prototype._ensureColumnsAreManual = function () { this._disableManualColumnSync = true; this._columnsAdapter.shiftContentToManual(this.columns, function (i) { return i.isFromMarkup = false; }); this._disableManualColumnSync = false; }; Object.defineProperty(IgrDataGrid.prototype, "columns", { /** * A collection or manually added columns for the grid. */ get: function () { var _this = this; if (this._columns === null) { var coll = new IgrGridColumnCollection(); var inner = coll._innerColl; inner.addListener(function (sender, e) { if (_this._disableManualColumnSync) { return; } switch (e.action) { case NotifyCollectionChangedAction.Add: _this._columnsAdapter.insertManualItem(e.newStartingIndex, e.newItems.item(0)); break; case NotifyCollectionChangedAction.Remove: _this._columnsAdapter.removeManualItemAt(e.oldStartingIndex); break; case NotifyCollectionChangedAction.Replace: _this._columnsAdapter.removeManualItemAt(e.oldStartingIndex); _this._columnsAdapter.insertManualItem(e.newStartingIndex, e.newItems.item(0)); break; case NotifyCollectionChangedAction.Reset: _this._columnsAdapter.clearManualItems(); break; } }); this._columns = coll; } return this._columns; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "height", { get: function () { return this._height; }, set: function (value) { this._height = value; if (this._elRef) { this._elRef.style.height = value; this.containerResized(); } }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "width", { get: function () { return this._width; }, set: function (value) { this._width = value; if (this._elRef) { this._elRef.style.width = value; this.containerResized(); } }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "isGroupByAreaVisible", { /** * Gets or sets if the Column Grouping Area should be shown and enabled */ get: function () { return this._isGroupByAreaVisible; }, set: function (value) { this._isGroupByAreaVisible = ensureBool(value); this.i.isGroupByAreaVisible = this._isGroupByAreaVisible; this.i.columnGrouping = this._columnGroupingRef; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "useCanvas", { get: function () { return this._useCanvas; }, set: function (value) { this._useCanvas = ensureBool(value); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "useAccessibility", { get: function () { return this._useAccessibility; }, set: function (value) { this._useAccessibility = ensureBool(value); }, enumerable: false, configurable: true }); IgrDataGrid.prototype._setScrollbarStyle = function (style) { if (this._scroller) { this._scroller.scrollbarStyle = style; } }; IgrDataGrid.prototype._setScrollbarColor = function (color) { if (this._scroller) { this._scroller.scrollbarBrush = color; } }; IgrDataGrid.prototype.render = function () { // if (!this._childrenDiffer(this.props.children)) { // let div = React.createElement("div", { // ref: (ref) => { // this._elRef = ref; // }, // children: this.props.children // }); // return div; // } else { var children = this._contentChildrenManager.getChildren(this.props.children); this._portalManager.onRender(children); if (this.isToolbarVisible) { var toolbar_1 = React.createElement(IgrDataGridToolbar, { key: "toolbar", ref: this._getToolbarRef, borderWidthTop: 0, borderWidthRight: 0, borderWidthBottom: 1, borderWidthLeft: 0 }); children.push(toolbar_1); } if (this._isGroupByAreaVisible == true) { var columnGrouping = React.createElement(IgrColumnGrouping, { ref: this._getColumnGroupingRef, key: "columnGrouping" }); children.push(columnGrouping); } var main = React.createElement("div", { key: "content", ref: this._getContentAreaRef, style: { overflow: "hidden", flex: "1" } }); children.push(main); if (this.isPagerVisible) { var pager = React.createElement(IgrDataGridPager, { key: "pager", ref: this._getPagerRef }); children.push(pager); } var div = React.createElement("div", { className: "ig-data-grid igr-data-grid", ref: this._getMainRef, style: { boxSizing: "border-box", overflow: "hidden", display: "flex", flexDirection: "column" }, children: children }); return div; //} }; IgrDataGrid.prototype.destroy = function () { this._wrapper.destroy(); }; IgrDataGrid.prototype.componentDidMount = function () { if (!this._mounted) { this._mounted = true; if (this.i) { if (this._scroller) { this._scroller.onAttachedToUI(); } if (this._grid.dragger) { this._grid.dragger.onAttachedToUI(); } if (this._grid.renderingEngine) { this._grid.renderingEngine.attach(); } } return; } this._elRef.style.width = this._width ? this._width : ""; this._elRef.style.height = this._height ? this._height : ""; this._contentAreaRef.appendChild(this._container); this.containerResized(); this.initializeContent(); }; IgrDataGrid.prototype.componentWillUnmount = function () { //this._grid.destroy(); if (this.i) { if (this._scroller) { this._scroller.onDetachedFromUI(); } if (this._grid.dragger) { this._grid.dragger.onDetachedFromUI(); } if (this._grid.renderingEngine) { this._grid.renderingEngine.detach(); } } this._mounted = false; }; IgrDataGrid.prototype.createImplementation = function () { //let test = Grid; return new DataGrid(); }; IgrDataGrid.prototype.ngOnInit = function () { }; Object.defineProperty(IgrDataGrid.prototype, "i", { get: function () { return this._implementation; }, enumerable: false, configurable: true }); IgrDataGrid.prototype.onImplementationCreated = function () { }; IgrDataGrid.prototype.requestRender = function () { this.setState({}); }; IgrDataGrid.prototype._focusScroller = function () { this._scroller.focus(); }; IgrDataGrid.prototype._setDefaultCursor = function () { if (this._elRef.style.cursor !== "") { this._elRef.style.cursor = ""; } }; IgrDataGrid.prototype._setResizeCursor = function () { if (this._elRef.style.cursor !== "col-resize") { this._elRef.style.cursor = "col-resize"; } }; IgrDataGrid.prototype._setHandCursor = function () { if (this._elRef.style.cursor !== "grabbing") { this._elRef.style.cursor = "grabbing"; } }; IgrDataGrid.prototype._setBorder = function (borderColor, borderLeft, borderTop, borderRight, borderBottom, radiusTopLeft, radiusTopRight, radiusBottomLeft, radiusBottomRight) { if (this._elRef) { if (borderLeft !== 0 || borderTop !== 0 || borderRight !== 0 || borderBottom !== 0) { this._elRef.style.borderStyle = "solid"; this._elRef.style.borderColor = borderColor; this._elRef.style.borderTopWidth = borderTop + "px"; this._elRef.style.borderRightWidth = borderRight + "px"; this._elRef.style.borderBottomWidth = borderBottom + "px"; this._elRef.style.borderLeftWidth = borderLeft + "px"; this._elRef.style.borderTopLeftRadius = radiusTopLeft + "px"; this._elRef.style.borderTopRightRadius = radiusTopRight + "px"; this._elRef.style.borderBottomLeftRadius = radiusBottomLeft + "px"; this._elRef.style.borderBottomRightRadius = radiusBottomRight + "px"; } else { this._elRef.style.borderStyle = "none"; } } }; IgrDataGrid.prototype._setScrollerVerticalTrackInset = function (inset) { this._scroller.verticalTrackStartInset = inset; }; IgrDataGrid.prototype.initializeContent = function () { // supports themes or custom properties set in CSS var prev = this._grid.columnPropertyUpdatingAnimationMode; this._grid.columnPropertyUpdatingAnimationMode = ColumnPropertyUpdatingAnimationMode.None; this._styling(this._container, this); this._grid.columnPropertyUpdatingAnimationMode = prev; this._updateContentChildren(); prev = this._grid.columnPropertyUpdatingAnimationMode; this._grid.columnPropertyUpdatingAnimationMode = ColumnPropertyUpdatingAnimationMode.None; for (var i = 0; i < this.actualColumns.count; i++) { var c = this.actualColumns.item(i); c._styling(this._container, this, this); } this._grid.columnPropertyUpdatingAnimationMode = prev; this._grid.itemsSource = this._dataSource; }; /* * Notify the DataGrid that it has been added to the DOM. This is useful when you are creating and * rendering the React component before actually adding it to the document. */ IgrDataGrid.prototype.notifyDOMInsertion = function () { var prev = this._grid.columnPropertyUpdatingAnimationMode; this._grid.columnPropertyUpdatingAnimationMode = ColumnPropertyUpdatingAnimationMode.None; this._styling(this._container, this); this._grid.columnPropertyUpdatingAnimationMode = prev; prev = this._grid.columnPropertyUpdatingAnimationMode; this._grid.columnPropertyUpdatingAnimationMode = ColumnPropertyUpdatingAnimationMode.None; for (var i = 0; i < this.actualColumns.count; i++) { var c = this.actualColumns.item(i); c._styling(this._container, this, this); } this._grid.columnPropertyUpdatingAnimationMode = prev; }; IgrDataGrid.prototype.initializeProperties = function () { var e_1, _a; try { for (var _b = __values(Object.keys(this.props)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = this.props[p]; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; IgrDataGrid.prototype.shouldComponentUpdate = function (nextProps, nextState) { var e_2, _a; var mod = getModifiedProps(this.props, nextProps); try { for (var _b = __values(Object.keys(mod)), _c = _b.next(); !_c.done; _c = _b.next()) { var p = _c.value; if (isValidProp(this, p)) { this[p] = mod[p]; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } return true; }; IgrDataGrid.prototype.containerResized = function () { var width = this._container.clientWidth; var height = this._container.clientHeight; this._scroller.viewportWidth = width; this._scroller.viewportHeight = height; this._grid.dragger.viewportWidth = width; this._grid.dragger.viewportHeight = height; this._grid.onSizeChanged(width, height); if (this._grid.model.actualVisibleRegion.isEmpty && width > 0 && height > 0) { this._grid.setViewport(0, 0, width, height); } else { this.onScroll(); } }; ; IgrDataGrid.prototype.refreshContentSize = function () { if (this._content != null) { var width = this._grid.model.absoluteWidth; var height = this._grid.model.absoluteHeight; if (this._scroller != null) { this._scroller.contentWidth = width; this._scroller.contentHeight = height; } } }; IgrDataGrid.prototype.onScroll = function () { var top = this._scroller.scrollTop; var left = this._scroller.scrollLeft; var width = this._scroller.viewportWidth; var height = this._scroller.viewportHeight; //console.log("top:" + top); this._grid.setViewport(left, top, left + width, top + height); }; IgrDataGrid.prototype.onScrollStart = function () { this._grid.notifyScrollStart(); }; IgrDataGrid.prototype.onScrollStop = function () { this._grid.notifyScrollStop(); }; IgrDataGrid.prototype.scrollTo = function (x, y) { this._scroller.scrollTo(x, y); //let width = this._scroller.viewportWidth; //let height = this._scroller.viewportHeight; //this._grid.setViewport(x, y, x + width, y + height); }; Object.defineProperty(IgrDataGrid.prototype, "dataSource", { get: function () { return this._dataSource; }, set: function (value) { this._dataSource = value; if (this._grid != null) { this._grid.itemsSource = this._dataSource; } }, enumerable: false, configurable: true }); IgrDataGrid.prototype.forColumnsWithPropertyPath = function (propertyPath, callback) { for (var i = 0; i < this.i.actualColumns.count; i++) { var col = this.i.actualColumns.item(i).externalObject; if (col.field == propertyPath) { callback(col); } } }; Object.defineProperty(IgrDataGrid.prototype, "defaultColumnWidth", { /** * Gets or sets the default column width to use if a column as no local width. * */ get: function () { var ext = this.i.defaultColumnWidth.externalObject; if (!ext) { ext = new IgrColumnWidth(); ext._implementation = this.i.defaultColumnWidth; } return ext; }, set: function (value) { if (typeof value == "string") { var int = ColumnWidth_internal.parse(value); var ext = new IgrColumnWidth(); ext._implementation = int; value = ext; } this.i.defaultColumnWidth = value.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "insetLeft", { /** * Gets or sets the amount of left inset space to use around the grid content. */ get: function () { return this._insetLeft; }, set: function (v) { this._insetLeft = +v; var inset = new Thickness(1, this._insetLeft, this._insetTop, this._insetRight, this._insetBottom); this.i.inset = inset; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "insetTop", { /** * Gets or sets the amount of top inset space to use around the grid content. */ get: function () { return this._insetTop; }, set: function (v) { this._insetTop = +v; var inset = new Thickness(1, this._insetLeft, this._insetTop, this._insetRight, this._insetBottom); this.i.inset = inset; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "insetRight", { /** * Gets or sets the amount of right inset space to use around the grid content. */ get: function () { return this._insetLeft; }, set: function (v) { this._insetRight = +v; var inset = new Thickness(1, this._insetLeft, this._insetTop, this._insetRight, this._insetBottom); this.i.inset = inset; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "insetBottom", { /** * Gets or sets the amount of bottom inset space to use around the grid content. */ get: function () { return this._insetBottom; }, set: function (v) { this._insetBottom = +v; var inset = new Thickness(1, this._insetLeft, this._insetTop, this._insetRight, this._insetBottom); this.i.inset = inset; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "isPagerVisible", { /** * Gets or sets whether to show the pager or not. */ get: function () { return this.i.isPagerVisible; }, set: function (value) { var v = ensureBool(value); if (this.i.isPagerVisible !== v) { this.i.isPagerVisible = v; if (this._mounted) { this.setState({}); } } }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "isToolbarVisible", { /** * Gets or sets whether to show the toolbar. */ get: function () { return this.i.isToolbarVisible; }, set: function (value) { this.i.isToolbarVisible = ensureBool(value); }, enumerable: false, configurable: true }); /** * Get the cell that contains the provided coordinates. */ IgrDataGrid.prototype.getHitCell = function (x, y) { var cell = this.i.getHitCell(x, y); if (!cell) { return null; } if (!cell.externalObject) { var ext = null; switch (cell.$type.name) { case "DateTimeCellModel": ext = new IgrDateTimeCellInfo(); break; case "ImageCellModel": ext = new IgrImageCellInfo(); break; case "NumericCellModel": ext = new IgrNumericCellInfo(); break; case "RowSeparatorModel": ext = new IgrRowSeparatorInfo(); break; case "SectionHeaderCellModel": ext = new IgrSectionHeaderCellInfo(); break; case "TemplateCellModel": ext = new IgrTemplateCellInfo(); break; case "TemplateHeaderCellModel": ext = new IgrTemplateHeaderCellInfo(); break; case "TemplateSectionHeaderCellModel": ext = new IgrTemplateSectionHeaderCellInfo(); break; case "TextCellModel": ext = new IgrTextCellInfo(); break; case "TextHeaderCellModel": ext = new IgrTextHeaderCellInfo(); break; case "FilterCellModel": ext = new IgrFilterCellInfo(); break; } ext._implementation = cell; cell.externalObject = ext; } return cell.externalObject; }; Object.defineProperty(IgrDataGrid.prototype, "columnResizingMode", { /** * Gets or sets the type of column resizing to use. */ get: function () { return this.i.columnResizingMode; }, set: function (v) { this.i.columnResizingMode = ensureEnum(ColumnResizingMode_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "columnMovingMode", { /** * Gets or sets the type column moving to use. */ get: function () { return this.i.columnMovingMode; }, set: function (v) { this.i.columnMovingMode = ensureEnum(ColumnMovingMode_$type, v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "isRowHoverEnabled", { /** * Gets or sets whether the row will highlight when hovered. */ get: function () { return this.i.isRowHoverEnabled; }, set: function (v) { this.i.isRowHoverEnabled = ensureBool(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "rowHoverBackground", { /** * Gets or sets the background color for rows when hovered. */ get: function () { return brushToString(this.i.rowHoverBackground); }, set: function (v) { this.i.rowHoverBackground = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "rowHoverTextColor", { /** * Gets or sets the text color for rows when hovered. */ get: function () { return brushToString(this.i.rowHoverTextColor); }, set: function (v) { this.i.rowHoverTextColor = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "editRowBorder", { /** * Gets or sets the border color for rows being edited. */ get: function () { return brushToString(this.i.editRowBorder); }, set: function (v) { this.i.editRowBorder = stringToBrush(v); }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "editRowBorderWidthBottom", { get: function () { return this.i.editRowBorderWidth ? this.i.editRowBorderWidth.bottom : NaN; }, set: function (v) { this.ensureEditRowBorderWidth(); this.i.editRowBorderWidth.bottom = +v; this.i.editRowBorderWidth = this.i.editRowBorderWidth; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "editRowBorderWidthLeft", { get: function () { return this.i.editRowBorderWidth ? this.i.editRowBorderWidth.left : NaN; }, set: function (v) { this.ensureEditRowBorderWidth(); this.i.editRowBorderWidth.left = +v; this.i.editRowBorderWidth = this.i.editRowBorderWidth; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "editRowBorderWidthRight", { get: function () { return this.i.editRowBorderWidth ? this.i.editRowBorderWidth.right : NaN; }, set: function (v) { this.ensureEditRowBorderWidth(); this.i.editRowBorderWidth.right = +v; this.i.editRowBorderWidth = this.i.editRowBorderWidth; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "editRowBorderWidthTop", { get: function () { return this.i.editRowBorderWidth ? this.i.editRowBorderWidth.top : NaN; }, set: function (v) { this.ensureEditRowBorderWidth(); this.i.editRowBorderWidth.top = +v; this.i.editRowBorderWidth = this.i.editRowBorderWidth; }, enumerable: false, configurable: true }); IgrDataGrid.prototype.ensureEditRowBorderWidth = function () { if (this.i.editRowBorderWidth) { return; } this.i.editRowBorderWidth = new Thickness(2); }; Object.defineProperty(IgrDataGrid.prototype, "sectionHeader", { /** * Gets or sets the header type used for sectioning off groups of rows. */ get: function () { var r = this.i.sectionHeader; if (r == null) { return null; } if (!r.externalObject) { var e = IgrSectionHeader._createFromInternal(r); if (e) { e._implementation = r; } r.externalObject = e; } return r.externalObject; }, set: function (v) { if (v != null && this._stylingContainer && v._styling) v._styling(this._stylingContainer, this, this); v == null ? this.i.sectionHeader = null : this.i.sectionHeader = v.i; }, enumerable: false, configurable: true }); Object.defineProperty(IgrDataGrid.prototype, "summaryRowRoot", { /** * Gets or sets the cell definition used for summary rows at the root level. */ get: function () { var r = this.i.summaryRowRoot; if (r == null)