@internetarchive/histogram-date-range 1.1.1-alpha.4 → 1.2.1-alpha-webdev7377.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,8 @@ export declare class HistogramDateRange extends LitElement {
|
|
|
8
8
|
tooltipHeight: number;
|
|
9
9
|
updateDelay: number;
|
|
10
10
|
dateFormat: string;
|
|
11
|
+
/** Optional; falls back to `dateFormat` if not provided */
|
|
12
|
+
tooltipDateFormat?: string;
|
|
11
13
|
missingDataMessage: string;
|
|
12
14
|
minDate: string;
|
|
13
15
|
maxDate: string;
|
|
@@ -32,7 +34,7 @@ export declare class HistogramDateRange extends LitElement {
|
|
|
32
34
|
private _emitUpdatedEventTimer?;
|
|
33
35
|
private _previousDateRange;
|
|
34
36
|
disconnectedCallback(): void;
|
|
35
|
-
|
|
37
|
+
willUpdate(changedProps: PropertyValues): void;
|
|
36
38
|
/**
|
|
37
39
|
* Set private properties that depend on the attribute bin data
|
|
38
40
|
*
|
|
@@ -46,6 +48,7 @@ export declare class HistogramDateRange extends LitElement {
|
|
|
46
48
|
private get _numBins();
|
|
47
49
|
private get histogramLeftEdgeX();
|
|
48
50
|
private get histogramRightEdgeX();
|
|
51
|
+
private get resolvedTooltipDateFormat();
|
|
49
52
|
/** component's loading (and disabled) state */
|
|
50
53
|
get loading(): boolean;
|
|
51
54
|
set loading(value: boolean);
|
|
@@ -117,7 +117,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
117
117
|
this.removeListeners();
|
|
118
118
|
super.disconnectedCallback();
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
willUpdate(changedProps) {
|
|
121
121
|
// check for changes that would affect bin data calculations
|
|
122
122
|
if (changedProps.has('bins') ||
|
|
123
123
|
changedProps.has('minDate') ||
|
|
@@ -152,7 +152,6 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
152
152
|
this.maxSelectedDate = this.maxSelectedDate
|
|
153
153
|
? this.maxSelectedDate
|
|
154
154
|
: this.maxDate;
|
|
155
|
-
this.requestUpdate();
|
|
156
155
|
}
|
|
157
156
|
calculateHistData() {
|
|
158
157
|
const minValue = Math.min(...this.bins);
|
|
@@ -168,8 +167,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
168
167
|
// use log scaling for the height of the bar to prevent tall bars from
|
|
169
168
|
// making the smaller ones too small to see
|
|
170
169
|
height: Math.floor(Math.log1p(v) * valueScale),
|
|
171
|
-
binStart: `${this.formatDate(i * dateScale + this._minDateMS)}`,
|
|
172
|
-
binEnd: `${this.formatDate((i + 1) * dateScale + this._minDateMS)}`,
|
|
170
|
+
binStart: `${this.formatDate(i * dateScale + this._minDateMS, this.resolvedTooltipDateFormat)}`,
|
|
171
|
+
binEnd: `${this.formatDate((i + 1) * dateScale + this._minDateMS, this.resolvedTooltipDateFormat)}`,
|
|
173
172
|
};
|
|
174
173
|
});
|
|
175
174
|
}
|
|
@@ -188,6 +187,12 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
188
187
|
get histogramRightEdgeX() {
|
|
189
188
|
return this.width - this.sliderWidth;
|
|
190
189
|
}
|
|
190
|
+
get resolvedTooltipDateFormat() {
|
|
191
|
+
var _a;
|
|
192
|
+
if (this.tooltipDateFormat)
|
|
193
|
+
return this.tooltipDateFormat;
|
|
194
|
+
return (_a = this.dateFormat) !== null && _a !== void 0 ? _a : DATE_FORMAT;
|
|
195
|
+
}
|
|
191
196
|
/** component's loading (and disabled) state */
|
|
192
197
|
get loading() {
|
|
193
198
|
return this._isLoading;
|
|
@@ -262,9 +267,9 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
262
267
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
263
268
|
this._tooltipOffset =
|
|
264
269
|
x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
|
|
265
|
-
this._tooltipContent = html `
|
|
266
|
-
${formattedNumItems} ${itemsText}<br />
|
|
267
|
-
${dataset.binStart} - ${dataset.binEnd}
|
|
270
|
+
this._tooltipContent = html `
|
|
271
|
+
${formattedNumItems} ${itemsText}<br />
|
|
272
|
+
${dataset.binStart} - ${dataset.binEnd}
|
|
268
273
|
`;
|
|
269
274
|
this._tooltipVisible = true;
|
|
270
275
|
}
|
|
@@ -459,25 +464,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
459
464
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
460
465
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
461
466
|
const cs = SLIDER_CORNER_SIZE;
|
|
462
|
-
const sliderShape = `
|
|
463
|
-
M${this.minSliderX},0
|
|
464
|
-
h-${this.sliderWidth - cs}
|
|
465
|
-
q-${cs},0 -${cs},${cs}
|
|
466
|
-
v${this.height - cs * 2}
|
|
467
|
-
q0,${cs} ${cs},${cs}
|
|
468
|
-
h${this.sliderWidth - cs}
|
|
467
|
+
const sliderShape = `
|
|
468
|
+
M${this.minSliderX},0
|
|
469
|
+
h-${this.sliderWidth - cs}
|
|
470
|
+
q-${cs},0 -${cs},${cs}
|
|
471
|
+
v${this.height - cs * 2}
|
|
472
|
+
q0,${cs} ${cs},${cs}
|
|
473
|
+
h${this.sliderWidth - cs}
|
|
469
474
|
`;
|
|
470
475
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
471
476
|
}
|
|
472
477
|
get maxSliderTemplate() {
|
|
473
478
|
const cs = SLIDER_CORNER_SIZE;
|
|
474
|
-
const sliderShape = `
|
|
475
|
-
M${this.maxSliderX},0
|
|
476
|
-
h${this.sliderWidth - cs}
|
|
477
|
-
q${cs},0 ${cs},${cs}
|
|
478
|
-
v${this.height - cs * 2}
|
|
479
|
-
q0,${cs} -${cs},${cs}
|
|
480
|
-
h-${this.sliderWidth - cs}
|
|
479
|
+
const sliderShape = `
|
|
480
|
+
M${this.maxSliderX},0
|
|
481
|
+
h${this.sliderWidth - cs}
|
|
482
|
+
q${cs},0 ${cs},${cs}
|
|
483
|
+
v${this.height - cs * 2}
|
|
484
|
+
q0,${cs} -${cs},${cs}
|
|
485
|
+
h-${this.sliderWidth - cs}
|
|
481
486
|
`;
|
|
482
487
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
483
488
|
}
|
|
@@ -485,40 +490,40 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
485
490
|
// whether the curved part of the slider is facing towards the left (1), ie
|
|
486
491
|
// minimum, or facing towards the right (-1), ie maximum
|
|
487
492
|
const k = id === 'slider-min' ? 1 : -1;
|
|
488
|
-
return svg `
|
|
489
|
-
<svg
|
|
490
|
-
id="${id}"
|
|
491
|
-
class="
|
|
492
|
-
${this.disabled ? '' : 'draggable'}
|
|
493
|
-
${this._isDragging ? 'dragging' : ''}"
|
|
494
|
-
@pointerdown="${this.drag}"
|
|
495
|
-
>
|
|
496
|
-
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
497
|
-
<rect
|
|
498
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
499
|
-
y="${this.height / 3}"
|
|
500
|
-
width="1"
|
|
501
|
-
height="${this.height / 3}"
|
|
502
|
-
fill="white"
|
|
503
|
-
/>
|
|
504
|
-
<rect
|
|
505
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
506
|
-
y="${this.height / 3}"
|
|
507
|
-
width="1"
|
|
508
|
-
height="${this.height / 3}"
|
|
509
|
-
fill="white"
|
|
510
|
-
/>
|
|
511
|
-
</svg>
|
|
493
|
+
return svg `
|
|
494
|
+
<svg
|
|
495
|
+
id="${id}"
|
|
496
|
+
class="
|
|
497
|
+
${this.disabled ? '' : 'draggable'}
|
|
498
|
+
${this._isDragging ? 'dragging' : ''}"
|
|
499
|
+
@pointerdown="${this.drag}"
|
|
500
|
+
>
|
|
501
|
+
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
502
|
+
<rect
|
|
503
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
504
|
+
y="${this.height / 3}"
|
|
505
|
+
width="1"
|
|
506
|
+
height="${this.height / 3}"
|
|
507
|
+
fill="white"
|
|
508
|
+
/>
|
|
509
|
+
<rect
|
|
510
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
511
|
+
y="${this.height / 3}"
|
|
512
|
+
width="1"
|
|
513
|
+
height="${this.height / 3}"
|
|
514
|
+
fill="white"
|
|
515
|
+
/>
|
|
516
|
+
</svg>
|
|
512
517
|
`;
|
|
513
518
|
}
|
|
514
519
|
get selectedRangeTemplate() {
|
|
515
|
-
return svg `
|
|
516
|
-
<rect
|
|
517
|
-
x="${this.minSliderX}"
|
|
518
|
-
y="0"
|
|
519
|
-
width="${this.maxSliderX - this.minSliderX}"
|
|
520
|
-
height="${this.height}"
|
|
521
|
-
fill="${selectedRangeColor}"
|
|
520
|
+
return svg `
|
|
521
|
+
<rect
|
|
522
|
+
x="${this.minSliderX}"
|
|
523
|
+
y="0"
|
|
524
|
+
width="${this.maxSliderX - this.minSliderX}"
|
|
525
|
+
height="${this.height}"
|
|
526
|
+
fill="${selectedRangeColor}"
|
|
522
527
|
/>`;
|
|
523
528
|
}
|
|
524
529
|
get histogramTemplate() {
|
|
@@ -530,29 +535,29 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
530
535
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
531
536
|
// extend the range by clicking on a bar)
|
|
532
537
|
return this._histData.map(data => {
|
|
533
|
-
const bar = svg `
|
|
534
|
-
<rect
|
|
535
|
-
class="bar"
|
|
536
|
-
style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${data.height};'
|
|
537
|
-
x="${x}"
|
|
538
|
-
y="${this.height - data.height}"
|
|
539
|
-
width="${barWidth}"
|
|
540
|
-
height="${data.height}"
|
|
541
|
-
@pointerenter="${this.showTooltip}"
|
|
542
|
-
@pointerleave="${this.hideTooltip}"
|
|
543
|
-
@click="${this.handleBarClick}"
|
|
538
|
+
const bar = svg `
|
|
539
|
+
<rect
|
|
540
|
+
class="bar"
|
|
541
|
+
style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${data.height};'
|
|
542
|
+
x="${x}"
|
|
543
|
+
y="${this.height - data.height}"
|
|
544
|
+
width="${barWidth}"
|
|
545
|
+
height="${data.height}"
|
|
546
|
+
@pointerenter="${this.showTooltip}"
|
|
547
|
+
@pointerleave="${this.hideTooltip}"
|
|
548
|
+
@click="${this.handleBarClick}"
|
|
544
549
|
fill="${x + barWidth >= this.minSliderX && x <= this.maxSliderX
|
|
545
550
|
? barIncludedFill
|
|
546
|
-
: barExcludedFill}"
|
|
547
|
-
data-num-items="${data.value}"
|
|
548
|
-
data-bin-start="${data.binStart}"
|
|
549
|
-
data-bin-end="${data.binEnd}"
|
|
551
|
+
: barExcludedFill}"
|
|
552
|
+
data-num-items="${data.value}"
|
|
553
|
+
data-bin-start="${data.binStart}"
|
|
554
|
+
data-bin-end="${data.binEnd}"
|
|
550
555
|
/>`;
|
|
551
556
|
x += xScale;
|
|
552
557
|
return bar;
|
|
553
558
|
});
|
|
554
559
|
}
|
|
555
|
-
formatDate(dateMS) {
|
|
560
|
+
formatDate(dateMS, format = this.dateFormat) {
|
|
556
561
|
if (Number.isNaN(dateMS)) {
|
|
557
562
|
return '';
|
|
558
563
|
}
|
|
@@ -562,7 +567,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
562
567
|
// back to displaying only the year
|
|
563
568
|
return String(date.year());
|
|
564
569
|
}
|
|
565
|
-
return date.format(
|
|
570
|
+
return date.format(format);
|
|
566
571
|
}
|
|
567
572
|
/**
|
|
568
573
|
* NOTE: we are relying on the lit `live` directive in the template to
|
|
@@ -571,31 +576,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
571
576
|
* https://lit.dev/docs/templates/directives/#live
|
|
572
577
|
*/
|
|
573
578
|
get minInputTemplate() {
|
|
574
|
-
return html `
|
|
575
|
-
<input
|
|
576
|
-
id="date-min"
|
|
577
|
-
placeholder="${this.dateFormat}"
|
|
578
|
-
type="text"
|
|
579
|
-
@focus="${this.handleInputFocus}"
|
|
580
|
-
@blur="${this.handleMinDateInput}"
|
|
581
|
-
@keyup="${this.handleKeyUp}"
|
|
582
|
-
.value="${live(this.minSelectedDate)}"
|
|
583
|
-
?disabled="${this.disabled}"
|
|
584
|
-
/>
|
|
579
|
+
return html `
|
|
580
|
+
<input
|
|
581
|
+
id="date-min"
|
|
582
|
+
placeholder="${this.dateFormat}"
|
|
583
|
+
type="text"
|
|
584
|
+
@focus="${this.handleInputFocus}"
|
|
585
|
+
@blur="${this.handleMinDateInput}"
|
|
586
|
+
@keyup="${this.handleKeyUp}"
|
|
587
|
+
.value="${live(this.minSelectedDate)}"
|
|
588
|
+
?disabled="${this.disabled}"
|
|
589
|
+
/>
|
|
585
590
|
`;
|
|
586
591
|
}
|
|
587
592
|
get maxInputTemplate() {
|
|
588
|
-
return html `
|
|
589
|
-
<input
|
|
590
|
-
id="date-max"
|
|
591
|
-
placeholder="${this.dateFormat}"
|
|
592
|
-
type="text"
|
|
593
|
-
@focus="${this.handleInputFocus}"
|
|
594
|
-
@blur="${this.handleMaxDateInput}"
|
|
595
|
-
@keyup="${this.handleKeyUp}"
|
|
596
|
-
.value="${live(this.maxSelectedDate)}"
|
|
597
|
-
?disabled="${this.disabled}"
|
|
598
|
-
/>
|
|
593
|
+
return html `
|
|
594
|
+
<input
|
|
595
|
+
id="date-max"
|
|
596
|
+
placeholder="${this.dateFormat}"
|
|
597
|
+
type="text"
|
|
598
|
+
@focus="${this.handleInputFocus}"
|
|
599
|
+
@blur="${this.handleMaxDateInput}"
|
|
600
|
+
@keyup="${this.handleKeyUp}"
|
|
601
|
+
.value="${live(this.maxSelectedDate)}"
|
|
602
|
+
?disabled="${this.disabled}"
|
|
603
|
+
/>
|
|
599
604
|
`;
|
|
600
605
|
}
|
|
601
606
|
get minLabelTemplate() {
|
|
@@ -605,184 +610,184 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
605
610
|
return html `<label for="date-max" class="sr-only">Maximum date:</label>`;
|
|
606
611
|
}
|
|
607
612
|
get tooltipTemplate() {
|
|
608
|
-
return html `
|
|
609
|
-
<style>
|
|
610
|
-
#tooltip {
|
|
611
|
-
width: ${this.tooltipWidth}px;
|
|
612
|
-
height: ${this.tooltipHeight}px;
|
|
613
|
-
top: ${-9 - this.tooltipHeight}px;
|
|
614
|
-
left: ${this._tooltipOffset}px;
|
|
615
|
-
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
616
|
-
}
|
|
617
|
-
#tooltip:after {
|
|
618
|
-
left: ${this.tooltipWidth / 2}px;
|
|
619
|
-
}
|
|
620
|
-
</style>
|
|
621
|
-
<div id="tooltip">${this._tooltipContent}</div>
|
|
613
|
+
return html `
|
|
614
|
+
<style>
|
|
615
|
+
#tooltip {
|
|
616
|
+
width: ${this.tooltipWidth}px;
|
|
617
|
+
height: ${this.tooltipHeight}px;
|
|
618
|
+
top: ${-9 - this.tooltipHeight}px;
|
|
619
|
+
left: ${this._tooltipOffset}px;
|
|
620
|
+
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
621
|
+
}
|
|
622
|
+
#tooltip:after {
|
|
623
|
+
left: ${this.tooltipWidth / 2}px;
|
|
624
|
+
}
|
|
625
|
+
</style>
|
|
626
|
+
<div id="tooltip">${this._tooltipContent}</div>
|
|
622
627
|
`;
|
|
623
628
|
}
|
|
624
629
|
get noDataTemplate() {
|
|
625
|
-
return html `
|
|
626
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
630
|
+
return html `
|
|
631
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
627
632
|
`;
|
|
628
633
|
}
|
|
629
634
|
get activityIndicatorTemplate() {
|
|
630
635
|
if (!this.loading) {
|
|
631
636
|
return nothing;
|
|
632
637
|
}
|
|
633
|
-
return html `
|
|
634
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
638
|
+
return html `
|
|
639
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
635
640
|
`;
|
|
636
641
|
}
|
|
637
642
|
render() {
|
|
638
643
|
if (!this.hasBinData) {
|
|
639
644
|
return this.noDataTemplate;
|
|
640
645
|
}
|
|
641
|
-
return html `
|
|
642
|
-
<div
|
|
643
|
-
id="container"
|
|
644
|
-
class="
|
|
645
|
-
noselect
|
|
646
|
-
${this._isDragging ? 'dragging' : ''}
|
|
647
|
-
"
|
|
648
|
-
style="width: ${this.width}px"
|
|
649
|
-
>
|
|
650
|
-
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
651
|
-
<div
|
|
652
|
-
class="inner-container
|
|
653
|
-
${this.disabled ? 'disabled' : ''}"
|
|
654
|
-
>
|
|
655
|
-
<svg
|
|
656
|
-
width="${this.width}"
|
|
657
|
-
height="${this.height}"
|
|
658
|
-
@pointerleave="${this.drop}"
|
|
659
|
-
>
|
|
660
|
-
${this.selectedRangeTemplate}
|
|
661
|
-
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
662
|
-
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
663
|
-
</svg>
|
|
664
|
-
<div id="inputs">
|
|
665
|
-
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
666
|
-
<div class="dash">-</div>
|
|
667
|
-
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
668
|
-
<slot name="inputs-right-side"></slot>
|
|
669
|
-
</div>
|
|
670
|
-
</div>
|
|
671
|
-
</div>
|
|
646
|
+
return html `
|
|
647
|
+
<div
|
|
648
|
+
id="container"
|
|
649
|
+
class="
|
|
650
|
+
noselect
|
|
651
|
+
${this._isDragging ? 'dragging' : ''}
|
|
652
|
+
"
|
|
653
|
+
style="width: ${this.width}px"
|
|
654
|
+
>
|
|
655
|
+
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
656
|
+
<div
|
|
657
|
+
class="inner-container
|
|
658
|
+
${this.disabled ? 'disabled' : ''}"
|
|
659
|
+
>
|
|
660
|
+
<svg
|
|
661
|
+
width="${this.width}"
|
|
662
|
+
height="${this.height}"
|
|
663
|
+
@pointerleave="${this.drop}"
|
|
664
|
+
>
|
|
665
|
+
${this.selectedRangeTemplate}
|
|
666
|
+
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
667
|
+
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
668
|
+
</svg>
|
|
669
|
+
<div id="inputs">
|
|
670
|
+
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
671
|
+
<div class="dash">-</div>
|
|
672
|
+
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
673
|
+
<slot name="inputs-right-side"></slot>
|
|
674
|
+
</div>
|
|
675
|
+
</div>
|
|
676
|
+
</div>
|
|
672
677
|
`;
|
|
673
678
|
}
|
|
674
679
|
};
|
|
675
|
-
HistogramDateRange.styles = css `
|
|
676
|
-
.missing-data-message {
|
|
677
|
-
text-align: center;
|
|
678
|
-
}
|
|
679
|
-
#container {
|
|
680
|
-
margin: 0;
|
|
681
|
-
touch-action: none;
|
|
682
|
-
position: relative;
|
|
683
|
-
}
|
|
684
|
-
.disabled {
|
|
685
|
-
opacity: 0.3;
|
|
686
|
-
}
|
|
687
|
-
ia-activity-indicator {
|
|
688
|
-
position: absolute;
|
|
689
|
-
left: calc(50% - 10px);
|
|
690
|
-
top: 10px;
|
|
691
|
-
width: 20px;
|
|
692
|
-
height: 20px;
|
|
693
|
-
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
694
|
-
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
698
|
-
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
699
|
-
.noselect {
|
|
700
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
701
|
-
-webkit-user-select: none; /* Safari */
|
|
702
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
703
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
704
|
-
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
705
|
-
}
|
|
706
|
-
.bar {
|
|
707
|
-
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
708
|
-
flickering when moving around between bars. this also helps with handling
|
|
709
|
-
clicks on the bars, preventing users from being able to click in between
|
|
710
|
-
bars */
|
|
711
|
-
stroke: rgba(0, 0, 0, 0);
|
|
712
|
-
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
713
|
-
stroke-width: 2px;
|
|
714
|
-
}
|
|
715
|
-
.bar:hover {
|
|
716
|
-
/* highlight currently hovered bar */
|
|
717
|
-
fill-opacity: 0.7;
|
|
718
|
-
}
|
|
719
|
-
.disabled .bar:hover {
|
|
720
|
-
/* ensure no visual hover interaction when disabled */
|
|
721
|
-
fill-opacity: 1;
|
|
722
|
-
}
|
|
723
|
-
/****** histogram ********/
|
|
724
|
-
#tooltip {
|
|
725
|
-
position: absolute;
|
|
726
|
-
background: ${tooltipBackgroundColor};
|
|
727
|
-
color: ${tooltipTextColor};
|
|
728
|
-
text-align: center;
|
|
729
|
-
border-radius: 3px;
|
|
730
|
-
padding: 2px;
|
|
731
|
-
font-size: ${tooltipFontSize};
|
|
732
|
-
font-family: ${tooltipFontFamily};
|
|
733
|
-
touch-action: none;
|
|
734
|
-
pointer-events: none;
|
|
735
|
-
}
|
|
736
|
-
#tooltip:after {
|
|
737
|
-
content: '';
|
|
738
|
-
position: absolute;
|
|
739
|
-
margin-left: -5px;
|
|
740
|
-
top: 100%;
|
|
741
|
-
/* arrow */
|
|
742
|
-
border: 5px solid ${tooltipTextColor};
|
|
743
|
-
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
744
|
-
transparent;
|
|
745
|
-
}
|
|
746
|
-
/****** slider ********/
|
|
747
|
-
.draggable:hover {
|
|
748
|
-
cursor: grab;
|
|
749
|
-
}
|
|
750
|
-
.dragging {
|
|
751
|
-
cursor: grabbing !important;
|
|
752
|
-
}
|
|
753
|
-
/****** inputs ********/
|
|
754
|
-
#inputs {
|
|
755
|
-
display: flex;
|
|
756
|
-
justify-content: center;
|
|
757
|
-
margin: ${inputRowMargin};
|
|
758
|
-
}
|
|
759
|
-
#inputs .dash {
|
|
760
|
-
position: relative;
|
|
761
|
-
bottom: -1px;
|
|
762
|
-
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
763
|
-
}
|
|
764
|
-
input {
|
|
765
|
-
width: ${inputWidth};
|
|
766
|
-
margin: 0 3px;
|
|
767
|
-
border: ${inputBorder};
|
|
768
|
-
border-radius: 2px !important;
|
|
769
|
-
text-align: center;
|
|
770
|
-
font-size: ${inputFontSize};
|
|
771
|
-
font-family: ${inputFontFamily};
|
|
772
|
-
}
|
|
773
|
-
.sr-only {
|
|
774
|
-
position: absolute !important;
|
|
775
|
-
width: 1px !important;
|
|
776
|
-
height: 1px !important;
|
|
777
|
-
margin: 0 !important;
|
|
778
|
-
padding: 0 !important;
|
|
779
|
-
border: 0 !important;
|
|
780
|
-
overflow: hidden !important;
|
|
781
|
-
white-space: nowrap !important;
|
|
782
|
-
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
783
|
-
-webkit-clip-path: inset(50%) !important;
|
|
784
|
-
clip-path: inset(50%) !important;
|
|
785
|
-
}
|
|
680
|
+
HistogramDateRange.styles = css `
|
|
681
|
+
.missing-data-message {
|
|
682
|
+
text-align: center;
|
|
683
|
+
}
|
|
684
|
+
#container {
|
|
685
|
+
margin: 0;
|
|
686
|
+
touch-action: none;
|
|
687
|
+
position: relative;
|
|
688
|
+
}
|
|
689
|
+
.disabled {
|
|
690
|
+
opacity: 0.3;
|
|
691
|
+
}
|
|
692
|
+
ia-activity-indicator {
|
|
693
|
+
position: absolute;
|
|
694
|
+
left: calc(50% - 10px);
|
|
695
|
+
top: 10px;
|
|
696
|
+
width: 20px;
|
|
697
|
+
height: 20px;
|
|
698
|
+
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
699
|
+
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
703
|
+
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
704
|
+
.noselect {
|
|
705
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
706
|
+
-webkit-user-select: none; /* Safari */
|
|
707
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
708
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
709
|
+
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
710
|
+
}
|
|
711
|
+
.bar {
|
|
712
|
+
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
713
|
+
flickering when moving around between bars. this also helps with handling
|
|
714
|
+
clicks on the bars, preventing users from being able to click in between
|
|
715
|
+
bars */
|
|
716
|
+
stroke: rgba(0, 0, 0, 0);
|
|
717
|
+
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
718
|
+
stroke-width: 2px;
|
|
719
|
+
}
|
|
720
|
+
.bar:hover {
|
|
721
|
+
/* highlight currently hovered bar */
|
|
722
|
+
fill-opacity: 0.7;
|
|
723
|
+
}
|
|
724
|
+
.disabled .bar:hover {
|
|
725
|
+
/* ensure no visual hover interaction when disabled */
|
|
726
|
+
fill-opacity: 1;
|
|
727
|
+
}
|
|
728
|
+
/****** histogram ********/
|
|
729
|
+
#tooltip {
|
|
730
|
+
position: absolute;
|
|
731
|
+
background: ${tooltipBackgroundColor};
|
|
732
|
+
color: ${tooltipTextColor};
|
|
733
|
+
text-align: center;
|
|
734
|
+
border-radius: 3px;
|
|
735
|
+
padding: 2px;
|
|
736
|
+
font-size: ${tooltipFontSize};
|
|
737
|
+
font-family: ${tooltipFontFamily};
|
|
738
|
+
touch-action: none;
|
|
739
|
+
pointer-events: none;
|
|
740
|
+
}
|
|
741
|
+
#tooltip:after {
|
|
742
|
+
content: '';
|
|
743
|
+
position: absolute;
|
|
744
|
+
margin-left: -5px;
|
|
745
|
+
top: 100%;
|
|
746
|
+
/* arrow */
|
|
747
|
+
border: 5px solid ${tooltipTextColor};
|
|
748
|
+
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
749
|
+
transparent;
|
|
750
|
+
}
|
|
751
|
+
/****** slider ********/
|
|
752
|
+
.draggable:hover {
|
|
753
|
+
cursor: grab;
|
|
754
|
+
}
|
|
755
|
+
.dragging {
|
|
756
|
+
cursor: grabbing !important;
|
|
757
|
+
}
|
|
758
|
+
/****** inputs ********/
|
|
759
|
+
#inputs {
|
|
760
|
+
display: flex;
|
|
761
|
+
justify-content: center;
|
|
762
|
+
margin: ${inputRowMargin};
|
|
763
|
+
}
|
|
764
|
+
#inputs .dash {
|
|
765
|
+
position: relative;
|
|
766
|
+
bottom: -1px;
|
|
767
|
+
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
768
|
+
}
|
|
769
|
+
input {
|
|
770
|
+
width: ${inputWidth};
|
|
771
|
+
margin: 0 3px;
|
|
772
|
+
border: ${inputBorder};
|
|
773
|
+
border-radius: 2px !important;
|
|
774
|
+
text-align: center;
|
|
775
|
+
font-size: ${inputFontSize};
|
|
776
|
+
font-family: ${inputFontFamily};
|
|
777
|
+
}
|
|
778
|
+
.sr-only {
|
|
779
|
+
position: absolute !important;
|
|
780
|
+
width: 1px !important;
|
|
781
|
+
height: 1px !important;
|
|
782
|
+
margin: 0 !important;
|
|
783
|
+
padding: 0 !important;
|
|
784
|
+
border: 0 !important;
|
|
785
|
+
overflow: hidden !important;
|
|
786
|
+
white-space: nowrap !important;
|
|
787
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
788
|
+
-webkit-clip-path: inset(50%) !important;
|
|
789
|
+
clip-path: inset(50%) !important;
|
|
790
|
+
}
|
|
786
791
|
`;
|
|
787
792
|
__decorate([
|
|
788
793
|
property({ type: Number })
|
|
@@ -805,6 +810,9 @@ __decorate([
|
|
|
805
810
|
__decorate([
|
|
806
811
|
property({ type: String })
|
|
807
812
|
], HistogramDateRange.prototype, "dateFormat", void 0);
|
|
813
|
+
__decorate([
|
|
814
|
+
property({ type: String })
|
|
815
|
+
], HistogramDateRange.prototype, "tooltipDateFormat", void 0);
|
|
808
816
|
__decorate([
|
|
809
817
|
property({ type: String })
|
|
810
818
|
], HistogramDateRange.prototype, "missingDataMessage", void 0);
|
|
@@ -818,7 +826,7 @@ __decorate([
|
|
|
818
826
|
property({ type: Boolean })
|
|
819
827
|
], HistogramDateRange.prototype, "disabled", void 0);
|
|
820
828
|
__decorate([
|
|
821
|
-
property({ type:
|
|
829
|
+
property({ type: Array })
|
|
822
830
|
], HistogramDateRange.prototype, "bins", void 0);
|
|
823
831
|
__decorate([
|
|
824
832
|
property({ type: Boolean })
|