Skip to content

Commit df365d9

Browse files
authored
Merge pull request #45 from vegarringdal/master
Update grid to 0.2.0
2 parents 7d74fe5 + a1c2d31 commit df365d9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1064
-263
lines changed

config.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ System.config({
1515
},
1616

1717
map: {
18-
"aurelia-framework": "npm:aurelia-framework@1.0.0-rc.1.0.1",
18+
"aurelia-framework": "npm:aurelia-framework@1.0.0-rc.1.0.6",
1919
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0",
20-
"aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0-rc.1.0.0",
20+
"aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0-rc.1.0.1",
2121
"aurelia-polyfills": "npm:aurelia-polyfills@1.0.0-rc.1.0.0",
2222
"babel": "npm:babel-core@5.8.38",
2323
"babel-runtime": "npm:babel-runtime@5.8.38",
24-
"core-js": "npm:core-js@2.4.0",
24+
"core-js": "npm:core-js@2.4.1",
2525
"jquery": "github:components/jquery@2.2.4",
2626
"jquery.min": "github:components/jquery@2.2.4",
2727
"polymer/mutationobservers": "github:polymer/mutationobservers@0.4.2",
@@ -52,35 +52,35 @@ System.config({
5252
"process": "github:jspm/nodelibs-process@0.1.2",
5353
"util": "npm:util@0.10.3"
5454
},
55-
"npm:aurelia-binding@1.0.0-rc.1.0.2": {
56-
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0",
57-
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0",
55+
"npm:aurelia-binding@1.0.0-rc.1.0.3": {
56+
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.1",
57+
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.1",
5858
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0",
5959
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0"
6060
},
61-
"npm:aurelia-dependency-injection@1.0.0-rc.1.0.0": {
62-
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0",
61+
"npm:aurelia-dependency-injection@1.0.0-rc.1.0.1": {
62+
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.1",
6363
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0"
6464
},
65-
"npm:aurelia-framework@1.0.0-rc.1.0.1": {
66-
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.2",
67-
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.0",
65+
"npm:aurelia-framework@1.0.0-rc.1.0.6": {
66+
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.3",
67+
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.1",
6868
"aurelia-loader": "npm:aurelia-loader@1.0.0-rc.1.0.0",
69-
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0",
70-
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0",
69+
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.1",
70+
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.1",
7171
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0",
7272
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0",
7373
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0",
74-
"aurelia-templating": "npm:aurelia-templating@1.0.0-rc.1.0.0"
74+
"aurelia-templating": "npm:aurelia-templating@1.0.0-rc.1.0.1"
7575
},
7676
"npm:aurelia-loader@1.0.0-rc.1.0.0": {
77-
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0",
77+
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.1",
7878
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0"
7979
},
80-
"npm:aurelia-metadata@1.0.0-rc.1.0.0": {
80+
"npm:aurelia-metadata@1.0.0-rc.1.0.1": {
8181
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0"
8282
},
83-
"npm:aurelia-pal-browser@1.0.0-rc.1.0.0": {
83+
"npm:aurelia-pal-browser@1.0.0-rc.1.0.1": {
8484
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0"
8585
},
8686
"npm:aurelia-polyfills@1.0.0-rc.1.0.0": {
@@ -89,12 +89,12 @@ System.config({
8989
"npm:aurelia-task-queue@1.0.0-rc.1.0.0": {
9090
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0"
9191
},
92-
"npm:aurelia-templating@1.0.0-rc.1.0.0": {
93-
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.2",
94-
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.0",
92+
"npm:aurelia-templating@1.0.0-rc.1.0.1": {
93+
"aurelia-binding": "npm:aurelia-binding@1.0.0-rc.1.0.3",
94+
"aurelia-dependency-injection": "npm:aurelia-dependency-injection@1.0.0-rc.1.0.1",
9595
"aurelia-loader": "npm:aurelia-loader@1.0.0-rc.1.0.0",
96-
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.0",
97-
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.0",
96+
"aurelia-logging": "npm:aurelia-logging@1.0.0-rc.1.0.1",
97+
"aurelia-metadata": "npm:aurelia-metadata@1.0.0-rc.1.0.1",
9898
"aurelia-pal": "npm:aurelia-pal@1.0.0-rc.1.0.0",
9999
"aurelia-path": "npm:aurelia-path@1.0.0-rc.1.0.0",
100100
"aurelia-task-queue": "npm:aurelia-task-queue@1.0.0-rc.1.0.0"
@@ -110,7 +110,7 @@ System.config({
110110
"isarray": "npm:isarray@1.0.0",
111111
"process": "github:jspm/nodelibs-process@0.1.2"
112112
},
113-
"npm:core-js@2.4.0": {
113+
"npm:core-js@2.4.1": {
114114
"fs": "github:jspm/nodelibs-fs@0.1.2",
115115
"path": "github:jspm/nodelibs-path@0.1.0",
116116
"process": "github:jspm/nodelibs-process@0.1.2",

dist/amd/aurelia-v-grid.d.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ declare module 'aurelia-v-grid' {
5757
filterMenuLogic(value: any): any;
5858
}
5959

60-
//reset to main menu again
6160
/*****************************************************
6261
* main context menu for row cells
6362
******************************************************/
@@ -461,13 +460,23 @@ declare module 'aurelia-v-grid' {
461460
/****************************************************************************************************************************
462461
* explain
463462
****************************************************************************************************************************/
464-
setColumns(paramObj: any): any;
463+
setColumns(paramArray: any): any;
465464

466465
/****************************************************************************************************************************
467466
* explain
468467
****************************************************************************************************************************/
469468
getColumns(): any;
470469

470+
/****************************************************************************************************************************
471+
* explain
472+
****************************************************************************************************************************/
473+
reGenerateColumns(resetScrollToTop: any): any;
474+
475+
/****************************************************************************************************************************
476+
* explain
477+
****************************************************************************************************************************/
478+
orderBy(sortArray: any): any;
479+
471480
/****************************************************************************************************************************
472481
* explain
473482
****************************************************************************************************************************/
@@ -570,11 +579,9 @@ declare module 'aurelia-v-grid' {
570579
///filter table
571580
filterOperatorTable: any;
572581

573-
//end with
574582
//filter table
575583
filterOperatorTableString: any;
576584

577-
//10
578585
/***************************************************************************************
579586
* run the name of filter
580587
***************************************************************************************/
@@ -682,7 +689,6 @@ declare module 'aurelia-v-grid' {
682689
****************************************************************************************************************************/
683690
createGridRowElements(): any;
684691

685-
//end for loop
686692
/****************************************************************************************************************************
687693
* creates loading screen
688694
****************************************************************************************************************************/
@@ -909,7 +915,6 @@ declare module 'aurelia-v-grid' {
909915
export class VGridObservables {
910916
constructor(vGrid: any, bindingEngine: any);
911917

912-
//my property subscriptions
913918
/***************************************************************************************
914919
* observer vGridCollection, when entire vGridCollection gets replaced
915920
***************************************************************************************/
@@ -930,7 +935,6 @@ declare module 'aurelia-v-grid' {
930935
***************************************************************************************/
931936
disableObservablesCollection(): any;
932937

933-
//this.collectionSubscription = null;
934938
/***************************************************************************************
935939
* disable the array observables
936940
***************************************************************************************/
@@ -1075,6 +1079,8 @@ declare module 'aurelia-v-grid' {
10751079
attHidePagerInfo: any;
10761080
attCustomPager: any;
10771081
attLanguage: any;
1082+
attOnlyCustom: any;
1083+
attAttributeObserve: any;
10781084
loadingMessage: any;
10791085
loading: any;
10801086
constructor(element: any, bindingEngine: any, viewCompiler: any, viewSlot: any, container: any, viewResources: any, taskQueue: any);

dist/amd/vGrid/v-grid-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ define(["exports"], function (exports) {
115115
this.attHidePagerInfo = false;
116116
this.attCustomPager = null;
117117
this.attLanguage = {};
118-
118+
this.attOnlyCustom = false;
119119
this.repeater = false;
120120
this.repeatRowTemplate = null;
121121

dist/amd/vGrid/v-grid-ctx.js

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ define(["exports"], function (exports) {
114114
this.vGridGenerator.collectionChange();
115115
};
116116

117-
VGridCtx.prototype.setColumns = function setColumns(paramObj) {
118-
this.vGridConfig.colConfig = paramObj.colConfig;
117+
VGridCtx.prototype.setColumns = function setColumns(paramArray) {
118+
this.vGridConfig.colConfig = paramArray;
119+
this.vGrid.vGridConfig.columnLength = paramArray.length;
119120
};
120121

121122
VGridCtx.prototype.getColumns = function getColumns() {
@@ -131,9 +132,57 @@ define(["exports"], function (exports) {
131132
}
132133
arr.push(x);
133134
});
134-
return {
135-
"colConfig": arr
136-
};
135+
return arr;
136+
};
137+
138+
VGridCtx.prototype.reGenerateColumns = function reGenerateColumns(resetScrollToTop) {
139+
this.vGrid.vGridMarkupGenerator.generate();
140+
this.vGridGenerator.columnChangeAndCollection(resetScrollToTop);
141+
};
142+
143+
VGridCtx.prototype.orderBy = function orderBy(sortArray) {
144+
var _this3 = this;
145+
146+
if (this.vGrid.vGridCollectionFiltered.length > 0) {
147+
if (this.vGrid.vGridCollection.length > this.vGridConfig.attLoadingThreshold) {
148+
this.vGrid.loading = true;
149+
}
150+
151+
setTimeout(function () {
152+
153+
_this3.vGrid.vGridSort.reset();
154+
155+
sortArray.forEach(function (sort) {
156+
_this3.vGrid.vGridSort.setFilter({
157+
attribute: sort.attribute,
158+
asc: sort.asc
159+
}, true);
160+
});
161+
162+
var event = new CustomEvent("sortIconUpdate", {
163+
detail: "",
164+
bubbles: true
165+
});
166+
_this3.vGrid.element.dispatchEvent(event);
167+
168+
if (_this3.vGridConfig.eventOnRemoteCall) {
169+
_this3.vGridConfig.remoteCall();
170+
} else {
171+
_this3.vGrid.vGridSort.run(_this3.vGrid.vGridCollectionFiltered);
172+
173+
if (_this3.vGrid.vGridCurrentEntityRef) {
174+
_this3.vGrid.vGridCollectionFiltered.forEach(function (x, index) {
175+
if (_this3.vGrid.vGridCurrentEntityRef[_this3.vGrid.vGridRowKey] === x[_this3.vGrid.vGridRowKey]) {
176+
_this3.vGrid.vGridCurrentRow = index;
177+
}
178+
});
179+
}
180+
181+
_this3.vGrid.vGridGenerator.collectionChange();
182+
_this3.vGrid.loading = false;
183+
}
184+
}, 50);
185+
}
137186
};
138187

139188
VGridCtx.prototype.getMaxRows = function getMaxRows() {

dist/amd/vGrid/v-grid-markup-generator.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ define(['exports'], function (exports) {
169169
var attributeRow = col.colAddRowAttributes ? col.colAddRowAttributes : '';
170170
var css = col.colCss ? 'css="' + col.colCss + '"' : '';
171171

172-
col.colRowTemplate = '<image ' + css + ' ' + classNames + ' v-image-fix ' + attributeRow + ' src.bind="' + col.colField + '">';
172+
var imageFix = "v-image-fix";
173+
if (this.vGrid.vGridConfig.attOnlyCustom) {
174+
imageFix = "";
175+
}
176+
177+
col.colRowTemplate = '<image ' + css + ' ' + classNames + ' ' + imageFix + ' ' + attributeRow + ' src.bind="' + col.colField + '">';
173178
};
174179

175180
VGridMarkupGenerator.prototype.createInputRowMarkup = function createInputRowMarkup(col) {
@@ -182,6 +187,9 @@ define(['exports'], function (exports) {
182187
var colCss = col.colCss ? 'css="' + col.colCss + '"' : '';
183188

184189
var attributeObserver = 'v-observe-field="' + this.getAttribute(col.colField) + '"';
190+
if (this.vGrid.vGridConfig.attOnlyCustom) {
191+
attributeObserver = "";
192+
}
185193

186194
if (col.colType === "checkbox") {
187195
col.colRowTemplate = '<input ' + attributeObserver + ' ' + colCss + ' ' + colClass + ' ' + colType + ' ' + colAddRowAttributes + ' checked.bind="' + col.colField + '">';
@@ -225,7 +233,12 @@ define(['exports'], function (exports) {
225233

226234
var sort = col.colSort ? 'v-sort="' + col.colSort + '"' : '';
227235

228-
var markup = '<p v-drag-drop-col v-resize-col ' + classname + ' ' + sort + ' ' + colAddLabelAttributes + '>' + col.colHeaderName + '</p>';
236+
var extraAttributes = "v-drag-drop-col v-resize-col";
237+
if (this.vGrid.vGridConfig.attOnlyCustom) {
238+
extraAttributes = "";
239+
}
240+
241+
var markup = '<p ' + extraAttributes + ' ' + classname + ' ' + sort + ' ' + colAddLabelAttributes + '>' + col.colHeaderName + '</p>';
229242

230243
return markup;
231244
};

dist/amd/vGrid/v-grid.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ define(['exports', 'aurelia-framework', './v-grid-generator', './v-grid-filter',
5555
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
5656
}
5757

58-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _class2, _temp;
58+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15, _descriptor16, _descriptor17, _descriptor18, _descriptor19, _class2, _temp;
5959

60-
var VGrid = exports.VGrid = (_dec = (0, _aureliaFramework.bindable)({ attribute: "v-grid-context" }), _dec2 = (0, _aureliaFramework.bindable)({ attribute: "v-collection" }), _dec3 = (0, _aureliaFramework.bindable)({ attribute: "v-current-entity" }), _dec4 = (0, _aureliaFramework.bindable)({ attribute: "v-columns" }), _dec5 = (0, _aureliaFramework.bindable)({ attribute: "v-row-height" }), _dec6 = (0, _aureliaFramework.bindable)({ attribute: "v-header-height" }), _dec7 = (0, _aureliaFramework.bindable)({ attribute: "v-footer-height" }), _dec8 = (0, _aureliaFramework.bindable)({ attribute: "v-multi-select" }), _dec9 = (0, _aureliaFramework.bindable)({ attribute: "v-manual-sel" }), _dec10 = (0, _aureliaFramework.bindable)({ attribute: "v-loading-threshold" }), _dec11 = (0, _aureliaFramework.bindable)({ attribute: "v-remote-index" }), _dec12 = (0, _aureliaFramework.bindable)({ attribute: "v-row-on-draw" }), _dec13 = (0, _aureliaFramework.bindable)({ attribute: "v-event-onremote" }), _dec14 = (0, _aureliaFramework.bindable)({ attribute: "v-hide-pager-info" }), _dec15 = (0, _aureliaFramework.bindable)({ attribute: "v-custom-pager" }), _dec16 = (0, _aureliaFramework.bindable)({ attribute: "v-language" }), (_class = (_temp = _class2 = function () {
60+
var VGrid = exports.VGrid = (_dec = (0, _aureliaFramework.bindable)({ attribute: "v-grid-context" }), _dec2 = (0, _aureliaFramework.bindable)({ attribute: "v-collection" }), _dec3 = (0, _aureliaFramework.bindable)({ attribute: "v-current-entity" }), _dec4 = (0, _aureliaFramework.bindable)({ attribute: "v-columns" }), _dec5 = (0, _aureliaFramework.bindable)({ attribute: "v-row-height" }), _dec6 = (0, _aureliaFramework.bindable)({ attribute: "v-header-height" }), _dec7 = (0, _aureliaFramework.bindable)({ attribute: "v-footer-height" }), _dec8 = (0, _aureliaFramework.bindable)({ attribute: "v-multi-select" }), _dec9 = (0, _aureliaFramework.bindable)({ attribute: "v-manual-sel" }), _dec10 = (0, _aureliaFramework.bindable)({ attribute: "v-loading-threshold" }), _dec11 = (0, _aureliaFramework.bindable)({ attribute: "v-remote-index" }), _dec12 = (0, _aureliaFramework.bindable)({ attribute: "v-row-on-draw" }), _dec13 = (0, _aureliaFramework.bindable)({ attribute: "v-event-onremote" }), _dec14 = (0, _aureliaFramework.bindable)({ attribute: "v-hide-pager-info" }), _dec15 = (0, _aureliaFramework.bindable)({ attribute: "v-custom-pager" }), _dec16 = (0, _aureliaFramework.bindable)({ attribute: "v-language" }), _dec17 = (0, _aureliaFramework.bindable)({ attribute: "v-only-custom" }), _dec18 = (0, _aureliaFramework.bindable)({ attribute: "v-attribute-observe" }), (_class = (_temp = _class2 = function () {
6161
function VGrid(element, bindingEngine, viewCompiler, viewSlot, container, viewResources, taskQueue) {
6262
_classCallCheck(this, VGrid);
6363

@@ -93,7 +93,11 @@ define(['exports', 'aurelia-framework', './v-grid-generator', './v-grid-filter',
9393

9494
_initDefineProp(this, 'attLanguage', _descriptor16, this);
9595

96-
_initDefineProp(this, 'loadingMessage', _descriptor17, this);
96+
_initDefineProp(this, 'attOnlyCustom', _descriptor17, this);
97+
98+
_initDefineProp(this, 'attAttributeObserve', _descriptor18, this);
99+
100+
_initDefineProp(this, 'loadingMessage', _descriptor19, this);
97101

98102
this.loading = false;
99103

@@ -226,6 +230,8 @@ define(['exports', 'aurelia-framework', './v-grid-generator', './v-grid-filter',
226230
vConfig.setBindValueFunction(this.eventOnRemoteCall, 'eventOnRemoteCall');
227231
vConfig.setBindValueBool(this.attHidePagerInfo, 'attHidePagerInfo');
228232
vConfig.setBindValueString(this.attCustomPager, 'attCustomPager');
233+
vConfig.setBindValueBool(this.attOnlyCustom, 'attOnlyCustom');
234+
229235
this.vGridConfig.attLanguage = this.attLanguage || this.vGridConfig.attLanguage;
230236

231237
if (this.vGridCollection === undefined) {
@@ -311,7 +317,13 @@ define(['exports', 'aurelia-framework', './v-grid-generator', './v-grid-filter',
311317
}), _descriptor16 = _applyDecoratedDescriptor(_class.prototype, 'attLanguage', [_dec16], {
312318
enumerable: true,
313319
initializer: null
314-
}), _descriptor17 = _applyDecoratedDescriptor(_class.prototype, 'loadingMessage', [_aureliaFramework.bindable], {
320+
}), _descriptor17 = _applyDecoratedDescriptor(_class.prototype, 'attOnlyCustom', [_dec17], {
321+
enumerable: true,
322+
initializer: null
323+
}), _descriptor18 = _applyDecoratedDescriptor(_class.prototype, 'attAttributeObserve', [_dec18], {
324+
enumerable: true,
325+
initializer: null
326+
}), _descriptor19 = _applyDecoratedDescriptor(_class.prototype, 'loadingMessage', [_aureliaFramework.bindable], {
315327
enumerable: true,
316328
initializer: function initializer() {
317329
return "Working please wait";

0 commit comments

Comments
 (0)