Comparing version 1.3.0 to 1.3.1
@@ -188,2 +188,8 @@ define([ | ||
constructor: function () { | ||
if ('_editorInstances' in this) { | ||
throw new Error('When used with Editor ColumnSet must be mixed in before Editor.'); | ||
} | ||
}, | ||
postCreate: function () { | ||
@@ -190,0 +196,0 @@ var self = this; |
@@ -58,2 +58,6 @@ # ColumnSet | ||
------ | ----------- | ||
`styleColumnSet(columnsetId, css)` | Programmatically adds styles to a columnset, by injecting a rule into a stylesheet in the document. Returns a handle with a `remove` function, which can be called to later remove the added style rule. Styles added via this method will be removed when the instance is destroyed if `cleanAddedRules` is set to `true`. | ||
`styleColumnSet(columnsetId, css)` | Programmatically adds styles to a columnset, by injecting a rule into a stylesheet in the document. Returns a handle with a `remove` function, which can be called to later remove the added style rule. Styles added via this method will be removed when the instance is destroyed if `cleanAddedRules` is set to `true`. | ||
## Mixin Order | ||
`ColumnSet` must be mixed in **before** `Editor` when both are used together. |
@@ -68,2 +68,3 @@ # Selection | ||
`isSelected(row)`| Returns `true` if the given row is selected. | ||
`getSelectedCount()` | Returns the number of selected rows/cells. | ||
@@ -70,0 +71,0 @@ **Note:** The `select`, `deselect`, and `isSelected` methods can be passed any |
@@ -56,2 +56,3 @@ define([ | ||
this.edit(this.cell(row, previouslyFocusedCell.column.id)); | ||
this._previouslyFocusedEditorCell = null; | ||
} | ||
@@ -107,2 +108,3 @@ return rowElement; | ||
widget.destroyRecursive(); | ||
this._editorFocusoutHandle.resume(); | ||
} | ||
@@ -172,5 +174,9 @@ } | ||
configStructure: function () { | ||
this._alwaysOnWidgetColumns = []; | ||
this.inherited(arguments); | ||
}, | ||
_configColumns: function () { | ||
var columnArray = this.inherited(arguments); | ||
this._alwaysOnWidgetColumns = []; | ||
for (var i = 0, l = columnArray.length; i < l; i++) { | ||
@@ -289,2 +295,3 @@ if (columnArray[i].editor) { | ||
this._previouslyFocusedEditorCell = cell; | ||
column = cell.column; | ||
@@ -291,0 +298,0 @@ field = column.field; |
define([ | ||
'dojo/_base/array', | ||
'dojo/_base/declare', | ||
@@ -8,3 +9,3 @@ 'dojo/dom-construct', | ||
'dojo/i18n!./nls/columnHider' | ||
], function (declare, domConstruct, has, listen, miscUtil, i18n) { | ||
], function (arrayUtil, declare, domConstruct, has, listen, miscUtil, i18n) { | ||
/* | ||
@@ -20,3 +21,3 @@ * Column Hider plugin for dgrid | ||
* column definition. | ||
* 3. This implementation does NOT support ColumnSet, and has not been tested | ||
* 3. This implementation DOES support ColumnSet, but has not been tested | ||
* with multi-subrow records. | ||
@@ -67,21 +68,35 @@ * 4. Column show/hide is controlled via straight up HTML checkboxes. If you | ||
// summary: | ||
// Iterates over subRows for the sake of adding items to the | ||
// Iterates over subRows or columnSets for the sake of adding items to the | ||
// column hider menu. | ||
var subRows = this.subRows, | ||
first = true, | ||
srLength, cLength, sr, c; | ||
if (this.subRows && this.subRows.length) { | ||
var subRows = this.subRows, | ||
first = true, | ||
srLength, cLength, sr, c; | ||
delete this._columnHiderFirstCheckbox; | ||
delete this._columnHiderFirstCheckbox; | ||
for (sr = 0, srLength = subRows.length; sr < srLength; sr++) { | ||
for (c = 0, cLength = subRows[sr].length; c < cLength; c++) { | ||
this._renderHiderMenuEntry(subRows[sr][c]); | ||
if (first) { | ||
first = false; | ||
this._columnHiderFirstCheckbox = | ||
this._columnHiderCheckboxes[subRows[sr][c].id]; | ||
for (sr = 0, srLength = subRows.length; sr < srLength; sr++) { | ||
for (c = 0, cLength = subRows[sr].length; c < cLength; c++) { | ||
this._renderHiderMenuEntry(subRows[sr][c]); | ||
if (first) { | ||
first = false; | ||
this._columnHiderFirstCheckbox = | ||
this._columnHiderCheckboxes[subRows[sr][c].id]; | ||
} | ||
} | ||
} | ||
} | ||
else if (this.columnSets && this.columnSets.length) { | ||
arrayUtil.forEach(this.columnSets, function (columnSet) { | ||
arrayUtil.forEach(columnSet, function (columnSetColumns) { | ||
arrayUtil.forEach(columnSetColumns, function (column) { | ||
this._renderHiderMenuEntry(column); | ||
this._columnHiderFirstCheckbox = | ||
this._columnHiderFirstCheckbox || | ||
this._columnHiderCheckboxes[column.id]; | ||
}, this); | ||
}, this); | ||
}, this); | ||
} | ||
}, | ||
@@ -156,3 +171,4 @@ | ||
className: 'ui-icon dgrid-hider-toggle', | ||
type: 'button' | ||
role: 'button', | ||
tabindex: 0 | ||
}, this.domNode); | ||
@@ -175,2 +191,9 @@ | ||
this._listeners.push(listen(hiderToggleNode, 'keydown', function (event) { | ||
var charOrCode = event.charCode || event.keyCode; | ||
if (charOrCode === /*ENTER*/ 13 || charOrCode === /*SPACE*/ 32) { | ||
grid._toggleColumnHiderMenu(event); | ||
} | ||
})); | ||
// Create the column list, with checkboxes. | ||
@@ -177,0 +200,0 @@ hiderMenuNode = this.hiderMenuNode = domConstruct.create('div', { |
@@ -1,34 +0,45 @@ | ||
var copyOnlyMids = { | ||
'dgrid/Gruntfile': 1, | ||
'dgrid/package': 1 | ||
}; | ||
var miniExcludeMids = { | ||
'dgrid/CHANGES.md': 1, | ||
'dgrid/LICENSE': 1, | ||
'dgrid/README.md': 1, | ||
'dgrid/Gruntfile': 1, | ||
'dgrid/package': 1 | ||
}; | ||
// jshint unused: false | ||
var profile = { | ||
resourceTags: { | ||
copyOnly: function (filename, mid) { | ||
return mid in copyOnlyMids; | ||
}, | ||
var profile = (function () { | ||
var copyOnlyMids = { | ||
'dgrid/Gruntfile': 1, | ||
'dgrid/package': 1 | ||
}; | ||
var miniExcludeMids = { | ||
'dgrid/CHANGES.md': 1, | ||
'dgrid/LICENSE': 1, | ||
'dgrid/README.md': 1, | ||
'dgrid/Gruntfile': 1, | ||
'dgrid/package': 1 | ||
}; | ||
var amdRegex = /\.js$/; | ||
var isDemoRegex = /\/demos\//; | ||
var isStylusRegex = /\.styl$/; | ||
var isTestRegex = /\/test\//; | ||
test: function (filename) { | ||
return /\/test\//.test(filename); | ||
}, | ||
return { | ||
resourceTags: { | ||
copyOnly: function (filename, mid) { | ||
return (mid in copyOnlyMids) || isDemoRegex.test(filename) || isTestRegex.test(filename); | ||
}, | ||
miniExclude: function (filename, mid) { | ||
return (/\/(?:test|demos)\//).test(filename) || | ||
(/\.styl$/).test(filename) || | ||
mid in miniExcludeMids; | ||
test: function (filename) { | ||
return isTestRegex.test(filename); | ||
}, | ||
miniExclude: function (filename, mid) { | ||
return isDemoRegex.test(filename) || | ||
isStylusRegex.test(filename) || | ||
isTestRegex.test(filename) || | ||
mid in miniExcludeMids; | ||
}, | ||
amd: function (filename) { | ||
return amdRegex.test(filename); | ||
} | ||
}, | ||
amd: function (filename) { | ||
return (/\.js$/).test(filename); | ||
} | ||
} | ||
}; | ||
trees: [ | ||
[ '.', '.', /(?:\/\.)|(?:~$)|(?:(?:html-report|node_modules|nib|nodes)\/)/ ] | ||
] | ||
}; | ||
})(); |
{ | ||
"name": "dgrid", | ||
"author": "Kris Zyp", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A lightweight, mobile-ready, data-driven, modular widget designed for lists and grids", | ||
@@ -6,0 +6,0 @@ "license": "BSD-3-Clause", |
@@ -288,2 +288,8 @@ define([ | ||
// If the target is already selected, and is the sole selection, ignore a user action | ||
// that would simply select the target (causing unnecessary deselect/select). | ||
if (!event[ctrlEquiv] && this.isSelected(target) && this.getSelectedCount() === 1) { | ||
return; | ||
} | ||
// Clear selection first for right-clicks outside selection and non-ctrl-clicks; | ||
@@ -647,2 +653,14 @@ // otherwise, extended mode logic is identical to multiple mode | ||
getSelectedCount: function () { | ||
var count = 0; | ||
for (var id in this.selection) { | ||
if (id) { | ||
count += 1; | ||
} | ||
} | ||
return count; | ||
}, | ||
isSelected: function (object) { | ||
@@ -649,0 +667,0 @@ // summary: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1738697
12814