@limetech/lime-elements 34.1.0-next.11 → 34.1.0-next.15
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/cjs/limel-color-picker-palette_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +69 -13
- package/dist/collection/components/color-picker/color-picker-palette.css +4 -0
- package/dist/collection/components/color-picker/color-picker.css +4 -0
- package/dist/collection/components/form/templates/common.js +1 -1
- package/dist/collection/components/menu-list/menu-list.css +981 -59
- package/dist/collection/components/slider/slider.js +69 -13
- package/dist/esm/limel-color-picker-palette_2.entry.js +1 -1
- package/dist/esm/limel-color-picker.entry.js +1 -1
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-menu-list.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +69 -13
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-50132e1d.entry.js → p-bc8c777b.entry.js} +1 -1
- package/dist/lime-elements/p-d26ca76f.entry.js +82 -0
- package/dist/lime-elements/{p-373cefb7.entry.js → p-f8a2dc0e.entry.js} +1 -1
- package/dist/lime-elements/{p-bcafdb7a.entry.js → p-fb1f00f4.entry.js} +1 -1
- package/dist/lime-elements/{p-23d59a30.entry.js → p-fbe6100e.entry.js} +1 -1
- package/dist/types/components/slider/slider.d.ts +8 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-df55ee67.entry.js +0 -82
|
@@ -1431,7 +1431,12 @@ let Slider = class {
|
|
|
1431
1431
|
*/
|
|
1432
1432
|
this.valuemin = 0;
|
|
1433
1433
|
this.changeHandler = (event) => {
|
|
1434
|
-
|
|
1434
|
+
let value = event.detail.value;
|
|
1435
|
+
const step = this.multiplyByFactor(this.step);
|
|
1436
|
+
if (!this.isMultipleOfStep(value, step)) {
|
|
1437
|
+
value = this.roundToStep(value, step);
|
|
1438
|
+
}
|
|
1439
|
+
this.change.emit(value / this.factor);
|
|
1435
1440
|
};
|
|
1436
1441
|
this.inputHandler = this.inputHandler.bind(this);
|
|
1437
1442
|
this.getContainerClassList = this.getContainerClassList.bind(this);
|
|
@@ -1443,11 +1448,10 @@ let Slider = class {
|
|
|
1443
1448
|
this.initialize();
|
|
1444
1449
|
}
|
|
1445
1450
|
initialize() {
|
|
1446
|
-
const
|
|
1447
|
-
if (!
|
|
1451
|
+
const inputElement = this.getInputElement();
|
|
1452
|
+
if (!inputElement) {
|
|
1448
1453
|
return;
|
|
1449
1454
|
}
|
|
1450
|
-
const inputElement = element.querySelector('input');
|
|
1451
1455
|
const value = this.getValue();
|
|
1452
1456
|
/*
|
|
1453
1457
|
For some reason the input element's `value` attribute is removed
|
|
@@ -1472,7 +1476,6 @@ let Slider = class {
|
|
|
1472
1476
|
*/
|
|
1473
1477
|
const greaterThanOrEqualMin = value >= this.valuemin;
|
|
1474
1478
|
const lessThanOrEqualMax = value <= this.valuemax;
|
|
1475
|
-
const dividableByStep = value % this.step === 0;
|
|
1476
1479
|
if (!greaterThanOrEqualMin) {
|
|
1477
1480
|
const newMin = this.multiplyByFactor(value);
|
|
1478
1481
|
inputElement.setAttribute('min', `${newMin}`);
|
|
@@ -1481,20 +1484,16 @@ let Slider = class {
|
|
|
1481
1484
|
const newMax = this.multiplyByFactor(value);
|
|
1482
1485
|
inputElement.setAttribute('max', `${newMax}`);
|
|
1483
1486
|
}
|
|
1484
|
-
if (!
|
|
1487
|
+
if (!this.isMultipleOfStep(value, this.step)) {
|
|
1485
1488
|
inputElement.removeAttribute('step');
|
|
1486
1489
|
}
|
|
1487
|
-
this.
|
|
1488
|
-
this.mdcSlider.listen('MDCSlider:change', this.changeHandler);
|
|
1489
|
-
this.mdcSlider.listen('MDCSlider:input', this.inputHandler);
|
|
1490
|
+
this.createMDCSlider();
|
|
1490
1491
|
}
|
|
1491
1492
|
componentWillLoad() {
|
|
1492
1493
|
this.setPercentageClass(this.value);
|
|
1493
1494
|
}
|
|
1494
1495
|
disconnectedCallback() {
|
|
1495
|
-
this.
|
|
1496
|
-
this.mdcSlider.unlisten('MDCSlider:input', this.inputHandler);
|
|
1497
|
-
this.mdcSlider.destroy();
|
|
1496
|
+
this.destroyMDCSlider();
|
|
1498
1497
|
}
|
|
1499
1498
|
getContainerClassList() {
|
|
1500
1499
|
return {
|
|
@@ -1533,7 +1532,16 @@ let Slider = class {
|
|
|
1533
1532
|
if (!this.mdcSlider) {
|
|
1534
1533
|
return;
|
|
1535
1534
|
}
|
|
1536
|
-
this.
|
|
1535
|
+
const value = this.multiplyByFactor(this.getValue());
|
|
1536
|
+
this.mdcSlider.setValue(value);
|
|
1537
|
+
if (this.isStepConfigured()) {
|
|
1538
|
+
return;
|
|
1539
|
+
}
|
|
1540
|
+
const step = this.multiplyByFactor(this.step);
|
|
1541
|
+
if (!this.isMultipleOfStep(value, step)) {
|
|
1542
|
+
return;
|
|
1543
|
+
}
|
|
1544
|
+
this.reCreateSliderWithStep();
|
|
1537
1545
|
}
|
|
1538
1546
|
updateDisabledState() {
|
|
1539
1547
|
if (!this.mdcSlider) {
|
|
@@ -1557,6 +1565,54 @@ let Slider = class {
|
|
|
1557
1565
|
setPercentageClass(value) {
|
|
1558
1566
|
this.percentageClass = getPercentageClass((value - this.valuemin) / (this.valuemax - this.valuemin));
|
|
1559
1567
|
}
|
|
1568
|
+
isMultipleOfStep(value, step) {
|
|
1569
|
+
if (!step) {
|
|
1570
|
+
return true;
|
|
1571
|
+
}
|
|
1572
|
+
return value % step === 0;
|
|
1573
|
+
}
|
|
1574
|
+
roundToStep(value, step) {
|
|
1575
|
+
return Math.round(value / step) * step;
|
|
1576
|
+
}
|
|
1577
|
+
getRootElement() {
|
|
1578
|
+
return this.rootElement.shadowRoot.querySelector('.mdc-slider');
|
|
1579
|
+
}
|
|
1580
|
+
getInputElement() {
|
|
1581
|
+
const element = this.getRootElement();
|
|
1582
|
+
if (!element) {
|
|
1583
|
+
return;
|
|
1584
|
+
}
|
|
1585
|
+
return element.querySelector('input');
|
|
1586
|
+
}
|
|
1587
|
+
isStepConfigured() {
|
|
1588
|
+
if (!this.step) {
|
|
1589
|
+
return true;
|
|
1590
|
+
}
|
|
1591
|
+
const input = this.getInputElement();
|
|
1592
|
+
if (!input) {
|
|
1593
|
+
return true;
|
|
1594
|
+
}
|
|
1595
|
+
return input.hasAttribute('step');
|
|
1596
|
+
}
|
|
1597
|
+
reCreateSliderWithStep() {
|
|
1598
|
+
const inputElement = this.getInputElement();
|
|
1599
|
+
const step = `${this.multiplyByFactor(this.step)}`;
|
|
1600
|
+
inputElement.setAttribute('step', step);
|
|
1601
|
+
this.destroyMDCSlider();
|
|
1602
|
+
this.createMDCSlider();
|
|
1603
|
+
}
|
|
1604
|
+
createMDCSlider() {
|
|
1605
|
+
const element = this.getRootElement();
|
|
1606
|
+
this.mdcSlider = new MDCSlider(element);
|
|
1607
|
+
this.mdcSlider.listen('MDCSlider:change', this.changeHandler);
|
|
1608
|
+
this.mdcSlider.listen('MDCSlider:input', this.inputHandler);
|
|
1609
|
+
}
|
|
1610
|
+
destroyMDCSlider() {
|
|
1611
|
+
this.mdcSlider.unlisten('MDCSlider:change', this.changeHandler);
|
|
1612
|
+
this.mdcSlider.unlisten('MDCSlider:input', this.inputHandler);
|
|
1613
|
+
this.mdcSlider.destroy();
|
|
1614
|
+
this.mdcSlider = undefined;
|
|
1615
|
+
}
|
|
1560
1616
|
get rootElement() { return index.getElement(this); }
|
|
1561
1617
|
static get watchers() { return {
|
|
1562
1618
|
"disabled": ["watchDisabled"],
|
|
@@ -1117,6 +1117,10 @@
|
|
|
1117
1117
|
.chosen-color-preview[style="--background:lime-yellow;"]:after {
|
|
1118
1118
|
background-color: var(--lime-yellow);
|
|
1119
1119
|
}
|
|
1120
|
+
.picker-trigger[style="--background:lime-light-grey;"]:after,
|
|
1121
|
+
.chosen-color-preview[style="--background:lime-light-grey;"]:after {
|
|
1122
|
+
background-color: var(--lime-light-grey);
|
|
1123
|
+
}
|
|
1120
1124
|
|
|
1121
1125
|
:host {
|
|
1122
1126
|
--popover-surface-width: 50rem;
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
.chosen-color-preview[style="--background:lime-yellow;"]:after {
|
|
33
33
|
background-color: var(--lime-yellow);
|
|
34
34
|
}
|
|
35
|
+
.picker-trigger[style="--background:lime-light-grey;"]:after,
|
|
36
|
+
.chosen-color-preview[style="--background:lime-light-grey;"]:after {
|
|
37
|
+
background-color: var(--lime-light-grey);
|
|
38
|
+
}
|
|
35
39
|
|
|
36
40
|
:host {
|
|
37
41
|
--popover-surface-width: 50rem;
|
|
@@ -59,7 +59,7 @@ function findFirstEntry(data, subSchema) {
|
|
|
59
59
|
getRequiredEntry(data, subSchema),
|
|
60
60
|
...Object.entries(data),
|
|
61
61
|
];
|
|
62
|
-
return entries.filter(([_, value]) => !!value)[0];
|
|
62
|
+
return entries.filter(([_, value]) => !!value && typeof value !== 'boolean')[0];
|
|
63
63
|
}
|
|
64
64
|
function getRequiredEntry(data, subSchema) {
|
|
65
65
|
if (!('required' in subSchema)) {
|