Skip to content

Commit 98aa7b7

Browse files
committed
release v2.4.11 - update github.io
1 parent 55aa3b1 commit 98aa7b7

20 files changed

+6569
-554
lines changed

SlickGrid/.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
.gitk*
22
.idea/*
33
.DS_Store
4+
yarn-error.log
5+
yarn.lock
46
node_modules/*
57
SlickgridRelease*
6-
nuget*
8+
nuget*
9+
testresult.xml

SlickGrid/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ examples
55
nuget*
66
SlickgridRelease*
77
tests
8+
testresult.xml

SlickGrid/.vscode/tasks.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Cypress Open GUI",
6+
"type": "shell",
7+
"command": "yarn run cypress:open",
8+
"problemMatcher": []
9+
},
10+
{
11+
"label": "Cypress CI",
12+
"type": "shell",
13+
"command": "yarn run cypress:ci",
14+
"problemMatcher": []
15+
}
16+
]
17+
}
File renamed without changes.

SlickGrid/controls/slick.columnpicker.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@
4444
.slick-columnpicker li a:hover {
4545
background: white;
4646
}
47+
48+
/* Excluded item from Column Picker will be hidden */
49+
.slick-columnpicker-list li.hidden {
50+
display: none;
51+
}

SlickGrid/controls/slick.columnpicker.js

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1-
/***
2-
* A control to add a Column Picker (right+click on any column header to reveal the column picker)
3-
*
4-
* USAGE:
5-
*
6-
* Add the slick.columnpicker.(js|css) files and register it with the grid.
7-
*
8-
* Available options, by defining a columnPicker object:
9-
*
10-
* var options = {
11-
* enableCellNavigation: true,
12-
* columnPicker: {
13-
* columnTitle: "Columns", // default to empty string
14-
*
15-
* // the last 2 checkboxes titles
16-
* hideForceFitButton: false, // show/hide checkbox near the end "Force Fit Columns" (default:false)
17-
* hideSyncResizeButton: false, // show/hide checkbox near the end "Synchronous Resize" (default:false)
18-
* forceFitTitle: "Force fit columns", // default to "Force fit columns"
19-
* headerColumnValueExtractor: "Extract the column label" // default to column.name
20-
* syncResizeTitle: "Synchronous resize", // default to "Synchronous resize"
21-
* }
22-
* };
23-
*
24-
* @class Slick.Controls.ColumnPicker
25-
* @constructor
26-
*/
1+
/***
2+
* A control to add a Column Picker (right+click on any column header to reveal the column picker)
3+
*
4+
* USAGE:
5+
*
6+
* Add the slick.columnpicker.(js|css) files and register it with the grid.
7+
*
8+
* Available options, by defining a columnPicker object:
9+
*
10+
* var options = {
11+
* enableCellNavigation: true,
12+
* columnPicker: {
13+
* columnTitle: "Columns", // default to empty string
14+
*
15+
* // the last 2 checkboxes titles
16+
* hideForceFitButton: false, // show/hide checkbox near the end "Force Fit Columns" (default:false)
17+
* hideSyncResizeButton: false, // show/hide checkbox near the end "Synchronous Resize" (default:false)
18+
* forceFitTitle: "Force fit columns", // default to "Force fit columns"
19+
* headerColumnValueExtractor: "Extract the column label" // default to column.name
20+
* syncResizeTitle: "Synchronous resize", // default to "Synchronous resize"
21+
* }
22+
* };
23+
*
24+
* @class Slick.Controls.ColumnPicker
25+
* @constructor
26+
*/
2727

2828
'use strict';
2929

