kmaterialize 2.3.3-1.0.21 → 2.3.3-1.0.22
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/components/kanban/_kanban.scss +69 -0
- package/components/kanban/kanban.ts +57 -8
- package/dist/css/materialize.colors.min.css +1 -1
- package/dist/css/materialize.css +70 -1
- package/dist/css/materialize.min.css +2 -2
- package/dist/css/materialize.min.css.map +1 -1
- package/dist/js/materialize.cjs.js +62 -10
- package/dist/js/materialize.d.ts +5 -1
- package/dist/js/materialize.js +62 -10
- package/dist/js/materialize.min.js +2 -2
- package/dist/js/materialize.mjs +62 -10
- package/package.json +1 -1
package/dist/js/materialize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Materialize v2.3.3-1.0.
|
|
2
|
+
* Materialize v2.3.3-1.0.22 (https://materializeweb.com)
|
|
3
3
|
* Copyright 2014-2026 Materialize
|
|
4
4
|
* MIT License (https://raw.githubusercontent.com/materializecss/materialize/master/LICENSE)
|
|
5
5
|
*/
|
|
@@ -1433,13 +1433,24 @@ var M = (function (exports) {
|
|
|
1433
1433
|
class Kanban extends Component {
|
|
1434
1434
|
_draggedCard = null;
|
|
1435
1435
|
_dragSourceColumn = null;
|
|
1436
|
+
_dropPreview = null;
|
|
1437
|
+
_dragImage = null;
|
|
1438
|
+
_previewHeight = 64;
|
|
1436
1439
|
_onDragStart = (event) => {
|
|
1437
1440
|
const card = event.target?.closest('.kanban-card');
|
|
1438
|
-
if (!card || !this.options.draggable)
|
|
1441
|
+
if (!card || !this.options.draggable || card.classList.contains('is-disabled') || card.getAttribute('aria-disabled') === 'true')
|
|
1439
1442
|
return;
|
|
1440
1443
|
this._draggedCard = card;
|
|
1441
1444
|
this._dragSourceColumn = card.closest('.kanban-column');
|
|
1445
|
+
this._previewHeight = Math.max(64, Math.round(card.getBoundingClientRect().height));
|
|
1442
1446
|
card.classList.add('is-dragging');
|
|
1447
|
+
this._dragImage = card.cloneNode(true);
|
|
1448
|
+
this._dragImage.classList.remove('is-dragging');
|
|
1449
|
+
this._dragImage.classList.add('kanban-drag-image');
|
|
1450
|
+
this._dragImage.setAttribute('aria-hidden', 'true');
|
|
1451
|
+
this._dragImage.style.width = `${card.getBoundingClientRect().width}px`;
|
|
1452
|
+
document.body.appendChild(this._dragImage);
|
|
1453
|
+
event.dataTransfer?.setDragImage(this._dragImage, card.offsetWidth / 2, card.offsetHeight / 2);
|
|
1443
1454
|
event.dataTransfer?.setData('text/plain', card.dataset.kanbanCard || '');
|
|
1444
1455
|
if (event.dataTransfer)
|
|
1445
1456
|
event.dataTransfer.effectAllowed = 'move';
|
|
@@ -1455,6 +1466,7 @@ var M = (function (exports) {
|
|
|
1455
1466
|
event.dataTransfer.dropEffect = 'move';
|
|
1456
1467
|
this.el.querySelectorAll('.kanban-column.is-drag-over').forEach((item) => item.classList.remove('is-drag-over'));
|
|
1457
1468
|
column.classList.add('is-drag-over');
|
|
1469
|
+
this._updateDropPreview(column, event);
|
|
1458
1470
|
};
|
|
1459
1471
|
_onDrop = (event) => {
|
|
1460
1472
|
if (!this._draggedCard)
|
|
@@ -1466,17 +1478,21 @@ var M = (function (exports) {
|
|
|
1466
1478
|
const body = column.querySelector('.kanban-column-body') || column;
|
|
1467
1479
|
const targetCard = event.target?.closest('.kanban-card');
|
|
1468
1480
|
const source = this._dragSourceColumn;
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
body.insertBefore(
|
|
1481
|
+
const movedCard = this._draggedCard;
|
|
1482
|
+
if (this._dropPreview?.parentElement === body) {
|
|
1483
|
+
body.insertBefore(movedCard, this._dropPreview);
|
|
1484
|
+
this._dropPreview.remove();
|
|
1485
|
+
}
|
|
1486
|
+
else if (targetCard && targetCard !== movedCard && targetCard.parentElement === body) {
|
|
1487
|
+
body.insertBefore(movedCard, targetCard);
|
|
1472
1488
|
}
|
|
1473
1489
|
else {
|
|
1474
|
-
body.appendChild(
|
|
1490
|
+
body.appendChild(movedCard);
|
|
1475
1491
|
}
|
|
1476
1492
|
this._clearDragState();
|
|
1477
1493
|
this._updateCounts();
|
|
1478
1494
|
if (source && source !== column)
|
|
1479
|
-
this.options.onMove?.({ card:
|
|
1495
|
+
this.options.onMove?.({ card: movedCard, from: source, to: column });
|
|
1480
1496
|
};
|
|
1481
1497
|
_onDragEnd = () => this._clearDragState();
|
|
1482
1498
|
constructor(el, options) {
|
|
@@ -1505,9 +1521,15 @@ var M = (function (exports) {
|
|
|
1505
1521
|
body.setAttribute('role', 'list');
|
|
1506
1522
|
column.querySelectorAll('.kanban-card').forEach((card) => {
|
|
1507
1523
|
card.setAttribute('role', 'listitem');
|
|
1508
|
-
card.
|
|
1509
|
-
|
|
1524
|
+
const disabled = card.classList.contains('is-disabled') || card.getAttribute('aria-disabled') === 'true';
|
|
1525
|
+
card.setAttribute('tabindex', disabled ? '-1' : '0');
|
|
1526
|
+
if (disabled) {
|
|
1527
|
+
card.setAttribute('aria-disabled', 'true');
|
|
1528
|
+
card.draggable = false;
|
|
1529
|
+
}
|
|
1530
|
+
else if (this.options.draggable) {
|
|
1510
1531
|
card.draggable = true;
|
|
1532
|
+
}
|
|
1511
1533
|
});
|
|
1512
1534
|
});
|
|
1513
1535
|
this._updateCounts();
|
|
@@ -1519,10 +1541,15 @@ var M = (function (exports) {
|
|
|
1519
1541
|
this.el.addEventListener('dragend', this._onDragEnd);
|
|
1520
1542
|
}
|
|
1521
1543
|
_clearDragState() {
|
|
1544
|
+
this._dragImage?.remove();
|
|
1545
|
+
this._dragImage = null;
|
|
1546
|
+
this._dropPreview?.remove();
|
|
1547
|
+
this._dropPreview = null;
|
|
1522
1548
|
this._draggedCard?.classList.remove('is-dragging');
|
|
1523
1549
|
this.el.querySelectorAll('.kanban-column.is-drag-over').forEach((item) => item.classList.remove('is-drag-over'));
|
|
1524
1550
|
this._draggedCard = null;
|
|
1525
1551
|
this._dragSourceColumn = null;
|
|
1552
|
+
this._previewHeight = 64;
|
|
1526
1553
|
}
|
|
1527
1554
|
_updateCounts() {
|
|
1528
1555
|
this.el.querySelectorAll('.kanban-column').forEach((column) => {
|
|
@@ -1530,8 +1557,33 @@ var M = (function (exports) {
|
|
|
1530
1557
|
const body = column.querySelector('.kanban-column-body');
|
|
1531
1558
|
if (count && body)
|
|
1532
1559
|
count.textContent = String(body.querySelectorAll(':scope > .kanban-card').length);
|
|
1560
|
+
const empty = body?.querySelector('.kanban-empty');
|
|
1561
|
+
if (empty && body)
|
|
1562
|
+
empty.hidden = body.querySelectorAll(':scope > .kanban-card').length > 0;
|
|
1533
1563
|
});
|
|
1534
1564
|
}
|
|
1565
|
+
_updateDropPreview(column, event) {
|
|
1566
|
+
const body = column.querySelector('.kanban-column-body') || column;
|
|
1567
|
+
const targetCard = event.target?.closest('.kanban-card');
|
|
1568
|
+
if (targetCard === this._draggedCard)
|
|
1569
|
+
return;
|
|
1570
|
+
if (!this._dropPreview) {
|
|
1571
|
+
this._dropPreview = document.createElement('div');
|
|
1572
|
+
this._dropPreview.className = 'kanban-drop-preview';
|
|
1573
|
+
this._dropPreview.setAttribute('aria-hidden', 'true');
|
|
1574
|
+
}
|
|
1575
|
+
// Keep the preview tied to the dragged card's original height. Using the
|
|
1576
|
+
// hovered card's height makes the placeholder jump as the pointer crosses
|
|
1577
|
+
// cards with different content lengths.
|
|
1578
|
+
this._dropPreview.style.height = `${this._previewHeight}px`;
|
|
1579
|
+
if (targetCard && targetCard.parentElement === body) {
|
|
1580
|
+
const box = targetCard.getBoundingClientRect();
|
|
1581
|
+
body.insertBefore(this._dropPreview, event.clientY < box.top + box.height / 2 ? targetCard : targetCard.nextSibling);
|
|
1582
|
+
}
|
|
1583
|
+
else if (this._dropPreview.parentElement !== body) {
|
|
1584
|
+
body.appendChild(this._dropPreview);
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1535
1587
|
destroy() {
|
|
1536
1588
|
this._clearDragState();
|
|
1537
1589
|
this.el.removeEventListener('dragstart', this._onDragStart);
|
|
@@ -9381,7 +9433,7 @@ var M = (function (exports) {
|
|
|
9381
9433
|
}
|
|
9382
9434
|
|
|
9383
9435
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
9384
|
-
const version = '2.3.3-1.0.
|
|
9436
|
+
const version = '2.3.3-1.0.22';
|
|
9385
9437
|
/**
|
|
9386
9438
|
* Convenience helper matching v1's `M.toast({...})` call, since Toast is a
|
|
9387
9439
|
* class in v2 with no bare functional equivalent of its own.
|