ag-grid-aurelia-plugin 31.3.5 → 31.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agGridAurelia.d.ts +35 -0
- package/lib/agGridAurelia.js +159 -0
- package/lib/agGridColumn.d.ts +18 -0
- package/lib/agGridColumn.js +155 -0
- package/lib/agTemplate.d.ts +34 -0
- package/lib/agTemplate.js +142 -0
- package/lib/agUtils.d.ts +2 -0
- package/lib/agUtils.js +22 -0
- package/lib/aureliaFrameworkComponentWrapper.d.ts +13 -0
- package/lib/aureliaFrameworkComponentWrapper.js +112 -0
- package/lib/aureliaFrameworkFactory.d.ts +21 -0
- package/lib/aureliaFrameworkFactory.js +50 -0
- package/package.json +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import type { GridOptions } from "ag-grid-community";
|
|
3
|
+
import { ColumnApi, GridApi } from "ag-grid-community";
|
|
4
|
+
import { ComponentAttached, ComponentDetached, Container, TaskQueue, ViewResources } from "aurelia-framework";
|
|
5
|
+
import { AureliaFrameworkFactory } from "./aureliaFrameworkFactory";
|
|
6
|
+
import { AgGridColumn } from "./agGridColumn";
|
|
7
|
+
import { AgDateTemplate, AgFullWidthRowTemplate } from './agTemplate';
|
|
8
|
+
import { AureliaFrameworkComponentWrapper } from "./aureliaFrameworkComponentWrapper";
|
|
9
|
+
export declare class AgGridAurelia implements ComponentAttached, ComponentDetached {
|
|
10
|
+
private taskQueue;
|
|
11
|
+
private auFrameworkFactory;
|
|
12
|
+
private container;
|
|
13
|
+
private viewResources;
|
|
14
|
+
private aureliaFrameworkComponentWrapper;
|
|
15
|
+
private _nativeElement;
|
|
16
|
+
private _initialised;
|
|
17
|
+
private _destroyed;
|
|
18
|
+
gridOptions: GridOptions;
|
|
19
|
+
context: any;
|
|
20
|
+
private gridParams;
|
|
21
|
+
api: GridApi;
|
|
22
|
+
columnApi: ColumnApi;
|
|
23
|
+
columns: AgGridColumn[];
|
|
24
|
+
fullWidthRowTemplate: AgFullWidthRowTemplate;
|
|
25
|
+
dateTemplate: AgDateTemplate;
|
|
26
|
+
constructor(element: Element, taskQueue: TaskQueue, auFrameworkFactory: AureliaFrameworkFactory, container: Container, viewResources: ViewResources, aureliaFrameworkComponentWrapper: AureliaFrameworkComponentWrapper);
|
|
27
|
+
attached(): void;
|
|
28
|
+
initGrid(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Called by Aurelia whenever a bound property changes
|
|
31
|
+
*/
|
|
32
|
+
propertyChanged(propertyName: string, newValue: any, oldValue: any): void;
|
|
33
|
+
detached(): void;
|
|
34
|
+
private globalEventListener;
|
|
35
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
import { ComponentUtil, Grid } from "ag-grid-community";
|
|
12
|
+
import { bindable, child, children, Container, customElement, inlineView, TaskQueue, ViewResources } from "aurelia-framework";
|
|
13
|
+
import { AureliaFrameworkFactory } from "./aureliaFrameworkFactory";
|
|
14
|
+
import { generateBindables } from "./agUtils";
|
|
15
|
+
import { AgDateTemplate, AgFullWidthRowTemplate } from './agTemplate';
|
|
16
|
+
import { AureliaFrameworkComponentWrapper } from "./aureliaFrameworkComponentWrapper";
|
|
17
|
+
let AgGridAurelia = class AgGridAurelia {
|
|
18
|
+
taskQueue;
|
|
19
|
+
auFrameworkFactory;
|
|
20
|
+
container;
|
|
21
|
+
viewResources;
|
|
22
|
+
aureliaFrameworkComponentWrapper;
|
|
23
|
+
// not intended for user to interact with. so putting _ in so if user gets reference
|
|
24
|
+
// to this object, they kind'a know it's not part of the agreed interface
|
|
25
|
+
_nativeElement;
|
|
26
|
+
_initialised = false;
|
|
27
|
+
_destroyed = false;
|
|
28
|
+
gridOptions;
|
|
29
|
+
context;
|
|
30
|
+
gridParams;
|
|
31
|
+
// making these public, so they are accessible to people using the aurelia component references
|
|
32
|
+
api;
|
|
33
|
+
columnApi;
|
|
34
|
+
columns = [];
|
|
35
|
+
fullWidthRowTemplate;
|
|
36
|
+
dateTemplate;
|
|
37
|
+
constructor(element, taskQueue, auFrameworkFactory, container, viewResources, aureliaFrameworkComponentWrapper) {
|
|
38
|
+
this.taskQueue = taskQueue;
|
|
39
|
+
this.auFrameworkFactory = auFrameworkFactory;
|
|
40
|
+
this.container = container;
|
|
41
|
+
this.viewResources = viewResources;
|
|
42
|
+
this.aureliaFrameworkComponentWrapper = aureliaFrameworkComponentWrapper;
|
|
43
|
+
this._nativeElement = element;
|
|
44
|
+
// create all the events generically. this is done generically so that
|
|
45
|
+
// if the list of grid events change, we don't need to change this code.
|
|
46
|
+
ComponentUtil.EVENTS.forEach((eventName) => {
|
|
47
|
+
//create an empty event
|
|
48
|
+
this[eventName] = () => {
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
attached() {
|
|
53
|
+
// initialize the grid in the queue
|
|
54
|
+
// because of bug in @children
|
|
55
|
+
// https://github.com/aurelia/templating/issues/403
|
|
56
|
+
this.taskQueue.queueTask(this.initGrid.bind(this));
|
|
57
|
+
}
|
|
58
|
+
initGrid() {
|
|
59
|
+
this._initialised = false;
|
|
60
|
+
this._destroyed = false;
|
|
61
|
+
this.auFrameworkFactory.setContainer(this.container);
|
|
62
|
+
this.auFrameworkFactory.setViewResources(this.viewResources);
|
|
63
|
+
this.aureliaFrameworkComponentWrapper.setContainer(this.container);
|
|
64
|
+
this.aureliaFrameworkComponentWrapper.setViewResources(this.viewResources);
|
|
65
|
+
this.gridParams = {
|
|
66
|
+
globalEventListener: this.globalEventListener.bind(this),
|
|
67
|
+
frameworkFactory: this.auFrameworkFactory,
|
|
68
|
+
seedBeanInstances: {
|
|
69
|
+
frameworkComponentWrapper: this.aureliaFrameworkComponentWrapper
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
if (this.columns && this.columns.length > 0) {
|
|
73
|
+
this.gridOptions.columnDefs = this.columns
|
|
74
|
+
.map((column) => {
|
|
75
|
+
return column.toColDef();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (this.fullWidthRowTemplate) {
|
|
79
|
+
this.gridOptions.fullWidthCellRenderer =
|
|
80
|
+
{ template: this.fullWidthRowTemplate.template };
|
|
81
|
+
}
|
|
82
|
+
if (this.dateTemplate) {
|
|
83
|
+
this.gridOptions.dateComponentFramework =
|
|
84
|
+
{ template: this.dateTemplate.template };
|
|
85
|
+
}
|
|
86
|
+
new Grid(this._nativeElement, this.gridOptions, this.gridParams);
|
|
87
|
+
this.api = this.gridOptions.api;
|
|
88
|
+
this.columnApi = this.gridOptions.columnApi;
|
|
89
|
+
this._initialised = true;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Called by Aurelia whenever a bound property changes
|
|
93
|
+
*/
|
|
94
|
+
propertyChanged(propertyName, newValue, oldValue) {
|
|
95
|
+
// emulate an Angular2 SimpleChanges Object
|
|
96
|
+
let changes = {};
|
|
97
|
+
changes[propertyName] = { currentValue: newValue, previousValue: oldValue };
|
|
98
|
+
if (this._initialised) {
|
|
99
|
+
ComponentUtil.processOnChange(changes, this.api);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
detached() {
|
|
103
|
+
if (this._initialised) {
|
|
104
|
+
// need to do this before the destroy, so we know not to emit any events
|
|
105
|
+
// while tearing down the grid.
|
|
106
|
+
this._destroyed = true;
|
|
107
|
+
this.api.destroy();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
globalEventListener(eventType, event) {
|
|
111
|
+
// if we are tearing down, don't emit events
|
|
112
|
+
if (this._destroyed) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
// generically look up the eventType
|
|
116
|
+
let emitter = this[eventType];
|
|
117
|
+
if (emitter) {
|
|
118
|
+
emitter(event);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.log('ag-Grid-aurelia: could not find EventEmitter: ' + eventType);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
__decorate([
|
|
126
|
+
bindable(),
|
|
127
|
+
__metadata("design:type", Object)
|
|
128
|
+
], AgGridAurelia.prototype, "gridOptions", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
bindable(),
|
|
131
|
+
__metadata("design:type", Object)
|
|
132
|
+
], AgGridAurelia.prototype, "context", void 0);
|
|
133
|
+
__decorate([
|
|
134
|
+
children('ag-grid-column'),
|
|
135
|
+
__metadata("design:type", Array)
|
|
136
|
+
], AgGridAurelia.prototype, "columns", void 0);
|
|
137
|
+
__decorate([
|
|
138
|
+
child('ag-full-width-row-template'),
|
|
139
|
+
__metadata("design:type", AgFullWidthRowTemplate)
|
|
140
|
+
], AgGridAurelia.prototype, "fullWidthRowTemplate", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
child('ag-date-template'),
|
|
143
|
+
__metadata("design:type", AgDateTemplate)
|
|
144
|
+
], AgGridAurelia.prototype, "dateTemplate", void 0);
|
|
145
|
+
AgGridAurelia = __decorate([
|
|
146
|
+
customElement('ag-grid-aurelia'),
|
|
147
|
+
generateBindables(ComponentUtil.ALL_PROPERTIES.filter((property) => property !== 'gridOptions')),
|
|
148
|
+
generateBindables(ComponentUtil.EVENTS)
|
|
149
|
+
// <slot> is required for @children to work. https://github.com/aurelia/templating/issues/451#issuecomment-254206622
|
|
150
|
+
,
|
|
151
|
+
inlineView(`<template><slot></slot></template>`),
|
|
152
|
+
__metadata("design:paramtypes", [Element,
|
|
153
|
+
TaskQueue,
|
|
154
|
+
AureliaFrameworkFactory,
|
|
155
|
+
Container,
|
|
156
|
+
ViewResources,
|
|
157
|
+
AureliaFrameworkComponentWrapper])
|
|
158
|
+
], AgGridAurelia);
|
|
159
|
+
export { AgGridAurelia };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import { ColDef } from "ag-grid-community";
|
|
3
|
+
import { AgCellTemplate, AgEditorTemplate, AgFilterTemplate, AgHeaderGroupTemplate, AgHeaderTemplate, AgPinnedRowTemplate } from "./agTemplate";
|
|
4
|
+
export declare class AgGridColumn {
|
|
5
|
+
private mappedColumnProperties;
|
|
6
|
+
childColumns: AgGridColumn[];
|
|
7
|
+
cellTemplate: AgCellTemplate;
|
|
8
|
+
editorTemplate: AgEditorTemplate;
|
|
9
|
+
filterTemplate: AgFilterTemplate;
|
|
10
|
+
headerTemplate: AgHeaderTemplate;
|
|
11
|
+
headerGroupTemplate: AgHeaderGroupTemplate;
|
|
12
|
+
pinnedRowTemplate: AgPinnedRowTemplate;
|
|
13
|
+
constructor();
|
|
14
|
+
hasChildColumns(): boolean;
|
|
15
|
+
toColDef(): ColDef;
|
|
16
|
+
private static getChildColDefs;
|
|
17
|
+
private createColDefFromGridColumn;
|
|
18
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var AgGridColumn_1;
|
|
12
|
+
import { autoinject, child, children, customElement, inlineView } from "aurelia-framework";
|
|
13
|
+
import { AgCellTemplate, AgEditorTemplate, AgFilterTemplate, AgHeaderGroupTemplate, AgHeaderTemplate, AgPinnedRowTemplate } from "./agTemplate";
|
|
14
|
+
import { generateBindables } from "./agUtils";
|
|
15
|
+
let AgGridColumn = AgGridColumn_1 = class AgGridColumn {
|
|
16
|
+
mappedColumnProperties = {
|
|
17
|
+
"hideCol": "hide" // hide exists in aurelia-templating-resources and will conflict
|
|
18
|
+
};
|
|
19
|
+
childColumns = [];
|
|
20
|
+
cellTemplate;
|
|
21
|
+
editorTemplate;
|
|
22
|
+
filterTemplate;
|
|
23
|
+
headerTemplate;
|
|
24
|
+
headerGroupTemplate;
|
|
25
|
+
pinnedRowTemplate;
|
|
26
|
+
constructor() {
|
|
27
|
+
}
|
|
28
|
+
hasChildColumns() {
|
|
29
|
+
return this.childColumns && this.childColumns.length > 0;
|
|
30
|
+
}
|
|
31
|
+
toColDef() {
|
|
32
|
+
let colDef = this.createColDefFromGridColumn();
|
|
33
|
+
if (this.hasChildColumns()) {
|
|
34
|
+
colDef["children"] = AgGridColumn_1.getChildColDefs(this.childColumns);
|
|
35
|
+
}
|
|
36
|
+
const defaultAction = (templateName) => {
|
|
37
|
+
let self = this;
|
|
38
|
+
if (self[templateName]) {
|
|
39
|
+
const frameworkName = templates[templateName].frameworkName;
|
|
40
|
+
colDef[frameworkName] = { template: self[templateName].template };
|
|
41
|
+
delete colDef[templateName];
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const editorAction = (templateName) => {
|
|
45
|
+
if (colDef.editable === undefined) {
|
|
46
|
+
colDef.editable = true;
|
|
47
|
+
}
|
|
48
|
+
defaultAction(templateName);
|
|
49
|
+
};
|
|
50
|
+
const templates = {
|
|
51
|
+
cellTemplate: {
|
|
52
|
+
frameworkName: 'cellRendererFramework'
|
|
53
|
+
},
|
|
54
|
+
editorTemplate: {
|
|
55
|
+
frameworkName: 'cellEditorFramework',
|
|
56
|
+
action: editorAction
|
|
57
|
+
},
|
|
58
|
+
filterTemplate: {
|
|
59
|
+
frameworkName: 'filterFramework'
|
|
60
|
+
},
|
|
61
|
+
headerTemplate: {
|
|
62
|
+
frameworkName: 'headerComponentFramework'
|
|
63
|
+
},
|
|
64
|
+
headerGroupTemplate: {
|
|
65
|
+
frameworkName: 'headerGroupComponentFramework'
|
|
66
|
+
},
|
|
67
|
+
pinnedRowTemplate: {
|
|
68
|
+
frameworkName: 'pinnedRowCellRendererFramework'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const addTemplate = (templateName) => {
|
|
72
|
+
const action = templates[templateName].action ? templates[templateName].action : defaultAction;
|
|
73
|
+
action(templateName);
|
|
74
|
+
};
|
|
75
|
+
Object.keys(templates)
|
|
76
|
+
.forEach(addTemplate);
|
|
77
|
+
return colDef;
|
|
78
|
+
}
|
|
79
|
+
static getChildColDefs(childColumns) {
|
|
80
|
+
return childColumns
|
|
81
|
+
.filter(column => !column.hasChildColumns())
|
|
82
|
+
.map((column) => {
|
|
83
|
+
return column.toColDef();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
;
|
|
87
|
+
createColDefFromGridColumn() {
|
|
88
|
+
let colDef = {};
|
|
89
|
+
for (let prop in this) {
|
|
90
|
+
// only map this property if it's been actually been set
|
|
91
|
+
if (this[prop] === undefined) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
let colDefProperty = this.mappedColumnProperties[prop] ? this.mappedColumnProperties[prop] : prop;
|
|
95
|
+
colDef[colDefProperty] = this[prop];
|
|
96
|
+
}
|
|
97
|
+
delete colDef.childColumns;
|
|
98
|
+
return colDef;
|
|
99
|
+
}
|
|
100
|
+
;
|
|
101
|
+
};
|
|
102
|
+
__decorate([
|
|
103
|
+
children('ag-grid-column'),
|
|
104
|
+
__metadata("design:type", Array)
|
|
105
|
+
], AgGridColumn.prototype, "childColumns", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
child('ag-cell-template'),
|
|
108
|
+
__metadata("design:type", AgCellTemplate)
|
|
109
|
+
], AgGridColumn.prototype, "cellTemplate", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
child('ag-editor-template'),
|
|
112
|
+
__metadata("design:type", AgEditorTemplate)
|
|
113
|
+
], AgGridColumn.prototype, "editorTemplate", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
child('ag-filter-template'),
|
|
116
|
+
__metadata("design:type", AgFilterTemplate)
|
|
117
|
+
], AgGridColumn.prototype, "filterTemplate", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
child('ag-header-template'),
|
|
120
|
+
__metadata("design:type", AgHeaderTemplate)
|
|
121
|
+
], AgGridColumn.prototype, "headerTemplate", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
child('ag-header-group-template'),
|
|
124
|
+
__metadata("design:type", AgHeaderGroupTemplate)
|
|
125
|
+
], AgGridColumn.prototype, "headerGroupTemplate", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
child('ag-pinned-row-template'),
|
|
128
|
+
__metadata("design:type", AgPinnedRowTemplate)
|
|
129
|
+
], AgGridColumn.prototype, "pinnedRowTemplate", void 0);
|
|
130
|
+
AgGridColumn = AgGridColumn_1 = __decorate([
|
|
131
|
+
customElement('ag-grid-column'),
|
|
132
|
+
generateBindables(["colId", "sort", "sortedAt", "sortingOrder", "field", "headerValueGetter", "hideCol", "pinned",
|
|
133
|
+
"tooltipField", "headerTooltip", "valueGetter", "keyCreator", "floatingFilterComponentFramework", "rowDrag",
|
|
134
|
+
"width", "minWidth", "maxWidth", "cellClass", "cellStyle", "cellRenderer", "cellRendererFramework",
|
|
135
|
+
"cellRendererParams", "cellEditor", "cellEditorFramework", "cellEditorParams", "floatingCellRenderer",
|
|
136
|
+
"floatingCellRendererFramework", "floatingCellRendererParams", "cellFormatter", "floatingCellFormatter",
|
|
137
|
+
"getQuickFilterText", "aggFunc", "rowGroupIndex", "pivotIndex", "comparator", "checkboxSelection", "suppressMenu",
|
|
138
|
+
"suppressSorting", "suppressMovable", "suppressFilter", "unSortIcon", "suppressSizeToFit", "suppressResize",
|
|
139
|
+
"suppressAutoSize", "suppressToolPanel", "suppressKeyboardEvent", "enableRowGroup", "enablePivot", "enableValue",
|
|
140
|
+
"editable", "suppressNavigable", "newValueHandler", "volatile", "filter", "filterFramework", "filterParams",
|
|
141
|
+
"cellClassRules", "onCellValueChanged", "onCellClicked", "onCellDoubleClicked", "onCellContextMenu", "icons",
|
|
142
|
+
"enableCellChangeFlash", "headerName", "columnGroupShow", "headerClass", "toolPanelClass", "children", "groupId", "openByDefault",
|
|
143
|
+
"marryChildren", "headerCheckboxSelection", "headerCheckboxSelectionFilteredOnly", "type", "valueSetter",
|
|
144
|
+
"pinnedRowCellRenderer", "pinnedRowCellRendererFramework", "pinnedRowCellRendererParams", "valueFormatter",
|
|
145
|
+
"pinnedRowValueFormatter", "valueParser", "allowedAggFuncs", "rowGroup", "showRowGroup", "pivot", "equals", "pivotComparator",
|
|
146
|
+
"menuTabs", "colSpan", "suppressPaste", "template", "templateUrl", "pivotValueColumn", "pivotTotalColumnIds", "headerComponent",
|
|
147
|
+
"headerComponentFramework", "headerComponentParams", "floatingFilterComponent", "floatingFilterComponentParams",
|
|
148
|
+
"lockPinned"])
|
|
149
|
+
// <slot> is required for @children to work. https://github.com/aurelia/templating/issues/451#issuecomment-254206622
|
|
150
|
+
,
|
|
151
|
+
inlineView(`<template><slot></slot></template>`),
|
|
152
|
+
autoinject(),
|
|
153
|
+
__metadata("design:paramtypes", [])
|
|
154
|
+
], AgGridColumn);
|
|
155
|
+
export { AgGridColumn };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import { TargetInstruction } from "aurelia-framework";
|
|
3
|
+
export declare class AgCellTemplate {
|
|
4
|
+
template: string;
|
|
5
|
+
constructor(targetInstruction: TargetInstruction);
|
|
6
|
+
}
|
|
7
|
+
export declare class AgEditorTemplate {
|
|
8
|
+
template: string;
|
|
9
|
+
constructor(targetInstruction: TargetInstruction);
|
|
10
|
+
}
|
|
11
|
+
export declare class AgFilterTemplate {
|
|
12
|
+
template: string;
|
|
13
|
+
constructor(targetInstruction: TargetInstruction);
|
|
14
|
+
}
|
|
15
|
+
export declare class AgHeaderTemplate {
|
|
16
|
+
template: string;
|
|
17
|
+
constructor(targetInstruction: TargetInstruction);
|
|
18
|
+
}
|
|
19
|
+
export declare class AgHeaderGroupTemplate {
|
|
20
|
+
template: string;
|
|
21
|
+
constructor(targetInstruction: TargetInstruction);
|
|
22
|
+
}
|
|
23
|
+
export declare class AgPinnedRowTemplate {
|
|
24
|
+
template: string;
|
|
25
|
+
constructor(targetInstruction: TargetInstruction);
|
|
26
|
+
}
|
|
27
|
+
export declare class AgDateTemplate {
|
|
28
|
+
template: string;
|
|
29
|
+
constructor(targetInstruction: TargetInstruction);
|
|
30
|
+
}
|
|
31
|
+
export declare class AgFullWidthRowTemplate {
|
|
32
|
+
template: string;
|
|
33
|
+
constructor(targetInstruction: TargetInstruction);
|
|
34
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
import { autoinject, customElement, noView, processContent, TargetInstruction } from "aurelia-framework";
|
|
12
|
+
/**
|
|
13
|
+
* Function will move the elements innerHtml to a template property
|
|
14
|
+
* and then remove html from the element so that Aurelia will not render
|
|
15
|
+
* the template elements
|
|
16
|
+
* @param compiler
|
|
17
|
+
* @param resources
|
|
18
|
+
* @param element
|
|
19
|
+
* @param instruction
|
|
20
|
+
*/
|
|
21
|
+
function parseElement(compiler, resources, element, instruction) {
|
|
22
|
+
let html = element.innerHTML;
|
|
23
|
+
if (html !== '') {
|
|
24
|
+
instruction.template = html;
|
|
25
|
+
}
|
|
26
|
+
element.innerHTML = '';
|
|
27
|
+
}
|
|
28
|
+
function getTemplate(targetInstruction) {
|
|
29
|
+
return `<template>` + targetInstruction.elementInstruction.template + `</template>`;
|
|
30
|
+
}
|
|
31
|
+
let AgCellTemplate = class AgCellTemplate {
|
|
32
|
+
template;
|
|
33
|
+
constructor(targetInstruction) {
|
|
34
|
+
this.template = getTemplate(targetInstruction);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
AgCellTemplate = __decorate([
|
|
38
|
+
customElement('ag-cell-template'),
|
|
39
|
+
noView(),
|
|
40
|
+
autoinject(),
|
|
41
|
+
processContent(parseElement),
|
|
42
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
43
|
+
], AgCellTemplate);
|
|
44
|
+
export { AgCellTemplate };
|
|
45
|
+
let AgEditorTemplate = class AgEditorTemplate {
|
|
46
|
+
template;
|
|
47
|
+
constructor(targetInstruction) {
|
|
48
|
+
this.template = getTemplate(targetInstruction);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
AgEditorTemplate = __decorate([
|
|
52
|
+
customElement('ag-editor-template'),
|
|
53
|
+
noView(),
|
|
54
|
+
autoinject(),
|
|
55
|
+
processContent(parseElement),
|
|
56
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
57
|
+
], AgEditorTemplate);
|
|
58
|
+
export { AgEditorTemplate };
|
|
59
|
+
let AgFilterTemplate = class AgFilterTemplate {
|
|
60
|
+
template;
|
|
61
|
+
constructor(targetInstruction) {
|
|
62
|
+
this.template = getTemplate(targetInstruction);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
AgFilterTemplate = __decorate([
|
|
66
|
+
customElement('ag-filter-template'),
|
|
67
|
+
noView(),
|
|
68
|
+
autoinject(),
|
|
69
|
+
processContent(parseElement),
|
|
70
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
71
|
+
], AgFilterTemplate);
|
|
72
|
+
export { AgFilterTemplate };
|
|
73
|
+
let AgHeaderTemplate = class AgHeaderTemplate {
|
|
74
|
+
template;
|
|
75
|
+
constructor(targetInstruction) {
|
|
76
|
+
this.template = getTemplate(targetInstruction);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
AgHeaderTemplate = __decorate([
|
|
80
|
+
customElement('ag-header-template'),
|
|
81
|
+
noView(),
|
|
82
|
+
autoinject(),
|
|
83
|
+
processContent(parseElement),
|
|
84
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
85
|
+
], AgHeaderTemplate);
|
|
86
|
+
export { AgHeaderTemplate };
|
|
87
|
+
let AgHeaderGroupTemplate = class AgHeaderGroupTemplate {
|
|
88
|
+
template;
|
|
89
|
+
constructor(targetInstruction) {
|
|
90
|
+
this.template = getTemplate(targetInstruction);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
AgHeaderGroupTemplate = __decorate([
|
|
94
|
+
customElement('ag-header-group-template'),
|
|
95
|
+
noView(),
|
|
96
|
+
autoinject(),
|
|
97
|
+
processContent(parseElement),
|
|
98
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
99
|
+
], AgHeaderGroupTemplate);
|
|
100
|
+
export { AgHeaderGroupTemplate };
|
|
101
|
+
let AgPinnedRowTemplate = class AgPinnedRowTemplate {
|
|
102
|
+
template;
|
|
103
|
+
constructor(targetInstruction) {
|
|
104
|
+
this.template = getTemplate(targetInstruction);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
AgPinnedRowTemplate = __decorate([
|
|
108
|
+
customElement('ag-pinned-row-template'),
|
|
109
|
+
noView(),
|
|
110
|
+
autoinject(),
|
|
111
|
+
processContent(parseElement),
|
|
112
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
113
|
+
], AgPinnedRowTemplate);
|
|
114
|
+
export { AgPinnedRowTemplate };
|
|
115
|
+
let AgDateTemplate = class AgDateTemplate {
|
|
116
|
+
template;
|
|
117
|
+
constructor(targetInstruction) {
|
|
118
|
+
this.template = getTemplate(targetInstruction);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
AgDateTemplate = __decorate([
|
|
122
|
+
customElement('ag-date-template'),
|
|
123
|
+
noView(),
|
|
124
|
+
autoinject(),
|
|
125
|
+
processContent(parseElement),
|
|
126
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
127
|
+
], AgDateTemplate);
|
|
128
|
+
export { AgDateTemplate };
|
|
129
|
+
let AgFullWidthRowTemplate = class AgFullWidthRowTemplate {
|
|
130
|
+
template;
|
|
131
|
+
constructor(targetInstruction) {
|
|
132
|
+
this.template = getTemplate(targetInstruction);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
AgFullWidthRowTemplate = __decorate([
|
|
136
|
+
customElement('ag-full-width-row-template'),
|
|
137
|
+
noView(),
|
|
138
|
+
autoinject(),
|
|
139
|
+
processContent(parseElement),
|
|
140
|
+
__metadata("design:paramtypes", [TargetInstruction])
|
|
141
|
+
], AgFullWidthRowTemplate);
|
|
142
|
+
export { AgFullWidthRowTemplate };
|
package/lib/agUtils.d.ts
ADDED
package/lib/agUtils.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import { BindableProperty, HtmlBehaviorResource, metadata } from "aurelia-framework";
|
|
3
|
+
export function generateBindables(names, bindingModeToUse) {
|
|
4
|
+
return function (target, key, descriptor) {
|
|
5
|
+
// get or create the HtmlBehaviorResource
|
|
6
|
+
// on which we're going to create the BindableProperty's
|
|
7
|
+
let behaviorResource = metadata.getOrCreateOwn(metadata.resource, HtmlBehaviorResource, target);
|
|
8
|
+
let nameOrConfigOrTargets = names.map((name) => {
|
|
9
|
+
let nameOrConfigOrTarget = {
|
|
10
|
+
name: name
|
|
11
|
+
};
|
|
12
|
+
if (bindingModeToUse) {
|
|
13
|
+
nameOrConfigOrTarget["defaultBindingMode"] = bindingModeToUse;
|
|
14
|
+
}
|
|
15
|
+
return nameOrConfigOrTarget;
|
|
16
|
+
});
|
|
17
|
+
nameOrConfigOrTargets.forEach((nameOrConfigOrTarget) => {
|
|
18
|
+
let prop = new BindableProperty(nameOrConfigOrTarget);
|
|
19
|
+
prop.registerWith(target, behaviorResource, descriptor);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import { Container, TaskQueue, ViewCompiler, ViewResources } from "aurelia-framework";
|
|
3
|
+
import { BaseComponentWrapper, FrameworkComponentWrapper, WrappableInterface } from 'ag-grid-community';
|
|
4
|
+
export declare class AureliaFrameworkComponentWrapper extends BaseComponentWrapper<WrappableInterface> implements FrameworkComponentWrapper {
|
|
5
|
+
private taskQueue;
|
|
6
|
+
private _viewCompiler;
|
|
7
|
+
private _container;
|
|
8
|
+
private _viewResources;
|
|
9
|
+
constructor(taskQueue: TaskQueue, _viewCompiler: ViewCompiler);
|
|
10
|
+
createWrapper(template: any): WrappableInterface;
|
|
11
|
+
setContainer(container: Container): void;
|
|
12
|
+
setViewResources(viewResources: ViewResources): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
import { autoinject, TaskQueue, transient, ViewCompiler } from "aurelia-framework";
|
|
12
|
+
import { BaseComponentWrapper, Bean } from 'ag-grid-community';
|
|
13
|
+
let AureliaFrameworkComponentWrapper = class AureliaFrameworkComponentWrapper extends BaseComponentWrapper {
|
|
14
|
+
taskQueue;
|
|
15
|
+
_viewCompiler;
|
|
16
|
+
_container;
|
|
17
|
+
_viewResources;
|
|
18
|
+
constructor(taskQueue, _viewCompiler) {
|
|
19
|
+
super();
|
|
20
|
+
this.taskQueue = taskQueue;
|
|
21
|
+
this._viewCompiler = _viewCompiler;
|
|
22
|
+
}
|
|
23
|
+
createWrapper(template) {
|
|
24
|
+
let that = this;
|
|
25
|
+
class DynamicComponent extends BaseGuiComponent {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(that.taskQueue, that._viewCompiler);
|
|
28
|
+
}
|
|
29
|
+
init(params) {
|
|
30
|
+
super.init(params, template.template, that._viewResources, that._container);
|
|
31
|
+
}
|
|
32
|
+
hasMethod(name) {
|
|
33
|
+
return wrapper.getFrameworkComponentInstance() && wrapper.getFrameworkComponentInstance()[name] != null;
|
|
34
|
+
}
|
|
35
|
+
callMethod(name, args) {
|
|
36
|
+
const componentRef = this.getFrameworkComponentInstance();
|
|
37
|
+
return wrapper.getFrameworkComponentInstance()[name].apply(componentRef, args);
|
|
38
|
+
}
|
|
39
|
+
addMethod(name, callback) {
|
|
40
|
+
wrapper[name] = callback;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const wrapper = new DynamicComponent();
|
|
44
|
+
return wrapper;
|
|
45
|
+
}
|
|
46
|
+
setContainer(container) {
|
|
47
|
+
this._container = container;
|
|
48
|
+
}
|
|
49
|
+
setViewResources(viewResources) {
|
|
50
|
+
this._viewResources = viewResources;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
AureliaFrameworkComponentWrapper = __decorate([
|
|
54
|
+
autoinject(),
|
|
55
|
+
transient(),
|
|
56
|
+
Bean("frameworkComponentWrapper"),
|
|
57
|
+
__metadata("design:paramtypes", [TaskQueue, ViewCompiler])
|
|
58
|
+
], AureliaFrameworkComponentWrapper);
|
|
59
|
+
export { AureliaFrameworkComponentWrapper };
|
|
60
|
+
class BaseGuiComponent {
|
|
61
|
+
_taskQueue;
|
|
62
|
+
_viewCompiler;
|
|
63
|
+
_params;
|
|
64
|
+
_view;
|
|
65
|
+
constructor(taskQueue, viewCompiler) {
|
|
66
|
+
this._taskQueue = taskQueue;
|
|
67
|
+
this._viewCompiler = viewCompiler;
|
|
68
|
+
}
|
|
69
|
+
init(params, template, viewResources, container) {
|
|
70
|
+
this._params = params;
|
|
71
|
+
let bindingContext = { params: params };
|
|
72
|
+
let viewFactory = this._viewCompiler.compile(template, viewResources);
|
|
73
|
+
this._view = viewFactory.create(container);
|
|
74
|
+
let controllers = this._view.controllers;
|
|
75
|
+
//initialize each controller
|
|
76
|
+
if (controllers && controllers.length) {
|
|
77
|
+
controllers.forEach((c) => {
|
|
78
|
+
c.viewModel.params = params;
|
|
79
|
+
});
|
|
80
|
+
this._view.bind(bindingContext);
|
|
81
|
+
//ICellRenderer doesn't have a guiAttached method so
|
|
82
|
+
//we call attach on the queue;
|
|
83
|
+
this._taskQueue.queueMicroTask(() => this._view.attached());
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this._view.bind(bindingContext);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
getGui() {
|
|
90
|
+
return this._view.fragment;
|
|
91
|
+
}
|
|
92
|
+
destroy() {
|
|
93
|
+
this._view.returnToCache();
|
|
94
|
+
}
|
|
95
|
+
refresh(params) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
getFrameworkComponentInstance() {
|
|
99
|
+
let controllers = this._view.controllers;
|
|
100
|
+
//only one controller is allowed in editor template
|
|
101
|
+
if (controllers &&
|
|
102
|
+
controllers.length == 1 &&
|
|
103
|
+
controllers[0].viewModel) {
|
|
104
|
+
let editorVm = controllers[0].viewModel;
|
|
105
|
+
//this is a 'hack' because we don't have params.bind="" in the template
|
|
106
|
+
//must reset params or it will be nothing
|
|
107
|
+
editorVm.params = this._params;
|
|
108
|
+
return editorVm;
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
import { Container, ViewResources } from "aurelia-framework";
|
|
3
|
+
import { IFrameworkOverrides, AgPromise, FrameworkOverridesIncomingSource } from "ag-grid-community";
|
|
4
|
+
export declare class AureliaFrameworkFactory implements IFrameworkOverrides {
|
|
5
|
+
setInterval(action: any, interval?: any): AgPromise<number>;
|
|
6
|
+
addEventListener(element: HTMLElement, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
7
|
+
wrapIncoming: <T>(callback: () => T, source?: FrameworkOverridesIncomingSource) => T;
|
|
8
|
+
wrapOutgoing: <T>(callback: () => T) => T;
|
|
9
|
+
shouldWrapOutgoing?: boolean;
|
|
10
|
+
frameworkComponent(name: string, components?: any): void;
|
|
11
|
+
isFrameworkComponent(comp: any): boolean;
|
|
12
|
+
renderingEngine: "vanilla" | "react";
|
|
13
|
+
getDocLink(path?: string): string;
|
|
14
|
+
private _container;
|
|
15
|
+
private _viewResources;
|
|
16
|
+
private _baseFrameworkFactory;
|
|
17
|
+
setContainer(container: Container): void;
|
|
18
|
+
setViewResources(viewResources: ViewResources): void;
|
|
19
|
+
setTimeout(action: any, timeout?: any): void;
|
|
20
|
+
addEventListenerOutsideAngular(element: HTMLElement, type: string, listener: EventListener | EventListenerObject, useCapture?: boolean): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// ag-grid-aurelia-plugin v31.3.4
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
import { autoinject, transient } from "aurelia-framework";
|
|
9
|
+
import { VanillaFrameworkOverrides } from "ag-grid-community";
|
|
10
|
+
let AureliaFrameworkFactory = class AureliaFrameworkFactory {
|
|
11
|
+
setInterval(action, interval) {
|
|
12
|
+
throw new Error("Method not implemented.");
|
|
13
|
+
}
|
|
14
|
+
addEventListener(element, type, listener, options) {
|
|
15
|
+
throw new Error("Method not implemented.");
|
|
16
|
+
}
|
|
17
|
+
wrapIncoming;
|
|
18
|
+
wrapOutgoing;
|
|
19
|
+
shouldWrapOutgoing;
|
|
20
|
+
frameworkComponent(name, components) {
|
|
21
|
+
throw new Error("Method not implemented.");
|
|
22
|
+
}
|
|
23
|
+
isFrameworkComponent(comp) {
|
|
24
|
+
throw new Error("Method not implemented.");
|
|
25
|
+
}
|
|
26
|
+
renderingEngine;
|
|
27
|
+
getDocLink(path) {
|
|
28
|
+
throw new Error("Method not implemented.");
|
|
29
|
+
}
|
|
30
|
+
_container;
|
|
31
|
+
_viewResources;
|
|
32
|
+
_baseFrameworkFactory = new VanillaFrameworkOverrides(); // todo - inject this
|
|
33
|
+
setContainer(container) {
|
|
34
|
+
this._container = container;
|
|
35
|
+
}
|
|
36
|
+
setViewResources(viewResources) {
|
|
37
|
+
this._viewResources = viewResources;
|
|
38
|
+
}
|
|
39
|
+
setTimeout(action, timeout) {
|
|
40
|
+
window.setTimeout(action, timeout);
|
|
41
|
+
}
|
|
42
|
+
addEventListenerOutsideAngular(element, type, listener, useCapture) {
|
|
43
|
+
element.addEventListener(type, listener, useCapture);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
AureliaFrameworkFactory = __decorate([
|
|
47
|
+
autoinject(),
|
|
48
|
+
transient()
|
|
49
|
+
], AureliaFrameworkFactory);
|
|
50
|
+
export { AureliaFrameworkFactory };
|
package/package.json
CHANGED