Skip to content

Commit

Permalink
Merge branch 'release/0.7.0-beta2'
Browse files Browse the repository at this point in the history
  • Loading branch information
budnix committed Sep 11, 2015
2 parents e01cd08 + 243ea50 commit 29a5a91
Show file tree
Hide file tree
Showing 19 changed files with 1,215 additions and 1,048 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store

.idea
node_modules
bower_components
/node_modules
/bower_components
dev.html
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "ngHandsontable",
"version": "0.7.0-beta1",
"version": "0.7.0-beta2",
"dependencies": {
"angular": "~1.4",
"handsontable": "~0.17.0"
"handsontable": "~0.18.0"
},
"homepage": "https://github.com/handsontable/ngHandsontable",
"authors": [
Expand Down
16 changes: 14 additions & 2 deletions demo/build/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
}
config.$inject = ['$sceDelegateProvider', '$httpProvider', '$stateProvider', '$compileProvider', '$urlRouterProvider', 'demoMapProvider'];

app.constant('version', 'v0.7.0-beta1');
app.constant('version', 'v0.7.0-beta2');
app.config(config);

angular.element(document).ready(function() {
Expand Down Expand Up @@ -318,6 +318,18 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
description: 'Enable copy/paste in context menu'
}
},
'pagination': {
'rows-pagination': {
url: getUrl('fohohenabo/1'),
title: 'Paginate rows',
description: 'Paginate rows'
},
'columns-pagination': {
url: getUrl('qudufogafu/1'),
title: 'Paginate columns',
description: 'Paginate columns'
},
},
'other': {
'access-to-instance': {
url: getUrl('fovoxu/4'),
Expand All @@ -333,7 +345,7 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof requ
url: getUrl('locome/2'),
title: 'Custom renderer',
description: 'Custom renderer'
}
},
}
};
}());
Expand Down
14 changes: 13 additions & 1 deletion demo/js/demos.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@
description: 'Enable copy/paste in context menu'
}
},
'pagination': {
'rows-pagination': {
url: getUrl('fohohenabo/1'),
title: 'Paginate rows',
description: 'Paginate rows'
},
'columns-pagination': {
url: getUrl('qudufogafu/1'),
title: 'Paginate columns',
description: 'Paginate columns'
},
},
'other': {
'access-to-instance': {
url: getUrl('fovoxu/4'),
Expand All @@ -92,7 +104,7 @@
url: getUrl('locome/2'),
title: 'Custom renderer',
description: 'Custom renderer'
}
},
}
};
}());
83 changes: 51 additions & 32 deletions dist/ngHandsontable.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/**
* ngHandsontable 0.7.0-beta1
* ngHandsontable 0.7.0-beta2
*
* Copyright 2012-2015 Marcin Warpechowski
* Copyright 2015 Handsoncode sp. z o.o. <[email protected]>
* Licensed under the MIT license.
* https://github.com/handsontable/ngHandsontable
* Date: Thu Aug 27 2015 15:02:29 GMT+0200 (CEST)
* Date: Fri Sep 11 2015 09:12:32 GMT+0200 (CEST)
*/

