@internetarchive/histogram-date-range 1.1.1-alpha.3 → 1.2.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.d.ts +1 -1
- package/dist/src/histogram-date-range.js +260 -264
- package/dist/src/histogram-date-range.js.map +1 -1
- package/docs/dist/src/histogram-date-range.js +1 -1
- package/index.ts +1 -1
- package/package.json +4 -5
- package/src/histogram-date-range.ts +922 -926
- /package/{.eslintrc.cjs → .eslintrc.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { HistogramDateRange } from './src/histogram-date-range
|
|
1
|
+
export { HistogramDateRange } from './src/histogram-date-range';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { HistogramDateRange } from './src/histogram-date-range
|
|
1
|
+
export { HistogramDateRange } from './src/histogram-date-range';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["export { HistogramDateRange } from './src/histogram-date-range';\r\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, PropertyValues, SVGTemplateResult, TemplateResult } from 'lit';
|
|
2
|
-
import '@internetarchive/ia-activity-indicator';
|
|
2
|
+
import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
|
|
3
3
|
export declare class HistogramDateRange extends LitElement {
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
@@ -2,17 +2,17 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { css, html, nothing, LitElement, svg, } from 'lit';
|
|
3
3
|
import { property, state, customElement } from 'lit/decorators.js';
|
|
4
4
|
import { live } from 'lit/directives/live.js';
|
|
5
|
-
import '@internetarchive/ia-activity-indicator';
|
|
5
|
+
import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
|
|
6
6
|
/* eslint-disable-next-line */
|
|
7
7
|
/* @ts-ignore Import module -- JS, so no types */
|
|
8
|
-
|
|
8
|
+
import dayjs from 'https://esm.archive.org/dayjs@1.11.10';
|
|
9
9
|
/* eslint-disable-next-line */
|
|
10
10
|
/* @ts-ignore Import module -- JS, so no types */
|
|
11
|
-
|
|
11
|
+
import customParseFormat from 'https://esm.archive.org/dayjs@1.9.4/esm/plugin/customParseFormat';
|
|
12
12
|
// NOTE: using a specific *earlier* pegged commit for the plugin ^, because esm.archive.org has a
|
|
13
13
|
// problem creating later versions where the `export` of an included `utils.js` gets mangled. Eg:
|
|
14
14
|
// https://github.com/internetarchive/esbuild_es5/commit/ce19e8b841282c0e94d2b8e6830fd7744b2216c2#diff-4b2ed47327851d566740a30ce5f60271c059ae67eff2006bc07bb7c4fcee8b50L296
|
|
15
|
-
|
|
15
|
+
dayjs.extend(customParseFormat);
|
|
16
16
|
// these values can be overridden via the component's HTML (camelCased) attributes
|
|
17
17
|
const WIDTH = 180;
|
|
18
18
|
const HEIGHT = 40;
|
|
@@ -262,9 +262,9 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
262
262
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
263
263
|
this._tooltipOffset =
|
|
264
264
|
x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
|
|
265
|
-
this._tooltipContent = html `
|
|
266
|
-
${formattedNumItems} ${itemsText}<br />
|
|
267
|
-
${dataset.binStart} - ${dataset.binEnd}
|
|
265
|
+
this._tooltipContent = html `
|
|
266
|
+
${formattedNumItems} ${itemsText}<br />
|
|
267
|
+
${dataset.binStart} - ${dataset.binEnd}
|
|
268
268
|
`;
|
|
269
269
|
this._tooltipVisible = true;
|
|
270
270
|
}
|
|
@@ -421,17 +421,14 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
421
421
|
// it will be treated as a number instead of a string. This just makes sure
|
|
422
422
|
// we're dealing with a string.
|
|
423
423
|
const stringified = typeof date === 'string' ? date : String(date);
|
|
424
|
-
const
|
|
425
|
-
dateObj.setFullYear(Number(stringified));
|
|
426
|
-
return dateObj.getTime();
|
|
427
|
-
/*const digitGroupCount = (stringified.split(/(\d+)/).length - 1) / 2;
|
|
424
|
+
const digitGroupCount = (stringified.split(/(\d+)/).length - 1) / 2;
|
|
428
425
|
if (digitGroupCount === 1) {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
426
|
+
// if there's just a single set of digits, assume it's a year
|
|
427
|
+
const dateObj = new Date(0, 0); // start at January 1, 1900
|
|
428
|
+
dateObj.setFullYear(Number(stringified)); // override year
|
|
429
|
+
return dateObj.getTime(); // get time in milliseconds
|
|
433
430
|
}
|
|
434
|
-
return dayjs(stringified, [this.dateFormat, DATE_FORMAT]).valueOf()
|
|
431
|
+
return dayjs(stringified, [this.dateFormat, DATE_FORMAT]).valueOf();
|
|
435
432
|
}
|
|
436
433
|
/**
|
|
437
434
|
* expand or narrow the selected range by moving the slider nearest the
|
|
@@ -462,25 +459,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
462
459
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
463
460
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
464
461
|
const cs = SLIDER_CORNER_SIZE;
|
|
465
|
-
const sliderShape = `
|
|
466
|
-
M${this.minSliderX},0
|
|
467
|
-
h-${this.sliderWidth - cs}
|
|
468
|
-
q-${cs},0 -${cs},${cs}
|
|
469
|
-
v${this.height - cs * 2}
|
|
470
|
-
q0,${cs} ${cs},${cs}
|
|
471
|
-
h${this.sliderWidth - cs}
|
|
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}
|
|
472
469
|
`;
|
|
473
470
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
474
471
|
}
|
|
475
472
|
get maxSliderTemplate() {
|
|
476
473
|
const cs = SLIDER_CORNER_SIZE;
|
|
477
|
-
const sliderShape = `
|
|
478
|
-
M${this.maxSliderX},0
|
|
479
|
-
h${this.sliderWidth - cs}
|
|
480
|
-
q${cs},0 ${cs},${cs}
|
|
481
|
-
v${this.height - cs * 2}
|
|
482
|
-
q0,${cs} -${cs},${cs}
|
|
483
|
-
h-${this.sliderWidth - cs}
|
|
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}
|
|
484
481
|
`;
|
|
485
482
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
486
483
|
}
|
|
@@ -488,40 +485,40 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
488
485
|
// whether the curved part of the slider is facing towards the left (1), ie
|
|
489
486
|
// minimum, or facing towards the right (-1), ie maximum
|
|
490
487
|
const k = id === 'slider-min' ? 1 : -1;
|
|
491
|
-
return svg `
|
|
492
|
-
<svg
|
|
493
|
-
id="${id}"
|
|
494
|
-
class="
|
|
495
|
-
${this.disabled ? '' : 'draggable'}
|
|
496
|
-
${this._isDragging ? 'dragging' : ''}"
|
|
497
|
-
@pointerdown="${this.drag}"
|
|
498
|
-
>
|
|
499
|
-
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
500
|
-
<rect
|
|
501
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
502
|
-
y="${this.height / 3}"
|
|
503
|
-
width="1"
|
|
504
|
-
height="${this.height / 3}"
|
|
505
|
-
fill="white"
|
|
506
|
-
/>
|
|
507
|
-
<rect
|
|
508
|
-
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
509
|
-
y="${this.height / 3}"
|
|
510
|
-
width="1"
|
|
511
|
-
height="${this.height / 3}"
|
|
512
|
-
fill="white"
|
|
513
|
-
/>
|
|
514
|
-
</svg>
|
|
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>
|
|
515
512
|
`;
|
|
516
513
|
}
|
|
517
514
|
get selectedRangeTemplate() {
|
|
518
|
-
return svg `
|
|
519
|
-
<rect
|
|
520
|
-
x="${this.minSliderX}"
|
|
521
|
-
y="0"
|
|
522
|
-
width="${this.maxSliderX - this.minSliderX}"
|
|
523
|
-
height="${this.height}"
|
|
524
|
-
fill="${selectedRangeColor}"
|
|
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}"
|
|
525
522
|
/>`;
|
|
526
523
|
}
|
|
527
524
|
get histogramTemplate() {
|
|
@@ -533,23 +530,23 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
533
530
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
534
531
|
// extend the range by clicking on a bar)
|
|
535
532
|
return this._histData.map(data => {
|
|
536
|
-
const bar = svg `
|
|
537
|
-
<rect
|
|
538
|
-
class="bar"
|
|
539
|
-
style='stroke-dasharray: 0 ${barWidth} ${data.height} ${barWidth} 0 ${data.height};'
|
|
540
|
-
x="${x}"
|
|
541
|
-
y="${this.height - data.height}"
|
|
542
|
-
width="${barWidth}"
|
|
543
|
-
height="${data.height}"
|
|
544
|
-
@pointerenter="${this.showTooltip}"
|
|
545
|
-
@pointerleave="${this.hideTooltip}"
|
|
546
|
-
@click="${this.handleBarClick}"
|
|
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}"
|
|
547
544
|
fill="${x + barWidth >= this.minSliderX && x <= this.maxSliderX
|
|
548
545
|
? barIncludedFill
|
|
549
|
-
: barExcludedFill}"
|
|
550
|
-
data-num-items="${data.value}"
|
|
551
|
-
data-bin-start="${data.binStart}"
|
|
552
|
-
data-bin-end="${data.binEnd}"
|
|
546
|
+
: barExcludedFill}"
|
|
547
|
+
data-num-items="${data.value}"
|
|
548
|
+
data-bin-start="${data.binStart}"
|
|
549
|
+
data-bin-end="${data.binEnd}"
|
|
553
550
|
/>`;
|
|
554
551
|
x += xScale;
|
|
555
552
|
return bar;
|
|
@@ -559,14 +556,13 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
559
556
|
if (Number.isNaN(dateMS)) {
|
|
560
557
|
return '';
|
|
561
558
|
}
|
|
562
|
-
|
|
563
|
-
/*const date = dayjs(dateMS);
|
|
559
|
+
const date = dayjs(dateMS);
|
|
564
560
|
if (date.year() < 1000) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
561
|
+
// years before 1000 don't play well with dayjs custom formatting, so fall
|
|
562
|
+
// back to displaying only the year
|
|
563
|
+
return String(date.year());
|
|
568
564
|
}
|
|
569
|
-
return date.format(this.dateFormat)
|
|
565
|
+
return date.format(this.dateFormat);
|
|
570
566
|
}
|
|
571
567
|
/**
|
|
572
568
|
* NOTE: we are relying on the lit `live` directive in the template to
|
|
@@ -575,31 +571,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
575
571
|
* https://lit.dev/docs/templates/directives/#live
|
|
576
572
|
*/
|
|
577
573
|
get minInputTemplate() {
|
|
578
|
-
return html `
|
|
579
|
-
<input
|
|
580
|
-
id="date-min"
|
|
581
|
-
placeholder="${this.dateFormat}"
|
|
582
|
-
type="text"
|
|
583
|
-
@focus="${this.handleInputFocus}"
|
|
584
|
-
@blur="${this.handleMinDateInput}"
|
|
585
|
-
@keyup="${this.handleKeyUp}"
|
|
586
|
-
.value="${live(this.minSelectedDate)}"
|
|
587
|
-
?disabled="${this.disabled}"
|
|
588
|
-
/>
|
|
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
|
+
/>
|
|
589
585
|
`;
|
|
590
586
|
}
|
|
591
587
|
get maxInputTemplate() {
|
|
592
|
-
return html `
|
|
593
|
-
<input
|
|
594
|
-
id="date-max"
|
|
595
|
-
placeholder="${this.dateFormat}"
|
|
596
|
-
type="text"
|
|
597
|
-
@focus="${this.handleInputFocus}"
|
|
598
|
-
@blur="${this.handleMaxDateInput}"
|
|
599
|
-
@keyup="${this.handleKeyUp}"
|
|
600
|
-
.value="${live(this.maxSelectedDate)}"
|
|
601
|
-
?disabled="${this.disabled}"
|
|
602
|
-
/>
|
|
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
|
+
/>
|
|
603
599
|
`;
|
|
604
600
|
}
|
|
605
601
|
get minLabelTemplate() {
|
|
@@ -609,184 +605,184 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
609
605
|
return html `<label for="date-max" class="sr-only">Maximum date:</label>`;
|
|
610
606
|
}
|
|
611
607
|
get tooltipTemplate() {
|
|
612
|
-
return html `
|
|
613
|
-
<style>
|
|
614
|
-
#tooltip {
|
|
615
|
-
width: ${this.tooltipWidth}px;
|
|
616
|
-
height: ${this.tooltipHeight}px;
|
|
617
|
-
top: ${-9 - this.tooltipHeight}px;
|
|
618
|
-
left: ${this._tooltipOffset}px;
|
|
619
|
-
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
620
|
-
}
|
|
621
|
-
#tooltip:after {
|
|
622
|
-
left: ${this.tooltipWidth / 2}px;
|
|
623
|
-
}
|
|
624
|
-
</style>
|
|
625
|
-
<div id="tooltip">${this._tooltipContent}</div>
|
|
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>
|
|
626
622
|
`;
|
|
627
623
|
}
|
|
628
624
|
get noDataTemplate() {
|
|
629
|
-
return html `
|
|
630
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
625
|
+
return html `
|
|
626
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
631
627
|
`;
|
|
632
628
|
}
|
|
633
629
|
get activityIndicatorTemplate() {
|
|
634
630
|
if (!this.loading) {
|
|
635
631
|
return nothing;
|
|
636
632
|
}
|
|
637
|
-
return html `
|
|
638
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
633
|
+
return html `
|
|
634
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
639
635
|
`;
|
|
640
636
|
}
|
|
641
637
|
render() {
|
|
642
638
|
if (!this.hasBinData) {
|
|
643
639
|
return this.noDataTemplate;
|
|
644
640
|
}
|
|
645
|
-
return html `
|
|
646
|
-
<div
|
|
647
|
-
id="container"
|
|
648
|
-
class="
|
|
649
|
-
noselect
|
|
650
|
-
${this._isDragging ? 'dragging' : ''}
|
|
651
|
-
"
|
|
652
|
-
style="width: ${this.width}px"
|
|
653
|
-
>
|
|
654
|
-
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
655
|
-
<div
|
|
656
|
-
class="inner-container
|
|
657
|
-
${this.disabled ? 'disabled' : ''}"
|
|
658
|
-
>
|
|
659
|
-
<svg
|
|
660
|
-
width="${this.width}"
|
|
661
|
-
height="${this.height}"
|
|
662
|
-
@pointerleave="${this.drop}"
|
|
663
|
-
>
|
|
664
|
-
${this.selectedRangeTemplate}
|
|
665
|
-
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
666
|
-
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
667
|
-
</svg>
|
|
668
|
-
<div id="inputs">
|
|
669
|
-
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
670
|
-
<div class="dash">-</div>
|
|
671
|
-
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
672
|
-
<slot name="inputs-right-side"></slot>
|
|
673
|
-
</div>
|
|
674
|
-
</div>
|
|
675
|
-
</div>
|
|
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>
|
|
676
672
|
`;
|
|
677
673
|
}
|
|
678
674
|
};
|
|
679
|
-
HistogramDateRange.styles = css `
|
|
680
|
-
.missing-data-message {
|
|
681
|
-
text-align: center;
|
|
682
|
-
}
|
|
683
|
-
#container {
|
|
684
|
-
margin: 0;
|
|
685
|
-
touch-action: none;
|
|
686
|
-
position: relative;
|
|
687
|
-
}
|
|
688
|
-
.disabled {
|
|
689
|
-
opacity: 0.3;
|
|
690
|
-
}
|
|
691
|
-
ia-activity-indicator {
|
|
692
|
-
position: absolute;
|
|
693
|
-
left: calc(50% - 10px);
|
|
694
|
-
top: 10px;
|
|
695
|
-
width: 20px;
|
|
696
|
-
height: 20px;
|
|
697
|
-
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
698
|
-
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
702
|
-
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
703
|
-
.noselect {
|
|
704
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
705
|
-
-webkit-user-select: none; /* Safari */
|
|
706
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
707
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
708
|
-
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
709
|
-
}
|
|
710
|
-
.bar {
|
|
711
|
-
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
712
|
-
flickering when moving around between bars. this also helps with handling
|
|
713
|
-
clicks on the bars, preventing users from being able to click in between
|
|
714
|
-
bars */
|
|
715
|
-
stroke: rgba(0, 0, 0, 0);
|
|
716
|
-
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
717
|
-
stroke-width: 2px;
|
|
718
|
-
}
|
|
719
|
-
.bar:hover {
|
|
720
|
-
/* highlight currently hovered bar */
|
|
721
|
-
fill-opacity: 0.7;
|
|
722
|
-
}
|
|
723
|
-
.disabled .bar:hover {
|
|
724
|
-
/* ensure no visual hover interaction when disabled */
|
|
725
|
-
fill-opacity: 1;
|
|
726
|
-
}
|
|
727
|
-
/****** histogram ********/
|
|
728
|
-
#tooltip {
|
|
729
|
-
position: absolute;
|
|
730
|
-
background: ${tooltipBackgroundColor};
|
|
731
|
-
color: ${tooltipTextColor};
|
|
732
|
-
text-align: center;
|
|
733
|
-
border-radius: 3px;
|
|
734
|
-
padding: 2px;
|
|
735
|
-
font-size: ${tooltipFontSize};
|
|
736
|
-
font-family: ${tooltipFontFamily};
|
|
737
|
-
touch-action: none;
|
|
738
|
-
pointer-events: none;
|
|
739
|
-
}
|
|
740
|
-
#tooltip:after {
|
|
741
|
-
content: '';
|
|
742
|
-
position: absolute;
|
|
743
|
-
margin-left: -5px;
|
|
744
|
-
top: 100%;
|
|
745
|
-
/* arrow */
|
|
746
|
-
border: 5px solid ${tooltipTextColor};
|
|
747
|
-
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
748
|
-
transparent;
|
|
749
|
-
}
|
|
750
|
-
/****** slider ********/
|
|
751
|
-
.draggable:hover {
|
|
752
|
-
cursor: grab;
|
|
753
|
-
}
|
|
754
|
-
.dragging {
|
|
755
|
-
cursor: grabbing !important;
|
|
756
|
-
}
|
|
757
|
-
/****** inputs ********/
|
|
758
|
-
#inputs {
|
|
759
|
-
display: flex;
|
|
760
|
-
justify-content: center;
|
|
761
|
-
margin: ${inputRowMargin};
|
|
762
|
-
}
|
|
763
|
-
#inputs .dash {
|
|
764
|
-
position: relative;
|
|
765
|
-
bottom: -1px;
|
|
766
|
-
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
767
|
-
}
|
|
768
|
-
input {
|
|
769
|
-
width: ${inputWidth};
|
|
770
|
-
margin: 0 3px;
|
|
771
|
-
border: ${inputBorder};
|
|
772
|
-
border-radius: 2px !important;
|
|
773
|
-
text-align: center;
|
|
774
|
-
font-size: ${inputFontSize};
|
|
775
|
-
font-family: ${inputFontFamily};
|
|
776
|
-
}
|
|
777
|
-
.sr-only {
|
|
778
|
-
position: absolute !important;
|
|
779
|
-
width: 1px !important;
|
|
780
|
-
height: 1px !important;
|
|
781
|
-
margin: 0 !important;
|
|
782
|
-
padding: 0 !important;
|
|
783
|
-
border: 0 !important;
|
|
784
|
-
overflow: hidden !important;
|
|
785
|
-
white-space: nowrap !important;
|
|
786
|
-
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
787
|
-
-webkit-clip-path: inset(50%) !important;
|
|
788
|
-
clip-path: inset(50%) !important;
|
|
789
|
-
}
|
|
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
|
+
}
|
|
790
786
|
`;
|
|
791
787
|
__decorate([
|
|
792
788
|
property({ type: Number })
|