This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fee7b9
commit 4936085
Showing
14 changed files
with
737 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "ag-grid-aurelia", | ||
"version": "14.2.0", | ||
"version": "15.0.0", | ||
"homepage": "http://www.ag-grid.com/", | ||
"authors": [ | ||
"Niall Crosby <[email protected]>" | ||
|
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,34 @@ | ||
// ag-grid-aurelia v15.0.0 | ||
import { ComponentAttached, ComponentDetached, Container, TaskQueue, ViewResources } from "aurelia-framework"; | ||
import { ColumnApi, GridApi, GridOptions } from "ag-grid/main"; | ||
import { AureliaFrameworkFactory } from "./aureliaFrameworkFactory"; | ||
import { AgGridColumn } from "./agGridColumn"; | ||
import { AgDateTemplate, AgFullWidthRowTemplate } from './agTemplate'; | ||
import { AureliaFrameworkComponentWrapper } from "./aureliaFrameworkComponentWrapper"; | ||
export declare class AgGridAurelia implements ComponentAttached, ComponentDetached { | ||
private taskQueue; | ||
private auFrameworkFactory; | ||
private container; | ||
private viewResources; | ||
private aureliaFrameworkComponentWrapper; | ||
private _nativeElement; | ||
private _initialised; | ||
private _destroyed; | ||
gridOptions: GridOptions; | ||
context: any; | ||
private gridParams; | ||
api: GridApi; | ||
columnApi: ColumnApi; | ||
columns: AgGridColumn[]; | ||
fullWidthRowTemplate: AgFullWidthRowTemplate; | ||
dateTemplate: AgDateTemplate; | ||
constructor(element: Element, taskQueue: TaskQueue, auFrameworkFactory: AureliaFrameworkFactory, container: Container, viewResources: ViewResources, aureliaFrameworkComponentWrapper: AureliaFrameworkComponentWrapper); | ||
attached(): void; | ||
initGrid(): void; | ||
/** | ||
* Called by Aurelia whenever a bound property changes | ||
*/ | ||
propertyChanged(propertyName: string, newValue: any, oldValue: any): void; | ||
detached(): void; | ||
private globalEventListener(eventType, event); | ||
} |
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,149 @@ | ||
// ag-grid-aurelia v15.0.0 | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aurelia_framework_1 = require("aurelia-framework"); | ||
var main_1 = require("ag-grid/main"); | ||
var aureliaFrameworkFactory_1 = require("./aureliaFrameworkFactory"); | ||
var agUtils_1 = require("./agUtils"); | ||
var agTemplate_1 = require("./agTemplate"); | ||
var aureliaFrameworkComponentWrapper_1 = require("./aureliaFrameworkComponentWrapper"); | ||
var AgGridAurelia = /** @class */ (function () { | ||
function AgGridAurelia(element, taskQueue, auFrameworkFactory, container, viewResources, aureliaFrameworkComponentWrapper) { | ||
var _this = this; | ||
this.taskQueue = taskQueue; | ||
this.auFrameworkFactory = auFrameworkFactory; | ||
this.container = container; | ||
this.viewResources = viewResources; | ||
this.aureliaFrameworkComponentWrapper = aureliaFrameworkComponentWrapper; | ||
this._initialised = false; | ||
this._destroyed = false; | ||
this.columns = []; | ||
this._nativeElement = element; | ||
// create all the events generically. this is done generically so that | ||
// if the list of grid events change, we don't need to change this code. | ||
main_1.ComponentUtil.EVENTS.forEach(function (eventName) { | ||
//create an empty event | ||
_this[eventName] = function () { | ||
}; | ||
}); | ||
} | ||
AgGridAurelia.prototype.attached = function () { | ||
// initialize the grid in the queue | ||
// because of bug in @children | ||
// https://github.com/aurelia/templating/issues/403 | ||
this.taskQueue.queueTask(this.initGrid.bind(this)); | ||
}; | ||
AgGridAurelia.prototype.initGrid = function () { | ||
this._initialised = false; | ||
this._destroyed = false; | ||
this.auFrameworkFactory.setContainer(this.container); | ||
this.auFrameworkFactory.setViewResources(this.viewResources); | ||
this.aureliaFrameworkComponentWrapper.setContainer(this.container); | ||
this.aureliaFrameworkComponentWrapper.setViewResources(this.viewResources); | ||
this.gridOptions = main_1.ComponentUtil.copyAttributesToGridOptions(this.gridOptions, this); | ||
this.gridParams = { | ||
globalEventListener: this.globalEventListener.bind(this), | ||
frameworkFactory: this.auFrameworkFactory, | ||
seedBeanInstances: { | ||
frameworkComponentWrapper: this.aureliaFrameworkComponentWrapper | ||
} | ||
}; | ||
if (this.columns && this.columns.length > 0) { | ||
this.gridOptions.columnDefs = this.columns | ||
.map(function (column) { | ||
return column.toColDef(); | ||
}); | ||
} | ||
if (this.fullWidthRowTemplate) { | ||
this.gridOptions.fullWidthCellRendererFramework = | ||
{ template: this.fullWidthRowTemplate.template }; | ||
} | ||
if (this.dateTemplate) { | ||
this.gridOptions.dateComponentFramework = | ||
{ template: this.dateTemplate.template }; | ||
} | ||
new main_1.Grid(this._nativeElement, this.gridOptions, this.gridParams); | ||
this.api = this.gridOptions.api; | ||
this.columnApi = this.gridOptions.columnApi; | ||
this._initialised = true; | ||
}; | ||
/** | ||
* Called by Aurelia whenever a bound property changes | ||
*/ | ||
AgGridAurelia.prototype.propertyChanged = function (propertyName, newValue, oldValue) { | ||
// emulate an Angular2 SimpleChanges Object | ||
var changes = {}; | ||
changes[propertyName] = { currentValue: newValue, previousValue: oldValue }; | ||
if (this._initialised) { | ||
main_1.ComponentUtil.processOnChange(changes, this.gridOptions, this.api, this.columnApi); | ||
} | ||
}; | ||
AgGridAurelia.prototype.detached = function () { | ||
if (this._initialised) { | ||
// need to do this before the destroy, so we know not to emit any events | ||
// while tearing down the grid. | ||
this._destroyed = true; | ||
this.api.destroy(); | ||
} | ||
}; | ||
AgGridAurelia.prototype.globalEventListener = function (eventType, event) { | ||
// if we are tearing down, don't emit events | ||
if (this._destroyed) { | ||
return; | ||
} | ||
// generically look up the eventType | ||
var emitter = this[eventType]; | ||
if (emitter) { | ||
emitter(event); | ||
} | ||
else { | ||
console.log('ag-Grid-aurelia: could not find EventEmitter: ' + eventType); | ||
} | ||
}; | ||
__decorate([ | ||
aurelia_framework_1.bindable(), | ||
__metadata("design:type", Object) | ||
], AgGridAurelia.prototype, "gridOptions", void 0); | ||
__decorate([ | ||
aurelia_framework_1.bindable(), | ||
__metadata("design:type", Object) | ||
], AgGridAurelia.prototype, "context", void 0); | ||
__decorate([ | ||
aurelia_framework_1.children('ag-grid-column'), | ||
__metadata("design:type", Array) | ||
], AgGridAurelia.prototype, "columns", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-full-width-row-template'), | ||
__metadata("design:type", agTemplate_1.AgFullWidthRowTemplate) | ||
], AgGridAurelia.prototype, "fullWidthRowTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-date-template'), | ||
__metadata("design:type", agTemplate_1.AgDateTemplate) | ||
], AgGridAurelia.prototype, "dateTemplate", void 0); | ||
AgGridAurelia = __decorate([ | ||
aurelia_framework_1.customElement('ag-grid-aurelia'), | ||
agUtils_1.generateBindables(main_1.ComponentUtil.ALL_PROPERTIES.filter(function (property) { return property !== 'gridOptions'; })), | ||
agUtils_1.generateBindables(main_1.ComponentUtil.EVENTS) | ||
// <slot> is required for @children to work. https://github.com/aurelia/templating/issues/451#issuecomment-254206622 | ||
, | ||
aurelia_framework_1.inlineView("<template><slot></slot></template>"), | ||
aurelia_framework_1.autoinject(), | ||
__metadata("design:paramtypes", [Element, | ||
aurelia_framework_1.TaskQueue, | ||
aureliaFrameworkFactory_1.AureliaFrameworkFactory, | ||
aurelia_framework_1.Container, | ||
aurelia_framework_1.ViewResources, | ||
aureliaFrameworkComponentWrapper_1.AureliaFrameworkComponentWrapper]) | ||
], AgGridAurelia); | ||
return AgGridAurelia; | ||
}()); | ||
exports.AgGridAurelia = AgGridAurelia; |
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,18 @@ | ||
// ag-grid-aurelia v15.0.0 | ||
import { ColDef } from "ag-grid/main"; | ||
import { AgCellTemplate, AgEditorTemplate, AgFilterTemplate, AgHeaderGroupTemplate, AgHeaderTemplate, AgPinnedRowTemplate } from "./agTemplate"; | ||
export declare class AgGridColumn { | ||
private mappedColumnProperties; | ||
childColumns: AgGridColumn[]; | ||
cellTemplate: AgCellTemplate; | ||
editorTemplate: AgEditorTemplate; | ||
filterTemplate: AgFilterTemplate; | ||
headerTemplate: AgHeaderTemplate; | ||
headerGroupTemplate: AgHeaderGroupTemplate; | ||
pinnedRowTemplate: AgPinnedRowTemplate; | ||
constructor(); | ||
hasChildColumns(): boolean; | ||
toColDef(): ColDef; | ||
private static getChildColDefs(childColumns); | ||
private createColDefFromGridColumn(); | ||
} |
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,150 @@ | ||
// ag-grid-aurelia v15.0.0 | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var aurelia_framework_1 = require("aurelia-framework"); | ||
var agTemplate_1 = require("./agTemplate"); | ||
var agUtils_1 = require("./agUtils"); | ||
var AgGridColumn = /** @class */ (function () { | ||
function AgGridColumn() { | ||
this.mappedColumnProperties = { | ||
"hideCol": "hide" // hide exists in aurelia-templating-resources and will conflict | ||
}; | ||
this.childColumns = []; | ||
} | ||
AgGridColumn_1 = AgGridColumn; | ||
AgGridColumn.prototype.hasChildColumns = function () { | ||
return this.childColumns && this.childColumns.length > 0; | ||
}; | ||
AgGridColumn.prototype.toColDef = function () { | ||
var _this = this; | ||
var colDef = this.createColDefFromGridColumn(); | ||
if (this.hasChildColumns()) { | ||
colDef["children"] = AgGridColumn_1.getChildColDefs(this.childColumns); | ||
} | ||
var defaultAction = function (templateName) { | ||
var self = _this; | ||
if (self[templateName]) { | ||
var frameworkName = templates[templateName].frameworkName; | ||
colDef[frameworkName] = { template: self[templateName].template }; | ||
delete colDef[templateName]; | ||
} | ||
}; | ||
var editorAction = function (templateName) { | ||
if (colDef.editable === undefined) { | ||
colDef.editable = true; | ||
} | ||
defaultAction(templateName); | ||
}; | ||
var templates = { | ||
cellTemplate: { | ||
frameworkName: 'cellRendererFramework' | ||
}, | ||
editorTemplate: { | ||
frameworkName: 'cellEditorFramework', | ||
action: editorAction | ||
}, | ||
filterTemplate: { | ||
frameworkName: 'filterFramework' | ||
}, | ||
headerTemplate: { | ||
frameworkName: 'headerComponentFramework' | ||
}, | ||
headerGroupTemplate: { | ||
frameworkName: 'headerGroupComponentFramework' | ||
}, | ||
pinnedRowTemplate: { | ||
frameworkName: 'pinnedRowCellRendererFramework' | ||
} | ||
}; | ||
var addTemplate = function (templateName) { | ||
var action = templates[templateName].action ? templates[templateName].action : defaultAction; | ||
action(templateName); | ||
}; | ||
Object.keys(templates) | ||
.forEach(addTemplate); | ||
return colDef; | ||
}; | ||
AgGridColumn.getChildColDefs = function (childColumns) { | ||
return childColumns | ||
.filter(function (column) { return !column.hasChildColumns(); }) | ||
.map(function (column) { | ||
return column.toColDef(); | ||
}); | ||
}; | ||
; | ||
AgGridColumn.prototype.createColDefFromGridColumn = function () { | ||
var colDef = {}; | ||
for (var prop in this) { | ||
var colDefProperty = this.mappedColumnProperties[prop] ? this.mappedColumnProperties[prop] : prop; | ||
colDef[colDefProperty] = this[prop]; | ||
} | ||
delete colDef.childColumns; | ||
return colDef; | ||
}; | ||
; | ||
__decorate([ | ||
aurelia_framework_1.children('ag-grid-column'), | ||
__metadata("design:type", Array) | ||
], AgGridColumn.prototype, "childColumns", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-cell-template'), | ||
__metadata("design:type", agTemplate_1.AgCellTemplate) | ||
], AgGridColumn.prototype, "cellTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-editor-template'), | ||
__metadata("design:type", agTemplate_1.AgEditorTemplate) | ||
], AgGridColumn.prototype, "editorTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-filter-template'), | ||
__metadata("design:type", agTemplate_1.AgFilterTemplate) | ||
], AgGridColumn.prototype, "filterTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-header-template'), | ||
__metadata("design:type", agTemplate_1.AgHeaderTemplate) | ||
], AgGridColumn.prototype, "headerTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-header-group-template'), | ||
__metadata("design:type", agTemplate_1.AgHeaderGroupTemplate) | ||
], AgGridColumn.prototype, "headerGroupTemplate", void 0); | ||
__decorate([ | ||
aurelia_framework_1.child('ag-pinned-row-template'), | ||
__metadata("design:type", agTemplate_1.AgPinnedRowTemplate) | ||
], AgGridColumn.prototype, "pinnedRowTemplate", void 0); | ||
AgGridColumn = AgGridColumn_1 = __decorate([ | ||
aurelia_framework_1.customElement('ag-grid-column'), | ||
agUtils_1.generateBindables(["colId", "sort", "sortedAt", "sortingOrder", "field", "headerValueGetter", "hideCol", "pinned", | ||
"tooltipField", "headerTooltip", "valueGetter", "keyCreator", | ||
"width", "minWidth", "maxWidth", "cellClass", "cellStyle", "cellRenderer", "cellRendererFramework", | ||
"cellRendererParams", "cellEditor", "cellEditorFramework", "cellEditorParams", "floatingCellRenderer", | ||
"floatingCellRendererFramework", "floatingCellRendererParams", "cellFormatter(", "floatingCellFormatter", | ||
"getQuickFilterText", "aggFunc", "rowGroupIndex", "pivotIndex", "comparator", "checkboxSelection", "suppressMenu", | ||
"suppressSorting", "suppressMovable", "suppressFilter", "unSortIcon", "suppressSizeToFit", "suppressResize", | ||
"suppressAutoSize", "enableRowGroup", "enablePivot", "enableValue", "editable", "suppressNavigable", "newValueHandler", | ||
"volatile", "filter", "filterFramework", "filterParams", "cellClassRules", "onCellValueChanged", "onCellClicked", | ||
"onCellDoubleClicked", "onCellContextMenu", "icons", "enableCellChangeFlash", "headerName", "columnGroupShow", | ||
"headerClass", "children", "groupId", "openByDefault", "marryChildren", "headerCheckboxSelection", | ||
"headerCheckboxSelectionFilteredOnly", "type", "tooltipField", "valueSetter", "pinnedRowCellRenderer", | ||
"pinnedRowCellRendererFramework", "pinnedRowCellRendererParams", "valueFormatter", "pinnedRowValueFormatter", | ||
"valueParser", "allowedAggFuncs", "rowGroup", "showRowGroup", "pivot", "equals", "pivotComparator", "menuTabs", | ||
"colSpan", "suppressPaste", "template", "templateUrl", "pivotValueColumn", "pivotTotalColumnIds", "headerComponent", | ||
"headerComponentFramework", "headerComponentParams", "floatingFilterComponent", "floatingFilterComponentParams", | ||
"floatingFilterComponentFramework"]) | ||
// <slot> is required for @children to work. https://github.com/aurelia/templating/issues/451#issuecomment-254206622 | ||
, | ||
aurelia_framework_1.inlineView("<template><slot></slot></template>"), | ||
aurelia_framework_1.autoinject(), | ||
__metadata("design:paramtypes", []) | ||
], AgGridColumn); | ||
return AgGridColumn; | ||
var AgGridColumn_1; | ||
}()); | ||
exports.AgGridColumn = AgGridColumn; |
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,34 @@ | ||
// ag-grid-aurelia v15.0.0 | ||
import { TargetInstruction } from "aurelia-framework"; | ||
export declare class AgCellTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgEditorTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgFilterTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgHeaderTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgHeaderGroupTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgPinnedRowTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgDateTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} | ||
export declare class AgFullWidthRowTemplate { | ||
template: string; | ||
constructor(targetInstruction: TargetInstruction); | ||
} |
Oops, something went wrong.