3030
(function ($) {
3131
function SlickColumnPicker(columns, grid, options) {
3232
var _grid = grid;
3333
var _options = options;
34+
var $columnTitleElm;
35+
var columns;
3436
var $list;
3537
var $menu;
3638
var columnCheckboxes;
@@ -56,13 +58,13 @@
5658
_options = $.extend({}, defaults, options);
5759

5860
$menu = $("<div class='slick-columnpicker' style='display:none' />").appendTo(document.body);
59-
var $close = $("<button type='button' class='close' data-dismiss='slick-columnpicker' aria-label='Close'><span class='close' aria-hidden='true'>&times;</span></button>").appendTo($menu);
61+
$("<button type='button' class='close' data-dismiss='slick-columnpicker' aria-label='Close'><span class='close' aria-hidden='true'>&times;</span></button>").appendTo($menu);
6062

6163
// user could pass a title on top of the columns list
62-
if(_options.columnPickerTitle || (_options.columnPicker && _options.columnPicker.columnTitle)) {
64+
if (_options.columnPickerTitle || (_options.columnPicker && _options.columnPicker.columnTitle)) {
6365
var columnTitle = _options.columnPickerTitle || _options.columnPicker.columnTitle;
64-
var $title = $("<div class='title'/>").append(columnTitle);
65-
$title.appendTo($menu);
66+
$columnTitleElm = $("<div class='title'/>").append(columnTitle);
67+
$columnTitleElm.appendTo($menu);
6668
}
6769

6870
$menu.on("click", updateColumn);
@@ -96,9 +98,10 @@
9698
columnCheckboxes = [];
9799

98100
var $li, $input;
99-
var columnLabel;
101+
var columnLabel, excludeCssClass;
100102
for (var i = 0; i < columns.length; i++) {
101-
$li = $("<li />").appendTo($list);
103+
excludeCssClass = columns[i].excludeFromColumnPicker ? "hidden" : "";
104+
$li = $('<li class="' + excludeCssClass + '" />').appendTo($list);
102105
$input = $("<input type='checkbox' />").data("column-id", columns[i].id);
103106
columnCheckboxes.push($input);
104107

@@ -127,9 +130,9 @@
127130
$li = $("<li />").appendTo($list);
128131
$input = $("<input type='checkbox' />").data("option", "autoresize");
129132
$("<label />")
130-
.text(forceFitTitle)
131-
.prepend($input)
132-
.appendTo($li);
133+
.text(forceFitTitle)
134+
.prepend($input)
135+
.appendTo($li);
133136
if (_grid.getOptions().forceFitColumns) {
134137
$input.attr("checked", "checked");
135138
}
@@ -140,19 +143,19 @@
140143
$li = $("<li />").appendTo($list);
141144
$input = $("<input type='checkbox' />").data("option", "syncresize");
142145
$("<label />")
143-
.text(syncResizeTitle)
144-
.prepend($input)
145-
.appendTo($li);
146+
.text(syncResizeTitle)
147+
.prepend($input)
148+
.appendTo($li);
146149
if (_grid.getOptions().syncColumnCellResize) {
147150
$input.attr("checked", "checked");
148151
}
149152
}
150153

151154
$menu
152-
.css("top", e.pageY - 10)
153-
.css("left", e.pageX - 10)
154-
.css("max-height", $(window).height() - e.pageY -10)
155-
.fadeIn(_options.fadeSpeed);
155+
.css("top", e.pageY - 10)
156+
.css("left", e.pageX - 10)
157+
.css("max-height", $(window).height() - e.pageY - 10)
158+
.fadeIn(_options.fadeSpeed);
156159

157160
$list.appendTo($menu);
158161
}
@@ -167,7 +170,7 @@
167170
var current = _grid.getColumns().slice(0);
168171
var ordered = new Array(columns.length);
169172
for (var i = 0; i < ordered.length; i++) {
170-
if ( _grid.getColumnIndex(columns[i].id) === undefined ) {
173+
if (_grid.getColumnIndex(columns[i].id) === undefined) {
171174
// If the column doesn't return a value from getColumnIndex,
172175
// it is hidden. Leave it in this position.
173176
ordered[i] = columns[i];
@@ -176,34 +179,32 @@
176179
ordered[i] = current.shift();
177180
}
178181
}
182+
columns = ordered;
183+
}
179184

180-
// filter out excluded column header when necessary
181-
// (works with IE9+, older browser requires a polyfill for the filter to work, visit MDN for more info)
182-
if (Array.isArray(ordered) && typeof ordered.filter === 'function') {
183-
columns = ordered.filter(function(columnDef) {
184-
return !columnDef.excludeFromColumnPicker;
185-
});
186-
} else {
187-
columns = ordered;
185+
/** Update the Titles of each sections (command, customTitle, ...) */
186+
function updateAllTitles(gridMenuOptions) {
187+
if ($columnTitleElm && $columnTitleElm.text) {
188+
$columnTitleElm.text(gridMenuOptions.columnTitle);
188189
}
189190
}
190191

191192
function updateColumn(e) {
192193
if ($(e.target).data("option") == "autoresize") {
193194
if (e.target.checked) {
194-
_grid.setOptions({forceFitColumns:true});
195+
_grid.setOptions({ forceFitColumns: true });
195196
_grid.autosizeColumns();
196197
} else {
197-
_grid.setOptions({forceFitColumns:false});
198+
_grid.setOptions({ forceFitColumns: false });
198199
}
199200
return;
200201
}
201202

202203
if ($(e.target).data("option") == "syncresize") {
203204
if (e.target.checked) {
204-
_grid.setOptions({syncColumnCellResize:true});
205+
_grid.setOptions({ syncColumnCellResize: true });
205206
} else {
206-
_grid.setOptions({syncColumnCellResize:false});
207+
_grid.setOptions({ syncColumnCellResize: false });
207208
}
208209
return;
209210
}
@@ -222,7 +223,7 @@
222223
}
223224

224225
_grid.setColumns(visibleColumns);
225-
onColumnsChanged.notify({columns: visibleColumns, grid: _grid});
226+
onColumnsChanged.notify({ columns: visibleColumns, grid: _grid });
226227
}
227228
}
228229

@@ -236,10 +237,11 @@
236237
"init": init,
237238
"getAllColumns": getAllColumns,
238239
"destroy": destroy,
240+
"updateAllTitles": updateAllTitles,
239241
"onColumnsChanged": onColumnsChanged
240242
};
241243
}
242244

243245
// Slick.Controls.ColumnPicker
244-
$.extend(true, window, { Slick:{ Controls:{ ColumnPicker:SlickColumnPicker }}});
246+
$.extend(true, window, { Slick: { Controls: { ColumnPicker: SlickColumnPicker } } });
245247
})(jQuery);

SlickGrid/controls/slick.gridmenu.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,16 @@
106106
vertical-align: middle;
107107
}
108108

109-
110109
/* Disabled */
111110
.slick-gridmenu-item-disabled {
112111
color: silver;
113112
}
114113

114+
/* Excluded item from Grid Menu will be hidden */
115+
.slick-gridmenu-list li.hidden {
116+
display: none;
117+
}
118+
115119
/* Divider */
116120
.slick-gridmenu-item.slick-gridmenu-item-divider {
117121
cursor: default;

0 commit comments

Comments
 (0)