blacklight_range_limit 7.6.0 → 7.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/app/assets/javascripts/blacklight_range_limit/range_limit_distro_facets.js +1 -1
- data/vendor/assets/javascripts/flot/jquery.canvaswrapper.js +2 -3
- data/vendor/assets/javascripts/flot/jquery.flot.drawSeries.js +3 -4
- data/vendor/assets/javascripts/flot/jquery.flot.hover.js +7 -8
- data/vendor/assets/javascripts/flot/jquery.flot.js +21 -22
- data/vendor/assets/javascripts/flot/jquery.flot.selection.js +20 -22
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2167f6be6b6b4e9b67276d274aed5d5a3422779297c7630509bc9d562d355a76
|
4
|
+
data.tar.gz: 290370f3bfc33223c8a8ead2547241f6d5af25647acd6fce5f37bfefbcf3bbdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52823d196806781d9c00ffe501f9b96c1d6c0808fdb6cd0aa14484873624ab744079d0751a8c9a9f9de5082b28cf1226214bcd517cbc2eae04d7125dff3d0a6d
|
7
|
+
data.tar.gz: '04678a126c9947e4d6dcd9f56a9ffb71b61072e9d0f3f5f907ca6e98c1b0958bf8e2fd89d7057c5114ad08af444301f3d19a9b65dd1c2c1e093eef0a8eb897e8'
|
data/README.md
CHANGED
@@ -52,7 +52,7 @@ config.add_facet_field 'pub_date', label: 'Publication Year', range: true
|
|
52
52
|
You should now get range limit display. More complicated configuration is available if desired, see Range Facet Configuration below.
|
53
53
|
|
54
54
|
|
55
|
-
You can also configure the look and feel of the Flot chart using the jQuery .data() method. On the `.
|
55
|
+
You can also configure the look and feel of the Flot chart using the jQuery .data() method. On the `.facet-limit` container you want to configure, add a Flot options associative array (documented at http://people.iola.dk/olau/flot/API.txt) as the `plot-config` key. The `plot-config` key to set the `plot-config` key on the appropriate `.facet-limit` container. In order to customize the plot colors, for example, you could use this code:
|
56
56
|
|
57
57
|
```javascript
|
58
58
|
$('.blacklight-year_i').data('plot-config', {
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
7.
|
1
|
+
7.7.0
|
@@ -191,7 +191,7 @@ Blacklight.onLoad(function() {
|
|
191
191
|
|
192
192
|
|
193
193
|
var plot;
|
194
|
-
var config = $(container).closest('.
|
194
|
+
var config = $(container).closest('.facet-limit').data('plot-config') || {};
|
195
195
|
|
196
196
|
try {
|
197
197
|
plot = $.plot($(container), [series_data],
|
@@ -386,7 +386,6 @@ don't work unless the canvas is attached to the DOM.
|
|
386
386
|
|
387
387
|
y += 0.75 * info.height;
|
388
388
|
|
389
|
-
|
390
389
|
// Determine whether this text already exists at this position.
|
391
390
|
// If so, mark it for inclusion in the next render pass.
|
392
391
|
|
@@ -447,7 +446,7 @@ don't work unless the canvas is attached to the DOM.
|
|
447
446
|
position.element.style.textAlign = halign;
|
448
447
|
// update the transforms
|
449
448
|
updateTransforms(position.element, transforms);
|
450
|
-
|
449
|
+
};
|
451
450
|
|
452
451
|
var addTspanElements = function(text, element, x) {
|
453
452
|
var lines = text.split('<br>'),
|
@@ -461,7 +460,7 @@ don't work unless the canvas is attached to the DOM.
|
|
461
460
|
tspan = element.childNodes[i];
|
462
461
|
}
|
463
462
|
tspan.textContent = lines[i];
|
464
|
-
offset = i
|
463
|
+
offset = (i === 0 ? 0 : 1) + 'em';
|
465
464
|
tspan.setAttributeNS(null, 'dy', offset);
|
466
465
|
tspan.setAttributeNS(null, 'x', x);
|
467
466
|
}
|
@@ -42,7 +42,7 @@ This plugin is used by flot for drawing lines, plots, bars or area.
|
|
42
42
|
continue;
|
43
43
|
}
|
44
44
|
|
45
|
-
if(steps){
|
45
|
+
if (steps) {
|
46
46
|
if (mx !== null && my !== null) {
|
47
47
|
// if middle point exists, transfer p2 -> p1 and p1 -> mp
|
48
48
|
x2 = x1;
|
@@ -202,7 +202,7 @@ This plugin is used by flot for drawing lines, plots, bars or area.
|
|
202
202
|
continue;
|
203
203
|
}
|
204
204
|
|
205
|
-
if(steps){
|
205
|
+
if (steps) {
|
206
206
|
if (mx !== null && my !== null) {
|
207
207
|
// if middle point exists, transfer p2 -> p1 and p1 -> mp
|
208
208
|
x2 = x1;
|
@@ -482,8 +482,7 @@ This plugin is used by flot for drawing lines, plots, bars or area.
|
|
482
482
|
drawLeft = true;
|
483
483
|
drawRight = false;
|
484
484
|
}
|
485
|
-
}
|
486
|
-
else {
|
485
|
+
} else {
|
487
486
|
drawLeft = drawRight = drawTop = true;
|
488
487
|
drawBottom = false;
|
489
488
|
left = x + barLeft;
|
@@ -79,7 +79,6 @@ the tooltip from webcharts).
|
|
79
79
|
highlights = [];
|
80
80
|
}
|
81
81
|
|
82
|
-
|
83
82
|
function generatePlothoverEvent(e) {
|
84
83
|
var o = plot.getOptions(),
|
85
84
|
newEvent = new CustomEvent('mouseevent');
|
@@ -98,10 +97,10 @@ the tooltip from webcharts).
|
|
98
97
|
|
99
98
|
function doTriggerClickHoverEvent(event, eventType, searchDistance) {
|
100
99
|
var series = plot.getData();
|
101
|
-
if (event !== undefined
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
if (event !== undefined &&
|
101
|
+
series.length > 0 &&
|
102
|
+
series[0].xaxis.c2p !== undefined &&
|
103
|
+
series[0].yaxis.c2p !== undefined) {
|
105
104
|
var eventToTrigger = "plot" + eventType;
|
106
105
|
var seriesFlag = eventType + "able";
|
107
106
|
triggerClickHoverEvent(eventToTrigger, event,
|
@@ -155,8 +154,8 @@ the tooltip from webcharts).
|
|
155
154
|
var items = plot.findNearbyItems(canvasX, canvasY, seriesFilter, distance);
|
156
155
|
var item = items[0];
|
157
156
|
|
158
|
-
for (
|
159
|
-
if (item.distance === undefined ||
|
157
|
+
for (let i = 1; i < items.length; ++i) {
|
158
|
+
if (item.distance === undefined ||
|
160
159
|
items[i].distance < item.distance) {
|
161
160
|
item = items[i];
|
162
161
|
}
|
@@ -172,7 +171,7 @@ the tooltip from webcharts).
|
|
172
171
|
|
173
172
|
if (options.grid.autoHighlight) {
|
174
173
|
// clear auto-highlights
|
175
|
-
for (
|
174
|
+
for (let i = 0; i < highlights.length; ++i) {
|
176
175
|
var h = highlights[i];
|
177
176
|
if ((h.auto === eventname &&
|
178
177
|
!(item && h.series === item.series &&
|
@@ -847,8 +847,6 @@ Licensed under the MIT license.
|
|
847
847
|
ps = s.datapoints.pointsize;
|
848
848
|
points = s.datapoints.points;
|
849
849
|
|
850
|
-
var insertSteps = s.lines.show && s.lines.steps;
|
851
|
-
|
852
850
|
for (j = k = 0; j < data.length; ++j, k += ps) {
|
853
851
|
p = data[j];
|
854
852
|
|
@@ -980,8 +978,8 @@ Licensed under the MIT license.
|
|
980
978
|
var eventList = eventManager[key] || [];
|
981
979
|
|
982
980
|
eventList.push({"event": event, "handler": handler, "eventHolder": eventHolder, "priority": priority});
|
983
|
-
eventList.sort((a, b) => b.priority - a.priority
|
984
|
-
eventList.forEach(
|
981
|
+
eventList.sort((a, b) => b.priority - a.priority);
|
982
|
+
eventList.forEach(eventData => {
|
985
983
|
eventData.eventHolder.unbind(eventData.event, eventData.handler);
|
986
984
|
eventData.eventHolder.bind(eventData.event, eventData.handler);
|
987
985
|
});
|
@@ -2437,8 +2435,7 @@ Licensed under the MIT license.
|
|
2437
2435
|
if (series.bars.horizontal) {
|
2438
2436
|
range.ymin += delta;
|
2439
2437
|
range.ymax += delta + barWidth;
|
2440
|
-
}
|
2441
|
-
else {
|
2438
|
+
} else {
|
2442
2439
|
range.xmin += delta;
|
2443
2440
|
range.xmax += delta + barWidth;
|
2444
2441
|
}
|
@@ -2467,7 +2464,7 @@ Licensed under the MIT license.
|
|
2467
2464
|
}
|
2468
2465
|
|
2469
2466
|
var start = series.bars.horizontal ? 1 : 0;
|
2470
|
-
for (
|
2467
|
+
for (let j = start; j < series.datapoints.points.length; j += pointsize) {
|
2471
2468
|
if (isFinite(series.datapoints.points[j]) && series.datapoints.points[j] !== null) {
|
2472
2469
|
xValues.push(series.datapoints.points[j]);
|
2473
2470
|
}
|
@@ -2477,10 +2474,10 @@ Licensed under the MIT license.
|
|
2477
2474
|
return self.indexOf(value) === index;
|
2478
2475
|
}
|
2479
2476
|
|
2480
|
-
xValues = xValues.filter(
|
2481
|
-
xValues.sort(function(a, b){return a - b});
|
2477
|
+
xValues = xValues.filter(onlyUnique);
|
2478
|
+
xValues.sort(function(a, b) { return a - b });
|
2482
2479
|
|
2483
|
-
for (
|
2480
|
+
for (let j = 1; j < xValues.length; j++) {
|
2484
2481
|
var distance = Math.abs(xValues[j] - xValues[j - 1]);
|
2485
2482
|
if (distance < minDistance && isFinite(distance)) {
|
2486
2483
|
minDistance = distance;
|
@@ -2502,21 +2499,21 @@ Licensed under the MIT license.
|
|
2502
2499
|
}
|
2503
2500
|
}
|
2504
2501
|
|
2505
|
-
return items.sort((a, b) => {
|
2502
|
+
return items.sort((a, b) => {
|
2506
2503
|
if (b.distance === undefined) {
|
2507
2504
|
return -1;
|
2508
2505
|
} else if (a.distance === undefined && b.distance !== undefined) {
|
2509
2506
|
return 1;
|
2510
2507
|
}
|
2511
2508
|
|
2512
|
-
return a.distance - b.distance
|
2509
|
+
return a.distance - b.distance;
|
2513
2510
|
});
|
2514
2511
|
}
|
2515
2512
|
|
2516
2513
|
function findNearbyItem(mouseX, mouseY, seriesFilter, radius, computeDistance) {
|
2517
2514
|
var items = findNearbyItems(mouseX, mouseY, seriesFilter, radius, computeDistance);
|
2518
2515
|
return items[0] !== undefined ? items[0] : null;
|
2519
|
-
|
2516
|
+
}
|
2520
2517
|
|
2521
2518
|
// returns the data item the mouse is over/ the cursor is closest to, or null if none is found
|
2522
2519
|
function findItems(mouseX, mouseY, seriesFilter, radius, computeDistance) {
|
@@ -2550,7 +2547,7 @@ Licensed under the MIT license.
|
|
2550
2547
|
for (i = 0; i < items.length; i++) {
|
2551
2548
|
var seriesIndex = items[i].seriesIndex;
|
2552
2549
|
var dataIndex = items[i].dataIndex;
|
2553
|
-
var
|
2550
|
+
var itemDistance = items[i].distance;
|
2554
2551
|
var ps = series[seriesIndex].datapoints.pointsize;
|
2555
2552
|
|
2556
2553
|
foundItems.push({
|
@@ -2558,7 +2555,7 @@ Licensed under the MIT license.
|
|
2558
2555
|
dataIndex: dataIndex,
|
2559
2556
|
series: series[seriesIndex],
|
2560
2557
|
seriesIndex: seriesIndex,
|
2561
|
-
distance: Math.sqrt(
|
2558
|
+
distance: Math.sqrt(itemDistance)
|
2562
2559
|
});
|
2563
2560
|
}
|
2564
2561
|
|
@@ -2641,17 +2638,19 @@ Licensed under the MIT license.
|
|
2641
2638
|
var foundIndex = -1;
|
2642
2639
|
for (var j = 0; j < points.length; j += ps) {
|
2643
2640
|
var x = points[j], y = points[j + 1];
|
2644
|
-
if (x == null)
|
2641
|
+
if (x == null) {
|
2645
2642
|
continue;
|
2643
|
+
}
|
2646
2644
|
|
2647
2645
|
var bottom = ps === 3 ? points[j + 2] : defaultBottom;
|
2648
2646
|
// for a bar graph, the cursor must be inside the bar
|
2649
|
-
if (series.bars.horizontal
|
2650
|
-
(mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) &&
|
2651
|
-
my >= y + barLeft && my <= y + barRight)
|
2652
|
-
(mx >= x + barLeft && mx <= x + barRight &&
|
2653
|
-
my >= Math.min(bottom, y) && my <= Math.max(bottom, y)))
|
2654
|
-
|
2647
|
+
if (series.bars.horizontal
|
2648
|
+
? (mx <= Math.max(bottom, x) && mx >= Math.min(bottom, x) &&
|
2649
|
+
my >= y + barLeft && my <= y + barRight)
|
2650
|
+
: (mx >= x + barLeft && mx <= x + barRight &&
|
2651
|
+
my >= Math.min(bottom, y) && my <= Math.max(bottom, y))) {
|
2652
|
+
foundIndex = j / ps;
|
2653
|
+
}
|
2655
2654
|
}
|
2656
2655
|
|
2657
2656
|
return foundIndex;
|
@@ -10,6 +10,7 @@ selection: {
|
|
10
10
|
color: color,
|
11
11
|
shape: "round" or "miter" or "bevel",
|
12
12
|
visualization: "fill" or "focus",
|
13
|
+
displaySelectionDecorations: true or false,
|
13
14
|
minSize: number of pixels
|
14
15
|
}
|
15
16
|
|
@@ -26,6 +27,10 @@ option "focus" draws a colored bezel around the selected area while keeping
|
|
26
27
|
the selected area clear. The option "fill" highlights (i.e., fills) the
|
27
28
|
selected area with a colored highlight.
|
28
29
|
|
30
|
+
There are optional selection decorations (handles) that are rendered with the
|
31
|
+
"focus" visualization option. The selection decoration is rendered by default
|
32
|
+
but can be turned off by setting displaySelectionDecorations to false.
|
33
|
+
|
29
34
|
"minSize" is the minimum size a selection can be in pixels. This value can
|
30
35
|
be customized to determine the smallest size a selection can be and still
|
31
36
|
have the selection rectangle be displayed. When customizing this value, the
|
@@ -104,9 +109,7 @@ The plugin allso adds the following methods to the plot object:
|
|
104
109
|
// make this plugin much slimmer.
|
105
110
|
var savedhandlers = {};
|
106
111
|
|
107
|
-
|
108
|
-
|
109
|
-
function onMouseMove(e) {
|
112
|
+
function onDrag(e) {
|
110
113
|
if (selection.active) {
|
111
114
|
updateSelection(e);
|
112
115
|
|
@@ -114,7 +117,7 @@ The plugin allso adds the following methods to the plot object:
|
|
114
117
|
}
|
115
118
|
}
|
116
119
|
|
117
|
-
function
|
120
|
+
function onDragStart(e) {
|
118
121
|
var o = plot.getOptions();
|
119
122
|
// only accept left-click
|
120
123
|
if (e.which !== 1 || o.selection.mode === null) return;
|
@@ -138,17 +141,9 @@ The plugin allso adds the following methods to the plot object:
|
|
138
141
|
setSelectionPos(selection.first, e);
|
139
142
|
|
140
143
|
selection.active = true;
|
141
|
-
|
142
|
-
// this is a bit silly, but we have to use a closure to be
|
143
|
-
// able to whack the same handler again
|
144
|
-
mouseUpHandler = function (e) { onMouseUp(e); };
|
145
|
-
|
146
|
-
$(document).one("mouseup", mouseUpHandler);
|
147
144
|
}
|
148
145
|
|
149
|
-
function
|
150
|
-
mouseUpHandler = null;
|
151
|
-
|
146
|
+
function onDragEnd(e) {
|
152
147
|
// revert drag stuff for old-school browsers
|
153
148
|
if (document.onselectstart !== undefined) {
|
154
149
|
document.onselectstart = savedhandlers.onselectstart;
|
@@ -360,8 +355,9 @@ The plugin allso adds the following methods to the plot object:
|
|
360
355
|
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
361
356
|
var o = plot.getOptions();
|
362
357
|
if (o.selection.mode != null) {
|
363
|
-
|
364
|
-
|
358
|
+
plot.addEventHandler("dragstart", onDragStart, eventHolder, 0);
|
359
|
+
plot.addEventHandler("drag", onDrag, eventHolder, 0);
|
360
|
+
plot.addEventHandler("dragend", onDragEnd, eventHolder, 0);
|
365
361
|
}
|
366
362
|
});
|
367
363
|
|
@@ -459,6 +455,7 @@ The plugin allso adds the following methods to the plot object:
|
|
459
455
|
|
460
456
|
var c = $.color.parse(o.selection.color);
|
461
457
|
var visualization = o.selection.visualization;
|
458
|
+
var displaySelectionDecorations = o.selection.displaySelectionDecorations;
|
462
459
|
|
463
460
|
var scalingFactor = 1;
|
464
461
|
|
@@ -495,7 +492,10 @@ The plugin allso adds the following methods to the plot object:
|
|
495
492
|
} else {
|
496
493
|
ctx.fillRect(0, 0, plot.width(), plot.height());
|
497
494
|
ctx.clearRect(x, y, w, h);
|
498
|
-
|
495
|
+
|
496
|
+
if (displaySelectionDecorations) {
|
497
|
+
drawSelectionDecorations(ctx, x, y, w, h, oX, oY, selectionDirection(plot));
|
498
|
+
}
|
499
499
|
}
|
500
500
|
|
501
501
|
ctx.restore();
|
@@ -503,12 +503,9 @@ The plugin allso adds the following methods to the plot object:
|
|
503
503
|
});
|
504
504
|
|
505
505
|
plot.hooks.shutdown.push(function (plot, eventHolder) {
|
506
|
-
eventHolder.unbind("
|
507
|
-
eventHolder.unbind("
|
508
|
-
|
509
|
-
if (mouseUpHandler) {
|
510
|
-
$(document).unbind("mouseup", mouseUpHandler);
|
511
|
-
}
|
506
|
+
eventHolder.unbind("dragstart", onDragStart);
|
507
|
+
eventHolder.unbind("drag", onDrag);
|
508
|
+
eventHolder.unbind("dragend", onDragEnd);
|
512
509
|
});
|
513
510
|
}
|
514
511
|
|
@@ -518,6 +515,7 @@ The plugin allso adds the following methods to the plot object:
|
|
518
515
|
selection: {
|
519
516
|
mode: null, // one of null, "x", "y" or "xy"
|
520
517
|
visualization: "focus", // "focus" or "fill"
|
518
|
+
displaySelectionDecorations: true, // true or false (currently only relevant for the focus visualization)
|
521
519
|
color: "#888888",
|
522
520
|
shape: "round", // one of "round", "miter", or "bevel"
|
523
521
|
minSize: 5 // minimum number of pixels
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_range_limit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Rochkind
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blacklight
|
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
256
256
|
- !ruby/object:Gem::Version
|
257
257
|
version: '0'
|
258
258
|
requirements: []
|
259
|
-
rubygems_version: 3.
|
259
|
+
rubygems_version: 3.1.2
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: Blacklight Range Limit plugin
|