@kubex/zinc 2.0.0 → 2.0.1
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/custom-elements.json +197 -197
- package/dist/vscode.html-custom-data.json +32 -32
- package/dist/web-types.json +67 -67
- package/dist/zn.d.ts +2 -1
- package/dist/zn.min.js +3 -3
- package/package.json +1 -1
- package/src/components/data-table/data-table.scss +3 -0
- package/src/internal/reorder.ts +10 -3
package/package.json
CHANGED
|
@@ -529,6 +529,9 @@ zn-style.zn-muted {
|
|
|
529
529
|
|
|
530
530
|
.table tr .table__head--reorderable {
|
|
531
531
|
cursor: grab;
|
|
532
|
+
// A press here is a drag; starting a text selection would sweep it across the table
|
|
533
|
+
user-select: none;
|
|
534
|
+
-webkit-user-select: none;
|
|
532
535
|
|
|
533
536
|
&:active {
|
|
534
537
|
cursor: grabbing;
|
package/src/internal/reorder.ts
CHANGED
|
@@ -99,6 +99,7 @@ export class ReorderController implements ReactiveController {
|
|
|
99
99
|
private shield: HTMLElement | null = null;
|
|
100
100
|
private scroller: Element | null = null;
|
|
101
101
|
private scrollFrame = 0;
|
|
102
|
+
private pressRoot: Node | null = null;
|
|
102
103
|
|
|
103
104
|
constructor(host: ReorderHost, options: ReorderOptions = {}) {
|
|
104
105
|
this.host = host;
|
|
@@ -204,7 +205,11 @@ export class ReorderController implements ReactiveController {
|
|
|
204
205
|
window.addEventListener('pointercancel', this.onPointerCancel, true);
|
|
205
206
|
window.addEventListener('touchmove', this.onTouchMove, {capture: true, passive: false});
|
|
206
207
|
// A link or image in the row would otherwise start a native drag and take the pointer
|
|
207
|
-
window.addEventListener('dragstart', this.
|
|
208
|
+
window.addEventListener('dragstart', this.cancel, true);
|
|
209
|
+
// The press would otherwise also start a text selection that sweeps the page as it drags; selectstart isn't
|
|
210
|
+
// composed, so it's caught in the row's own tree
|
|
211
|
+
this.pressRoot = this.host.reorderRow(key)!.getRootNode();
|
|
212
|
+
this.pressRoot.addEventListener('selectstart', this.cancel, true);
|
|
208
213
|
}
|
|
209
214
|
|
|
210
215
|
private onPointerMove = (event: PointerEvent) => {
|
|
@@ -246,7 +251,7 @@ export class ReorderController implements ReactiveController {
|
|
|
246
251
|
if (this.isDragging) event.preventDefault();
|
|
247
252
|
};
|
|
248
253
|
|
|
249
|
-
private
|
|
254
|
+
private cancel = (event: Event) => {
|
|
250
255
|
event.preventDefault();
|
|
251
256
|
};
|
|
252
257
|
|
|
@@ -463,7 +468,9 @@ export class ReorderController implements ReactiveController {
|
|
|
463
468
|
window.removeEventListener('pointerup', this.onPointerUp, true);
|
|
464
469
|
window.removeEventListener('pointercancel', this.onPointerCancel, true);
|
|
465
470
|
window.removeEventListener('touchmove', this.onTouchMove, true);
|
|
466
|
-
window.removeEventListener('dragstart', this.
|
|
471
|
+
window.removeEventListener('dragstart', this.cancel, true);
|
|
472
|
+
this.pressRoot?.removeEventListener('selectstart', this.cancel, true);
|
|
473
|
+
this.pressRoot = null;
|
|
467
474
|
}
|
|
468
475
|
|
|
469
476
|
/** Shows the new order, sliding each row from its old position. */
|