if (document.all && !document.addEventListener) { // IE 8 and lower
Expand All @@ -20,8 +20,13 @@ angular.module('ngHandsontable', [
'ngHandsontable.directives'
]);


Handsontable.hooks.add('afterContextMenuShow', function() {
Handsontable.eventManager.isHotTableEnv = false;
});

(function() {
function autoCompleteFactory() {
function autoCompleteFactory($parse) {
return {
parseAutoComplete: function(column, dataSet, propertyOnly) {
column.source = function(query, process) {
Expand All @@ -40,18 +45,21 @@ angular.module('ngHandsontable', [
if (angular.isArray(options.object)) {
source = options.object;
} else {
var
objKeys = options.object.split('.'),
paramObject = data;

while (objKeys.length > 0) {
var key = objKeys.shift();
paramObject = paramObject[key];
}

if (propertyOnly) {
for (var i = 0, length = paramObject.length; i < length; i++) {
source.push(paramObject[i][options.property]);
// Using $parse to evaluate the expression against the row object
// allows us to support filters like the ngRepeat directive does.
var paramObject = $parse(options.object)(data);

if (angular.isArray(paramObject)) {
if (propertyOnly) {
for (var i = 0, length = paramObject.length; i < length; i++) {
var item = paramObject[i][options.property];

if (item !== null && item !== undefined) {
source.push(item);
}
}
} else {
source = paramObject;
}
} else {
source = paramObject;
Expand All @@ -62,7 +70,7 @@ angular.module('ngHandsontable', [
}
};
}
autoCompleteFactory.$inject = [];
autoCompleteFactory.$inject = ['$parse'];

angular.module('ngHandsontable.services').factory('autoCompleteFactory', autoCompleteFactory);
}());
Expand Down Expand Up @@ -170,7 +178,7 @@ angular.module('ngHandsontable', [
htOptions, i, length;

settings = settings || {};
angular.extend(scopeOptions, scope.settings);
angular.extend(scopeOptions, scope.settings || {});
htOptions = this.getAvailableSettings();

for (i = 0, length = htOptions.length; i < length; i++) {
Expand All @@ -195,14 +203,14 @@ angular.module('ngHandsontable', [
htHooks, i, length, attribute;

settings = settings || {};
angular.extend(scopeOptions, scope.settings);
angular.extend(scopeOptions, scope.settings || {});
htHooks = this.getAvailableHooks();

for (i = 0, length = htHooks.length; i < length; i++) {
attribute = 'on' + ucFirst(htHooks[i]);

if (typeof scopeOptions[attribute] !== 'undefined') {
settings[htHooks[i]] = scopeOptions[attribute];
if (typeof scopeOptions[htHooks[i]] === 'function' || typeof scopeOptions[attribute] === 'function') {
settings[htHooks[i]] = scopeOptions[htHooks[i]] || scopeOptions[attribute];
}
}

Expand Down Expand Up @@ -375,7 +383,7 @@ angular.module('ngHandsontable', [
$scope.column = {};
}
var optionList = {};
var match = options.match(/^\s*(.+)\s+in\s+(.*)\s*$/);
var match = options.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)\s*$/);

if (match) {
optionList.property = match[1];
Expand All @@ -401,12 +409,12 @@ angular.module('ngHandsontable', [
};
});

return function (scope, element, attributes, controllerInstance) {
return function (scope, element, attrs, controllerInstance) {
var column = {};

// Turn all attributes without value as `true` by default
angular.forEach(Object.keys(attributes), function(key) {
if (key.charAt(0) !== '$' && attributes[key] === '') {
angular.forEach(Object.keys(attrs), function(key) {
if (key.charAt(0) !== '$' && attrs[key] === '') {
column[key] = true;
}
});
Expand Down Expand Up @@ -479,6 +487,13 @@ angular.module('ngHandsontable', [
if (!scope.htSettings) {
scope.htSettings = {};
}
// Turn all attributes without value as `true` by default
angular.forEach(Object.keys(attrs), function(key) {
if (key.charAt(0) !== '$' && attrs[key] === '') {
scope.htSettings[key] = true;
}
});

settingFactory.mergeSettingsFromScope(scope.htSettings, scope);
settingFactory.mergeHooksFromScope(scope.htSettings, scope);
scope.htSettings.data = scope.datarows;
Expand All @@ -493,7 +508,7 @@ angular.module('ngHandsontable', [
}
if (typeof scope.htSettings.columns[i].optionList === 'string') {
var optionList = {};
var match = scope.htSettings.columns[i].optionList.match(/^\s*(.+)\s+in\s+(.*)\s*$/);
var match = scope.htSettings.columns[i].optionList.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)\s*$/);

if (match) {
optionList.property = match[1];
Expand All @@ -506,8 +521,6 @@ angular.module('ngHandsontable', [
autoCompleteFactory.parseAutoComplete(scope.htSettings.columns[i], scope.datarows, true);
}
}
scope.hotInstance = settingFactory.initializeHandsontable(element, scope.htSettings);

var origAfterChange = scope.htSettings.afterChange;

scope.htSettings.afterChange = function() {
Expand All @@ -518,20 +531,26 @@ angular.module('ngHandsontable', [
scope.$apply();
}
};
scope.hotInstance = settingFactory.initializeHandsontable(element, scope.htSettings);

// TODO: Add watch properties descriptor + needs perf test watch equality vs toJson
// TODO: Add watch properties descriptor + needs perf test. Watch full equality vs toJson
angular.forEach(bindingsKeys, function(key) {
scope.$watch(key, function(newValue) {
if (newValue === void 0) {
scope.$watch(key, function(newValue, oldValue) {
if (newValue === void 0 || newValue === oldValue) {
return;
}
if (key === 'datarows') {
settingFactory.renderHandsontable(scope.hotInstance);
// If reference to data rows is not changed then only re-render table
if (scope.hotInstance.getSettings().data === newValue) {
settingFactory.renderHandsontable(scope.hotInstance);
} else {
scope.hotInstance.loadData(newValue);
}
} else {
scope.htSettings[key] = newValue;
settingFactory.updateHandsontableSettings(scope.hotInstance, scope.htSettings);
}
}, ['datarows', 'columns', 'colWidths', 'rowHeaders'].indexOf(key) >= 0);
}, ['datarows', 'columns', 'rowHeights', 'colWidths', 'rowHeaders', 'colHeaders'].indexOf(key) >= 0);
});

/**
Expand Down
Loading

0 comments on commit 29a5a91

Please sign in to comment.