@umbraco-ui/uui-range-slider 1.10.0 → 1.12.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/custom-elements.json +13 -13
- package/lib/index.js +33 -16
- package/lib/uui-range-slider.element.d.ts +0 -2
- package/package.json +3 -3
package/custom-elements.json
CHANGED
|
@@ -70,12 +70,6 @@
|
|
|
70
70
|
"type": "string",
|
|
71
71
|
"default": "\"0,0\""
|
|
72
72
|
},
|
|
73
|
-
{
|
|
74
|
-
"name": "pristine",
|
|
75
|
-
"description": "Determines wether the form control has been touched or interacted with, this determines wether the validation-status of this form control should be made visible.",
|
|
76
|
-
"type": "boolean",
|
|
77
|
-
"default": "\"true\""
|
|
78
|
-
},
|
|
79
73
|
{
|
|
80
74
|
"name": "required",
|
|
81
75
|
"description": "Apply validation rule for requiring a value of this form control.",
|
|
@@ -99,6 +93,12 @@
|
|
|
99
93
|
"description": "Custom error message.",
|
|
100
94
|
"type": "string",
|
|
101
95
|
"default": "\"This field is invalid\""
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "pristine",
|
|
99
|
+
"description": "Determines wether the form control has been touched or interacted with, this determines wether the validation-status of this form control should be made visible.",
|
|
100
|
+
"type": "boolean",
|
|
101
|
+
"default": "\"true\""
|
|
102
102
|
}
|
|
103
103
|
],
|
|
104
104
|
"properties": [
|
|
@@ -190,13 +190,6 @@
|
|
|
190
190
|
"type": "string",
|
|
191
191
|
"default": "\"0,0\""
|
|
192
192
|
},
|
|
193
|
-
{
|
|
194
|
-
"name": "pristine",
|
|
195
|
-
"attribute": "pristine",
|
|
196
|
-
"description": "Determines wether the form control has been touched or interacted with, this determines wether the validation-status of this form control should be made visible.",
|
|
197
|
-
"type": "boolean",
|
|
198
|
-
"default": "\"true\""
|
|
199
|
-
},
|
|
200
193
|
{
|
|
201
194
|
"name": "required",
|
|
202
195
|
"attribute": "required",
|
|
@@ -232,6 +225,13 @@
|
|
|
232
225
|
{
|
|
233
226
|
"name": "validationMessage",
|
|
234
227
|
"type": "string"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "pristine",
|
|
231
|
+
"attribute": "pristine",
|
|
232
|
+
"description": "Determines wether the form control has been touched or interacted with, this determines wether the validation-status of this form control should be made visible.",
|
|
233
|
+
"type": "boolean",
|
|
234
|
+
"default": "\"true\""
|
|
235
235
|
}
|
|
236
236
|
],
|
|
237
237
|
"events": [
|
package/lib/index.js
CHANGED
|
@@ -30,17 +30,21 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
30
30
|
return result;
|
|
31
31
|
};
|
|
32
32
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
33
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
33
34
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
34
35
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
35
|
-
var _UUIRangeSliderElement_instances, transferValueToInternalValues_fn;
|
|
36
|
+
var _UUIRangeSliderElement_instances, transferValueToInternalValues_fn, _onKeyDown;
|
|
36
37
|
const Z_INDEX = {
|
|
37
38
|
TOP: 3,
|
|
38
|
-
CENTER: 2
|
|
39
|
-
BACK: 1
|
|
40
|
-
};
|
|
39
|
+
CENTER: 2};
|
|
41
40
|
const THUMB_SIZE = 18;
|
|
41
|
+
const TRACK_HEIGHT = 3;
|
|
42
42
|
const TRACK_PADDING = 12;
|
|
43
43
|
const STEP_MIN_WIDTH = 24;
|
|
44
|
+
const CountDecimalPlaces = (num) => {
|
|
45
|
+
const decimalIndex = num.toString().indexOf(".");
|
|
46
|
+
return decimalIndex >= 0 ? num.toString().length - decimalIndex - 1 : 0;
|
|
47
|
+
};
|
|
44
48
|
let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
45
49
|
/** Constructor and Validator */
|
|
46
50
|
constructor() {
|
|
@@ -64,11 +68,11 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
64
68
|
this._lowValuePercentStart = 0;
|
|
65
69
|
this._highValuePercentEnd = 100;
|
|
66
70
|
/** Events */
|
|
67
|
-
this
|
|
71
|
+
__privateAdd(this, _onKeyDown, (e) => {
|
|
68
72
|
if (e.key == "Enter") {
|
|
69
73
|
this.submit();
|
|
70
74
|
}
|
|
71
|
-
};
|
|
75
|
+
});
|
|
72
76
|
/** Touch Event */
|
|
73
77
|
this._onTouchStart = (e) => {
|
|
74
78
|
if (this.disabled) return;
|
|
@@ -133,7 +137,7 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
133
137
|
window.removeEventListener("mouseup", this._onMouseUp);
|
|
134
138
|
window.removeEventListener("mousemove", this._onMouseMove);
|
|
135
139
|
};
|
|
136
|
-
this.addEventListener("
|
|
140
|
+
this.addEventListener("keydown", __privateGet(this, _onKeyDown));
|
|
137
141
|
this.addEventListener("mousedown", this._onMouseDown);
|
|
138
142
|
this.addEventListener("touchstart", this._onTouchStart);
|
|
139
143
|
window.addEventListener("resize", () => {
|
|
@@ -392,8 +396,16 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
392
396
|
}
|
|
393
397
|
_renderThumbValues() {
|
|
394
398
|
return html`<div class="thumb-values">
|
|
395
|
-
<span
|
|
396
|
-
|
|
399
|
+
<span
|
|
400
|
+
><span
|
|
401
|
+
>${this._lowInputValue.toFixed(CountDecimalPlaces(this._step))}</span
|
|
402
|
+
></span
|
|
403
|
+
>
|
|
404
|
+
<span
|
|
405
|
+
><span
|
|
406
|
+
>${this._highInputValue.toFixed(CountDecimalPlaces(this._step))}</span
|
|
407
|
+
></span
|
|
408
|
+
>
|
|
397
409
|
</div>`;
|
|
398
410
|
}
|
|
399
411
|
_renderSteps() {
|
|
@@ -405,7 +417,7 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
405
417
|
const stepPositions = new Array(stepAmount + 1).fill(stepWidth).map((stepWidth2) => stepWidth2 * index++);
|
|
406
418
|
return html`<div class="step-wrapper">
|
|
407
419
|
<svg height="100%" width="100%">
|
|
408
|
-
<rect x="9" y="9" height="
|
|
420
|
+
<rect x="9" y="9" height="${TRACK_HEIGHT}" rx="2" />
|
|
409
421
|
${this._renderStepCircles(stepPositions)}
|
|
410
422
|
</svg>
|
|
411
423
|
${this._renderStepValues(stepAmount)}
|
|
@@ -414,7 +426,9 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
414
426
|
_renderStepValues(stepAmount) {
|
|
415
427
|
if (this.hideStepValues || stepAmount > 20) return;
|
|
416
428
|
let index = 0;
|
|
417
|
-
const stepValues = new Array(stepAmount + 1).fill(this._step).map(
|
|
429
|
+
const stepValues = new Array(stepAmount + 1).fill(this._step).map(
|
|
430
|
+
(step) => (this._min + step * index++).toFixed(CountDecimalPlaces(this._step))
|
|
431
|
+
);
|
|
418
432
|
return html`<div class="step-values">
|
|
419
433
|
${stepValues.map((value) => html`<span><span>${value}</span></span>`)}
|
|
420
434
|
</div>`;
|
|
@@ -426,9 +440,9 @@ let UUIRangeSliderElement = class extends UUIFormControlMixin(LitElement, "") {
|
|
|
426
440
|
const colorStart = this._lowInputValue - this._min;
|
|
427
441
|
const colorEnd = this._highInputValue - this._min;
|
|
428
442
|
if (cx / trackValue >= colorStart && cx / trackValue <= colorEnd) {
|
|
429
|
-
return svg`<circle class="track-step filled" cx="${cx}" cy="
|
|
443
|
+
return svg`<circle class="track-step filled" cx="${cx}" cy="${TRACK_HEIGHT * 2}" r="4.5" />`;
|
|
430
444
|
} else {
|
|
431
|
-
return svg`<circle class="track-step regular" cx="${cx}" cy="
|
|
445
|
+
return svg`<circle class="track-step regular" cx="${cx}" cy="${TRACK_HEIGHT * 2}" r="4.5" />`;
|
|
432
446
|
}
|
|
433
447
|
})}`;
|
|
434
448
|
}
|
|
@@ -482,6 +496,7 @@ transferValueToInternalValues_fn = function() {
|
|
|
482
496
|
this._updateInnerColor();
|
|
483
497
|
this.requestUpdate();
|
|
484
498
|
};
|
|
499
|
+
_onKeyDown = new WeakMap();
|
|
485
500
|
UUIRangeSliderElement.formAssociated = true;
|
|
486
501
|
/** Style */
|
|
487
502
|
UUIRangeSliderElement.styles = [
|
|
@@ -555,16 +570,18 @@ UUIRangeSliderElement.styles = [
|
|
|
555
570
|
}
|
|
556
571
|
|
|
557
572
|
:host(:not([readonly])) #inner-color-thumb:hover .color {
|
|
558
|
-
height:
|
|
573
|
+
height: ${TRACK_HEIGHT * 2}px;
|
|
559
574
|
background-color: var(--color-hover);
|
|
575
|
+
transform: translateY(-${TRACK_HEIGHT / 2}px);
|
|
560
576
|
}
|
|
561
577
|
|
|
562
578
|
.color {
|
|
563
579
|
user-select: none;
|
|
564
580
|
position: absolute;
|
|
565
581
|
inset-inline: 0;
|
|
566
|
-
height:
|
|
567
|
-
|
|
582
|
+
height: ${TRACK_HEIGHT}px;
|
|
583
|
+
top: 50%;
|
|
584
|
+
transform: translateY(0);
|
|
568
585
|
background-color: var(--color-interactive);
|
|
569
586
|
transition: height 60ms;
|
|
570
587
|
}
|
|
@@ -117,8 +117,6 @@ export declare class UUIRangeSliderElement extends UUIRangeSliderElement_base {
|
|
|
117
117
|
private _runPropertiesChecks;
|
|
118
118
|
private _updateInnerColor;
|
|
119
119
|
private _getClickedValue;
|
|
120
|
-
/** Events */
|
|
121
|
-
private _onKeypress;
|
|
122
120
|
/** Touch Event */
|
|
123
121
|
private _onTouchStart;
|
|
124
122
|
private _onTouchMove;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbraco-ui/uui-range-slider",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Umbraco",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"custom-elements.json"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@umbraco-ui/uui-base": "1.
|
|
33
|
+
"@umbraco-ui/uui-base": "1.12.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"homepage": "https://uui.umbraco.com/?path=/story/uui-range-slider",
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "0ac5219b2765bf6c90fe4943a6620b46a7fced4e"
|
|
45
45
|
}
|