@libs-ui/components-drag-drop 0.2.305 → 0.2.306-10
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/README.md +51 -45
- package/drag-drop.directive.d.ts +5 -4
- package/drag-drop.service.d.ts +3 -3
- package/drag-item-in-container-virtual-scroll.directive.d.ts +5 -5
- package/drag-item.directive.d.ts +3 -3
- package/drag-scroll.directive.d.ts +5 -5
- package/esm2022/defines/css.define.mjs +18 -16
- package/esm2022/demo/demo.component.mjs +184 -157
- package/esm2022/drag-drop.directive.mjs +65 -47
- package/esm2022/drag-drop.service.mjs +9 -5
- package/esm2022/drag-item-in-container-virtual-scroll.directive.mjs +21 -20
- package/esm2022/drag-item.directive.mjs +27 -22
- package/esm2022/drag-scroll.directive.mjs +21 -15
- package/esm2022/index.mjs +1 -1
- package/esm2022/interfaces/event.interface.mjs +1 -1
- package/fesm2022/libs-ui-components-drag-drop.mjs +319 -256
- package/fesm2022/libs-ui-components-drag-drop.mjs.map +1 -1
- package/interfaces/event.interface.d.ts +1 -1
- package/package.json +3 -3
|
@@ -6,53 +6,55 @@ import { CommonModule } from '@angular/common';
|
|
|
6
6
|
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
7
7
|
|
|
8
8
|
const styleContainer = (config, viewEncapsulation, groupID) => {
|
|
9
|
-
const defaultConfig = [
|
|
9
|
+
const defaultConfig = [
|
|
10
|
+
{
|
|
10
11
|
className: 'libs-ui-drag-drop-container',
|
|
11
|
-
styles: `display:block
|
|
12
|
+
styles: `display:block;`,
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
15
|
className: 'libs-ui-drag-drop-item',
|
|
15
16
|
styles: `
|
|
16
|
-
cursor:move
|
|
17
|
+
cursor:move;`,
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
className: 'libs-ui-drag-drop-item-placeholder',
|
|
20
|
-
styles: `visibility: hidden
|
|
21
|
+
styles: `visibility: hidden;`,
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
className: 'libs-ui-drag-drop-item-origin-placeholder',
|
|
24
|
-
styles: `visibility: hidden
|
|
25
|
+
styles: `visibility: hidden;`,
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
className: 'libs-ui-drag-drop-item-drop-placeholder',
|
|
28
|
-
styles: `visibility: hidden
|
|
29
|
+
styles: `visibility: hidden;`,
|
|
29
30
|
},
|
|
30
31
|
{
|
|
31
32
|
className: 'libs-ui-drag-drop-item-dragging',
|
|
32
|
-
styles: `cursor:move; user-select: none;
|
|
33
|
+
styles: `cursor:move; user-select: none; `,
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
className: 'libs-ui-drag-drop-item-disable',
|
|
36
|
-
styles: ` cursor:not-allowed
|
|
37
|
+
styles: ` cursor:not-allowed;`,
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
className: 'libs-ui-drag-drop-item-translate-bottom',
|
|
40
|
-
styles: `position:relative;animation: translateBottom 0.35s 1 ease
|
|
41
|
+
styles: `position:relative;animation: translateBottom 0.35s 1 ease;`,
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
className: 'libs-ui-drag-drop-item-translate-top',
|
|
44
|
-
styles: `position:relative;animation: translateTop 0.35s 1 ease
|
|
45
|
+
styles: `position:relative;animation: translateTop 0.35s 1 ease;`,
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
48
|
className: 'libs-ui-drag-drop-item-translate-left',
|
|
48
|
-
styles: `position:relative;animation: translateLeft 0.35s 1 ease
|
|
49
|
+
styles: `position:relative;animation: translateLeft 0.35s 1 ease;`,
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
className: 'libs-ui-drag-drop-item-translate-right',
|
|
52
|
-
styles: `position:relative;animation: translateRight 0.35s 1 ease
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
styles: `position:relative;animation: translateRight 0.35s 1 ease;`,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
config.forEach((item) => {
|
|
57
|
+
const itemExits = defaultConfig.find((defaultItem) => defaultItem.className === item.className);
|
|
56
58
|
if (itemExits) {
|
|
57
59
|
itemExits.styles = item.styles;
|
|
58
60
|
return;
|
|
@@ -181,7 +183,11 @@ class MoLibsSharedDragDropService {
|
|
|
181
183
|
if (groupNameOfContainer !== groupNameOfElementDrag && !groupNameOfDropTo) {
|
|
182
184
|
return false;
|
|
183
185
|
}
|
|
184
|
-
if (groupNameOfDropTo !== null &&
|
|
186
|
+
if (groupNameOfDropTo !== null &&
|
|
187
|
+
!groupNameOfDropTo
|
|
188
|
+
.toString()
|
|
189
|
+
.split(';')
|
|
190
|
+
.includes(groupNameOfContainer || 'undefinedName')) {
|
|
185
191
|
return false;
|
|
186
192
|
}
|
|
187
193
|
return true;
|
|
@@ -192,10 +198,11 @@ class MoLibsSharedDragDropService {
|
|
|
192
198
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: MoLibsSharedDragDropService, decorators: [{
|
|
193
199
|
type: Injectable,
|
|
194
200
|
args: [{
|
|
195
|
-
providedIn: 'any'
|
|
201
|
+
providedIn: 'any',
|
|
196
202
|
}]
|
|
197
203
|
}] });
|
|
198
204
|
|
|
205
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
199
206
|
class LibsUiComponentsDragScrollDirective {
|
|
200
207
|
// #region PROPERTY
|
|
201
208
|
stopScroll = signal(false);
|
|
@@ -204,8 +211,8 @@ class LibsUiComponentsDragScrollDirective {
|
|
|
204
211
|
onDestroy = new Subject();
|
|
205
212
|
// #region INPUT
|
|
206
213
|
ignoreAutoScroll = input();
|
|
207
|
-
widthZoneDetect = input(16, { transform: value => value ?? 16 });
|
|
208
|
-
movementLength = input(6, { transform: value => value ?? 6 });
|
|
214
|
+
widthZoneDetect = input(16, { transform: (value) => value ?? 16 });
|
|
215
|
+
movementLength = input(6, { transform: (value) => value ?? 6 });
|
|
209
216
|
rootElementScroll = input();
|
|
210
217
|
virtualScrollerComponent = input();
|
|
211
218
|
// #region INJECT
|
|
@@ -236,7 +243,9 @@ class LibsUiComponentsDragScrollDirective {
|
|
|
236
243
|
if (!this.virtualScrollerComponent) {
|
|
237
244
|
return;
|
|
238
245
|
}
|
|
239
|
-
this.virtualScrollerComponent()
|
|
246
|
+
this.virtualScrollerComponent()
|
|
247
|
+
?.vsChange.pipe(takeUntil(this.onDestroy))
|
|
248
|
+
.subscribe((pageInfo) => {
|
|
240
249
|
const items = get(this.virtualScrollerComponent, '_items');
|
|
241
250
|
if (items && items.length === pageInfo.endIndex) {
|
|
242
251
|
this.virtualScrollPageInfo.set(pageInfo);
|
|
@@ -277,7 +286,7 @@ class LibsUiComponentsDragScrollDirective {
|
|
|
277
286
|
return;
|
|
278
287
|
}
|
|
279
288
|
this.intervalScrollToElement.set(setInterval(() => {
|
|
280
|
-
elementSetScroll =
|
|
289
|
+
elementSetScroll = this.rootElementScroll() || this.elementRef.nativeElement;
|
|
281
290
|
let directionTop = 0;
|
|
282
291
|
let directionLeft = 0;
|
|
283
292
|
if (top <= clientY && clientY <= top + this.widthZoneDetect()) {
|
|
@@ -291,7 +300,7 @@ class LibsUiComponentsDragScrollDirective {
|
|
|
291
300
|
elementSetScroll.scrollTop += this.movementLength();
|
|
292
301
|
directionTop = 1;
|
|
293
302
|
}
|
|
294
|
-
if (
|
|
303
|
+
if (limitLeft - this.widthZoneDetect() <= clientX && clientX <= limitLeft) {
|
|
295
304
|
if (this.stopScroll()) {
|
|
296
305
|
return;
|
|
297
306
|
}
|
|
@@ -302,13 +311,16 @@ class LibsUiComponentsDragScrollDirective {
|
|
|
302
311
|
elementSetScroll.scrollLeft -= this.movementLength();
|
|
303
312
|
directionLeft = -1;
|
|
304
313
|
}
|
|
305
|
-
if (elementSetScroll.scrollLeft &&
|
|
314
|
+
if (elementSetScroll.scrollLeft && elementSetScroll.scrollLeft + elementSetScroll.offsetWidth >= elementSetScroll.scrollWidth) {
|
|
306
315
|
elementSetScroll.scrollLeft -= elementSetScroll.scrollLeft + elementSetScroll.offsetWidth - elementSetScroll.scrollWidth;
|
|
307
316
|
}
|
|
308
|
-
if (elementSetScroll.scrollTop &&
|
|
317
|
+
if (elementSetScroll.scrollTop && elementSetScroll.scrollTop + elementSetScroll.offsetHeight >= elementSetScroll.scrollHeight) {
|
|
309
318
|
elementSetScroll.scrollTop -= elementSetScroll.scrollTop + elementSetScroll.offsetHeight - elementSetScroll.scrollHeight;
|
|
310
319
|
}
|
|
311
|
-
if ((directionTop < 0 && !elementSetScroll.scrollTop) ||
|
|
320
|
+
if ((directionTop < 0 && !elementSetScroll.scrollTop) ||
|
|
321
|
+
(!elementSetScroll.scrollLeft && directionLeft < 0) ||
|
|
322
|
+
(directionTop && elementSetScroll.scrollHeight <= elementSetScroll.scrollTop + elementSetScroll.offsetHeight + 3) ||
|
|
323
|
+
(directionLeft && elementSetScroll.scrollWidth <= elementSetScroll.scrollLeft + elementSetScroll.offsetWidth + 3)) {
|
|
312
324
|
return clearInterval(this.intervalScrollToElement());
|
|
313
325
|
}
|
|
314
326
|
}, 10));
|
|
@@ -324,8 +336,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
324
336
|
type: Directive,
|
|
325
337
|
args: [{
|
|
326
338
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
327
|
-
selector:
|
|
328
|
-
standalone: true
|
|
339
|
+
selector: '[LibsUiComponentsDragScrollDirective]',
|
|
340
|
+
standalone: true,
|
|
329
341
|
}]
|
|
330
342
|
}] });
|
|
331
343
|
|
|
@@ -336,12 +348,12 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
336
348
|
cdr = inject(ChangeDetectorRef);
|
|
337
349
|
// #region INPUT
|
|
338
350
|
disableDragContainer = input();
|
|
339
|
-
mode = input('move', { transform: value => value ?? 'move' });
|
|
351
|
+
mode = input('move', { transform: (value) => value ?? 'move' });
|
|
340
352
|
directionDrag = input();
|
|
341
|
-
viewEncapsulation = input('emulated', { transform: value => value ?? 'emulated' });
|
|
342
|
-
acceptDragSameGroup = input(false, { transform: value => value ?? false });
|
|
343
|
-
placeholder = input(true, { transform: value => value ?? true });
|
|
344
|
-
groupName = input('groupDragAndDropDefault', { transform: value => value ?? 'groupDragAndDropDefault' }); // nếu các group có tên trùng nhau sẽ được drop
|
|
353
|
+
viewEncapsulation = input('emulated', { transform: (value) => value ?? 'emulated' });
|
|
354
|
+
acceptDragSameGroup = input(false, { transform: (value) => value ?? false });
|
|
355
|
+
placeholder = input(true, { transform: (value) => value ?? true });
|
|
356
|
+
groupName = input('groupDragAndDropDefault', { transform: (value) => value ?? 'groupDragAndDropDefault' }); // nếu các group có tên trùng nhau sẽ được drop
|
|
345
357
|
dropToGroupName = input(null); // nếu item trong các group A được drop vào group B nhưng group B không được drop vào group A
|
|
346
358
|
items = model.required();
|
|
347
359
|
stylesOverride = input();
|
|
@@ -359,11 +371,12 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
359
371
|
const container = { element };
|
|
360
372
|
this.dragDropService.Container().set(this.groupID(), container);
|
|
361
373
|
effect(() => {
|
|
362
|
-
|
|
374
|
+
const elementScroll = this.rootElementScroll();
|
|
375
|
+
if (!elementScroll) {
|
|
363
376
|
return;
|
|
364
377
|
}
|
|
365
378
|
untracked(() => {
|
|
366
|
-
set(container, 'elementScroll',
|
|
379
|
+
set(container, 'elementScroll', elementScroll);
|
|
367
380
|
});
|
|
368
381
|
});
|
|
369
382
|
effect(() => {
|
|
@@ -378,13 +391,13 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
378
391
|
});
|
|
379
392
|
}
|
|
380
393
|
ngAfterViewInit() {
|
|
381
|
-
this.outFunctionControl.emit(
|
|
382
|
-
this.outDroppedContainer.subscribe(eventDropped => {
|
|
394
|
+
this.outFunctionControl.emit(this.FunctionsControl);
|
|
395
|
+
this.outDroppedContainer.subscribe((eventDropped) => {
|
|
383
396
|
this.dragDropService.OnDropContainer.next(eventDropped);
|
|
384
397
|
});
|
|
385
398
|
this.onDestroy.subscribe(() => {
|
|
386
399
|
if (indexSpliceListTo > -1) {
|
|
387
|
-
this.items.update(items => {
|
|
400
|
+
this.items.update((items) => {
|
|
388
401
|
items.splice(indexSpliceListTo, 1);
|
|
389
402
|
return [...items];
|
|
390
403
|
});
|
|
@@ -393,9 +406,9 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
393
406
|
});
|
|
394
407
|
const elementContainer = this.elementRef.nativeElement;
|
|
395
408
|
this.initStyleAndAttribute(elementContainer, true);
|
|
396
|
-
this.dragDropService.OnItemInit.pipe(debounceTime(250), filter(groupName => groupName === this.groupName()), takeUntil(this.onDestroy)).subscribe(() => this.initStyleAndAttribute(elementContainer));
|
|
397
|
-
const styleTag = document.createElement(
|
|
398
|
-
styleTag.textContent = styleContainer(
|
|
409
|
+
this.dragDropService.OnItemInit.pipe(debounceTime(250), filter((groupName) => groupName === this.groupName()), takeUntil(this.onDestroy)).subscribe(() => this.initStyleAndAttribute(elementContainer));
|
|
410
|
+
const styleTag = document.createElement('style');
|
|
411
|
+
styleTag.textContent = styleContainer(this.stylesOverride() || [], this.viewEncapsulation(), this.groupID());
|
|
399
412
|
elementContainer.appendChild(styleTag);
|
|
400
413
|
elementContainer.classList.add(this.dragDropService.ClassContainerDefine);
|
|
401
414
|
const handlerDragStart = (eventDragStart) => {
|
|
@@ -415,10 +428,11 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
415
428
|
const indexDragOver = Number(elementDragOver.getAttribute('index')).valueOf();
|
|
416
429
|
const idGroupElementDrag = elementDrag.getAttribute('groupID');
|
|
417
430
|
const idGroupElementDragOver = elementDragOver.getAttribute('groupID');
|
|
418
|
-
if (
|
|
431
|
+
if (this.groupID() !== idGroupElementDrag || idGroupElementDrag !== idGroupElementDragOver) {
|
|
432
|
+
// xử lý cho item drag over qua 1 item khác container
|
|
419
433
|
if (idGroupElementDragOver === this.groupID() && this.placeholder()) {
|
|
420
434
|
const item = this.mode() === 'copy' ? cloneDeep(this.dragDropService.ItemDragInfo?.item) : this.dragDropService.ItemDragInfo?.item;
|
|
421
|
-
this.items.update(items => {
|
|
435
|
+
this.items.update((items) => {
|
|
422
436
|
if (indexSpliceListTo >= 0) {
|
|
423
437
|
items.splice(indexSpliceListTo, 1);
|
|
424
438
|
}
|
|
@@ -431,7 +445,13 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
431
445
|
}
|
|
432
446
|
return;
|
|
433
447
|
}
|
|
434
|
-
if (!this.acceptDragSameGroup() ||
|
|
448
|
+
if (!this.acceptDragSameGroup() ||
|
|
449
|
+
indexDrag < 0 ||
|
|
450
|
+
indexDragOver < 0 ||
|
|
451
|
+
!this.items().length ||
|
|
452
|
+
indexDrag > this.items().length ||
|
|
453
|
+
indexDragOver > this.items().length ||
|
|
454
|
+
(storeIndex.indexDrag === indexDrag && storeIndex.indexDragOver === indexDragOver)) {
|
|
435
455
|
return;
|
|
436
456
|
}
|
|
437
457
|
// xử lý cho item drag over qua 1 item cùng container
|
|
@@ -439,7 +459,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
439
459
|
this.setAnimationElementDragOver(indexDrag, indexDragOver, elementDragOver);
|
|
440
460
|
storeIndex.indexDrag = indexDrag;
|
|
441
461
|
storeIndex.indexDragOver = indexDragOver;
|
|
442
|
-
this.items.update(items => {
|
|
462
|
+
this.items.update((items) => {
|
|
443
463
|
items.splice(indexDrag, 1);
|
|
444
464
|
items.splice(indexDragOver, 0, itemDrag);
|
|
445
465
|
return [...items];
|
|
@@ -453,10 +473,10 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
453
473
|
storeIndex.indexDrag = -1;
|
|
454
474
|
storeIndex.indexDragOver = -1;
|
|
455
475
|
const childrenElement = elementContainer.getElementsByClassName(this.dragDropService.ClassItemDefine);
|
|
456
|
-
if (!checkMouseOverInContainer(eventDrag.mousePosition,
|
|
476
|
+
if (!checkMouseOverInContainer(eventDrag.mousePosition, this.rootElementScroll() || elementContainer)) {
|
|
457
477
|
const childElementIndex = Array.from(childrenElement).findIndex((child) => child.classList.contains('libs-ui-drag-drop-item-drop-placeholder'));
|
|
458
478
|
if (childElementIndex >= 0 && this.groupID() !== eventDrag.elementDrag.getAttribute('groupID')) {
|
|
459
|
-
this.items.update(items => {
|
|
479
|
+
this.items.update((items) => {
|
|
460
480
|
items.splice(childElementIndex, 1);
|
|
461
481
|
return [...items];
|
|
462
482
|
});
|
|
@@ -467,7 +487,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
467
487
|
return;
|
|
468
488
|
}
|
|
469
489
|
if (indexSpliceListTo >= 0) {
|
|
470
|
-
this.items.update(items => {
|
|
490
|
+
this.items.update((items) => {
|
|
471
491
|
items.splice(indexSpliceListTo, 1);
|
|
472
492
|
return [...items];
|
|
473
493
|
});
|
|
@@ -479,14 +499,14 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
479
499
|
const { elementDrag } = eventDragging;
|
|
480
500
|
const fieldIdItem = elementDrag.getAttribute('field_id');
|
|
481
501
|
const idItemDrag = elementDrag.getAttribute('item_id');
|
|
482
|
-
if (fieldIdItem && idItemDrag && this.items().find(item => get(item, fieldIdItem) === idItemDrag)) {
|
|
502
|
+
if (fieldIdItem && idItemDrag && this.items().find((item) => get(item, fieldIdItem) === idItemDrag)) {
|
|
483
503
|
const childrenElement = elementContainer.getElementsByClassName(this.dragDropService.ClassItemDefine);
|
|
484
504
|
const childElement = Array.from(childrenElement).find((child) => child.getAttribute('item_id') === idItemDrag);
|
|
485
505
|
if (this.items() === eventDragging.itemDragInfo?.itemsDrag() && childElement && !childElement.classList.contains('libs-ui-drag-drop-item-drop-placeholder') && !childElement.getAttribute(this.dragDropService.TargetItemDragFlag)) {
|
|
486
506
|
childElement.setAttribute(this.dragDropService.TargetItemDragFlag, 'true');
|
|
487
507
|
this.groupID.set(elementDrag.getAttribute('groupID') || '');
|
|
488
508
|
styleTag.remove();
|
|
489
|
-
styleTag.textContent = styleContainer(
|
|
509
|
+
styleTag.textContent = styleContainer(this.stylesOverride() || [], this.viewEncapsulation(), this.groupID());
|
|
490
510
|
elementContainer.appendChild(styleTag);
|
|
491
511
|
this.setAttributeElementAndItemDrag(elementContainer, true);
|
|
492
512
|
}
|
|
@@ -498,7 +518,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
498
518
|
this.checkAndScrollElementToPosition(eventDragging, this.ignoreAutoScroll() || !this.acceptDragSameGroup());
|
|
499
519
|
return;
|
|
500
520
|
}
|
|
501
|
-
if (!checkMouseOverInContainer(eventDragging.mousePosition,
|
|
521
|
+
if (!checkMouseOverInContainer(eventDragging.mousePosition, this.rootElementScroll() || elementContainer)) {
|
|
502
522
|
if (this.isDragOver()) {
|
|
503
523
|
this.isDragOver.set(false);
|
|
504
524
|
this.outDragLeaveContainer.emit({ ...eventDragging, elementDragLeave: elementContainer });
|
|
@@ -523,14 +543,15 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
523
543
|
return null;
|
|
524
544
|
}
|
|
525
545
|
return 0;
|
|
526
|
-
}
|
|
546
|
+
},
|
|
527
547
|
};
|
|
528
548
|
this.dragDropService.OnDragOver.next(eventDragOver);
|
|
529
549
|
return;
|
|
530
550
|
}
|
|
531
551
|
const childrenElement = elementContainer.getElementsByClassName(this.dragDropService.ClassItemDefine);
|
|
532
552
|
let childElement = Array.from(childrenElement).find((child) => checkMouseOverInContainer(eventDragging.mousePosition, child));
|
|
533
|
-
if (childElement) {
|
|
553
|
+
if (childElement) {
|
|
554
|
+
// nếu tìm thấy thì sẽ nhận qua sự kiện của drag-item.directive emit
|
|
534
555
|
return;
|
|
535
556
|
}
|
|
536
557
|
childElement = Array.from(childrenElement).pop();
|
|
@@ -578,7 +599,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
578
599
|
return null;
|
|
579
600
|
}
|
|
580
601
|
return childrenElement.length;
|
|
581
|
-
}
|
|
602
|
+
},
|
|
582
603
|
};
|
|
583
604
|
this.dragDropService.OnDrop.next(eventDrop);
|
|
584
605
|
};
|
|
@@ -613,7 +634,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
613
634
|
if (!this.items().length) {
|
|
614
635
|
this.outDroppedContainerEmpty.emit(eventDrop);
|
|
615
636
|
}
|
|
616
|
-
this.items.update(items => {
|
|
637
|
+
this.items.update((items) => {
|
|
617
638
|
items.splice(indexDragOver, 0, item);
|
|
618
639
|
return [...items];
|
|
619
640
|
});
|
|
@@ -625,28 +646,38 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
625
646
|
this.removeAttributes(elementContainer);
|
|
626
647
|
this.setIndexElement(elementContainer);
|
|
627
648
|
};
|
|
628
|
-
[
|
|
649
|
+
[
|
|
650
|
+
{
|
|
629
651
|
name: 'OnDragStart',
|
|
630
652
|
event: this.dragDropService.OnDragStart,
|
|
631
|
-
functionCall: handlerDragStart
|
|
632
|
-
},
|
|
653
|
+
functionCall: handlerDragStart,
|
|
654
|
+
},
|
|
655
|
+
{
|
|
633
656
|
name: 'OnDragOver',
|
|
634
657
|
event: this.dragDropService.OnDragOver,
|
|
635
658
|
functionCall: handlerDragOver,
|
|
636
|
-
},
|
|
659
|
+
},
|
|
660
|
+
{
|
|
637
661
|
name: 'OnDragging',
|
|
638
662
|
event: this.dragDropService.OnDragging,
|
|
639
|
-
functionCall: handlerDragging
|
|
640
|
-
},
|
|
663
|
+
functionCall: handlerDragging,
|
|
664
|
+
},
|
|
665
|
+
{
|
|
641
666
|
name: 'OnDragEnd',
|
|
642
667
|
event: this.dragDropService.OnDragEnd,
|
|
643
|
-
functionCall: handlerDragEnd
|
|
644
|
-
},
|
|
668
|
+
functionCall: handlerDragEnd,
|
|
669
|
+
},
|
|
670
|
+
{
|
|
645
671
|
name: 'OnDrop',
|
|
646
672
|
event: this.dragDropService.OnDrop,
|
|
647
|
-
functionCall: handlerDrop
|
|
648
|
-
}
|
|
649
|
-
].forEach((item) =>
|
|
673
|
+
functionCall: handlerDrop,
|
|
674
|
+
},
|
|
675
|
+
].forEach((item) => item.event.pipe(takeUntil(this.onDestroy)).subscribe(item.functionCall));
|
|
676
|
+
}
|
|
677
|
+
get FunctionsControl() {
|
|
678
|
+
return {
|
|
679
|
+
setAttributeElementAndItemDrag: () => this.setAttributeElementAndItemDrag(this.elementRef.nativeElement),
|
|
680
|
+
};
|
|
650
681
|
}
|
|
651
682
|
/* */
|
|
652
683
|
async setAttributeElementAndItemDrag(elementContainer, setItemDrag, indexInsert) {
|
|
@@ -701,7 +732,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
701
732
|
}
|
|
702
733
|
this.dragDropService.ItemDragInfo = { item: this.items()[index], indexDrag: index, itemsDrag: this.items, containerDrag: elementContainer, itemsMove: signal([...this.items()]) };
|
|
703
734
|
if (this.mode() === 'move') {
|
|
704
|
-
this.dragDropService.ItemDragInfo.itemsMove?.update(items => {
|
|
735
|
+
this.dragDropService.ItemDragInfo.itemsMove?.update((items) => {
|
|
705
736
|
items.splice(index, 1);
|
|
706
737
|
return [...items];
|
|
707
738
|
});
|
|
@@ -716,7 +747,6 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
716
747
|
}
|
|
717
748
|
this.setIndexElement(elementContainer);
|
|
718
749
|
}
|
|
719
|
-
;
|
|
720
750
|
setAnimationElementDragOver(indexDrag, indexDragOver, elementDragOver) {
|
|
721
751
|
if (!this.directionDrag() || !elementDragOver) {
|
|
722
752
|
return;
|
|
@@ -782,7 +812,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
782
812
|
type: Directive,
|
|
783
813
|
args: [{
|
|
784
814
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
785
|
-
selector:
|
|
815
|
+
selector: '[LibsUiComponentsDragContainerDirective]',
|
|
786
816
|
standalone: true,
|
|
787
817
|
}]
|
|
788
818
|
}], ctorParameters: () => [] });
|
|
@@ -803,10 +833,10 @@ class LibsUiDragItemInContainerVirtualScrollDirective {
|
|
|
803
833
|
document.body.classList.add('!select-none');
|
|
804
834
|
document.body.classList.add('!cursor-move');
|
|
805
835
|
};
|
|
806
|
-
this.dragDropService.OnDragEnd.pipe(takeUntil(this.onDestroy)).subscribe(e => {
|
|
836
|
+
this.dragDropService.OnDragEnd.pipe(takeUntil(this.onDestroy)).subscribe((e) => {
|
|
807
837
|
this.outDragEndContainer.emit(e);
|
|
808
838
|
});
|
|
809
|
-
this.dragDropService.OnDragItemInContainerVirtualScroll.pipe(takeUntil(this.onDestroy)).subscribe(dragItemInContainerVirtualScrollEvent => {
|
|
839
|
+
this.dragDropService.OnDragItemInContainerVirtualScroll.pipe(takeUntil(this.onDestroy)).subscribe((dragItemInContainerVirtualScrollEvent) => {
|
|
810
840
|
addClass();
|
|
811
841
|
const stopEventMouse = (mouseEvent) => {
|
|
812
842
|
if (!dragItemInContainerVirtualScrollEvent.ignoreStopEvent) {
|
|
@@ -814,8 +844,7 @@ class LibsUiDragItemInContainerVirtualScrollDirective {
|
|
|
814
844
|
mouseEvent.stopPropagation();
|
|
815
845
|
}
|
|
816
846
|
};
|
|
817
|
-
const documentMouseUp = fromEvent(document, 'mouseup')
|
|
818
|
-
.pipe(tap((eventMouseUp) => {
|
|
847
|
+
const documentMouseUp = fromEvent(document, 'mouseup').pipe(tap((eventMouseUp) => {
|
|
819
848
|
this.updateMouseEventsWhenMoveOverIframe('auto');
|
|
820
849
|
stopEventMouse(eventMouseUp);
|
|
821
850
|
const mousePosition = { clientX: eventMouseUp.clientX, clientY: eventMouseUp.clientY };
|
|
@@ -830,7 +859,8 @@ class LibsUiDragItemInContainerVirtualScrollDirective {
|
|
|
830
859
|
dragItemInContainerVirtualScrollEvent.elementDrag.remove();
|
|
831
860
|
removeClass();
|
|
832
861
|
}));
|
|
833
|
-
fromEvent(document, 'mousemove')
|
|
862
|
+
fromEvent(document, 'mousemove')
|
|
863
|
+
.pipe(tap((eventMousemove) => {
|
|
834
864
|
stopEventMouse(eventMousemove);
|
|
835
865
|
const { clientX, clientY } = eventMousemove;
|
|
836
866
|
const mousePosition = { clientX, clientY };
|
|
@@ -855,7 +885,8 @@ class LibsUiDragItemInContainerVirtualScrollDirective {
|
|
|
855
885
|
dragItemInContainerVirtualScrollEvent.elementDrag.style.left = `${left}px`;
|
|
856
886
|
dragItemInContainerVirtualScrollEvent.elementDrag.style.top = `${top}px`;
|
|
857
887
|
this.dragDropService.OnDragging.next({ mousePosition, elementDrag: dragItemInContainerVirtualScrollEvent.elementDrag, elementKeepContainer, itemDragInfo: this.dragDropService.ItemDragInfo });
|
|
858
|
-
}), takeUntil(
|
|
888
|
+
}), takeUntil(documentMouseUp), takeUntil(this.onDestroy))
|
|
889
|
+
.subscribe();
|
|
859
890
|
});
|
|
860
891
|
}
|
|
861
892
|
/* FUNCTIONS */
|
|
@@ -873,25 +904,25 @@ class LibsUiDragItemInContainerVirtualScrollDirective {
|
|
|
873
904
|
viewport.width = viewport.left + viewport.width;
|
|
874
905
|
}
|
|
875
906
|
let elementKeepContainer = false;
|
|
876
|
-
if (clientX > viewport.width && clientY > viewport.height || clientX < viewport.left && clientY < viewport.top) {
|
|
907
|
+
if ((clientX > viewport.width && clientY > viewport.height) || (clientX < viewport.left && clientY < viewport.top)) {
|
|
877
908
|
elementKeepContainer = true;
|
|
878
909
|
}
|
|
879
|
-
if (
|
|
880
|
-
clientX -=
|
|
910
|
+
if (clientX + (rectElement.width - distanceStartElementAndMouseLeft) > viewport.width) {
|
|
911
|
+
clientX -= clientX + (rectElement.width - distanceStartElementAndMouseLeft) - viewport.width;
|
|
881
912
|
}
|
|
882
|
-
if (
|
|
883
|
-
clientY -=
|
|
913
|
+
if (clientY + (rectElement.height - distanceStartElementAndMouseTop) > viewport.height) {
|
|
914
|
+
clientY -= clientY + (rectElement.height - distanceStartElementAndMouseTop) - viewport.height;
|
|
884
915
|
}
|
|
885
|
-
if (
|
|
916
|
+
if (clientX - distanceStartElementAndMouseLeft < (dragBoundary && containerItem ? viewport.left : 0)) {
|
|
886
917
|
clientX = (dragBoundary && containerItem ? viewport.left : 0) + distanceStartElementAndMouseLeft;
|
|
887
918
|
}
|
|
888
|
-
if (
|
|
919
|
+
if (clientY - distanceStartElementAndMouseTop < (dragBoundary && containerItem ? viewport.top : 0)) {
|
|
889
920
|
clientY = (dragBoundary && containerItem ? viewport.top : 0) + distanceStartElementAndMouseTop;
|
|
890
921
|
}
|
|
891
922
|
return { clientX, clientY, elementKeepContainer, viewport };
|
|
892
923
|
}
|
|
893
924
|
updateMouseEventsWhenMoveOverIframe(pointerEvents) {
|
|
894
|
-
const frames = document.getElementsByTagName(
|
|
925
|
+
const frames = document.getElementsByTagName('iframe');
|
|
895
926
|
if (!frames?.length) {
|
|
896
927
|
return;
|
|
897
928
|
}
|
|
@@ -910,7 +941,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
910
941
|
type: Directive,
|
|
911
942
|
args: [{
|
|
912
943
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
913
|
-
selector:
|
|
944
|
+
selector: '[LibsUiDragItemInContainerVirtualScrollDirective]',
|
|
914
945
|
standalone: true,
|
|
915
946
|
}]
|
|
916
947
|
}] });
|
|
@@ -921,19 +952,19 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
921
952
|
isDragOver = signal(false);
|
|
922
953
|
isDragging = signal(false);
|
|
923
954
|
// #region INPUT
|
|
924
|
-
//setup 3 field phía dưới nếu đang sử dụng item trong virtual-scroll
|
|
955
|
+
//setup 3 field phía dưới nếu đang sử dụng item trong virtual-scroll
|
|
925
956
|
fieldId = input('');
|
|
926
957
|
item = input(undefined);
|
|
927
958
|
itemInContainerVirtualScroll = input();
|
|
928
959
|
//----------------------------------
|
|
929
|
-
throttleTimeHandlerDraggingEvent = input(0, { transform: value => value || 0 });
|
|
960
|
+
throttleTimeHandlerDraggingEvent = input(0, { transform: (value) => value || 0 });
|
|
930
961
|
ignoreStopEvent = input();
|
|
931
962
|
onlyMouseDownStopEvent = input();
|
|
932
963
|
dragRootElement = input();
|
|
933
964
|
dragBoundary = input();
|
|
934
965
|
dragBoundaryAcceptMouseLeaveContainer = input();
|
|
935
966
|
elementContainer = input();
|
|
936
|
-
zIndex = input(1300, { transform: value => value ?? 1300 });
|
|
967
|
+
zIndex = input(1300, { transform: (value) => value ?? 1300 });
|
|
937
968
|
disable = input();
|
|
938
969
|
// #region OUTPUT
|
|
939
970
|
outDragStart = output();
|
|
@@ -971,7 +1002,8 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
971
1002
|
}
|
|
972
1003
|
const containerById = this.dragDropService.Container().get(element.getAttribute('groupID') || '');
|
|
973
1004
|
if (containerById) {
|
|
974
|
-
if (eventDragging.elementKeepContainer ||
|
|
1005
|
+
if (eventDragging.elementKeepContainer ||
|
|
1006
|
+
!this.dragDropService.checkElementOverAcceptElementDrag(containerById.element.getAttribute('groupName'), eventDragging.elementDrag.getAttribute('groupName'), eventDragging.elementDrag.getAttribute('dropToGroupName'))) {
|
|
975
1007
|
return;
|
|
976
1008
|
}
|
|
977
1009
|
}
|
|
@@ -999,7 +1031,7 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
999
1031
|
const dropEvent = { elementDrag: eventDrop.elementDrag, elementDrop: element, itemDragInfo: eventDrop.itemDragInfo };
|
|
1000
1032
|
this.outDropped.emit(dropEvent);
|
|
1001
1033
|
});
|
|
1002
|
-
const styleTag = document.createElement(
|
|
1034
|
+
const styleTag = document.createElement('style');
|
|
1003
1035
|
styleTag.textContent = `.libs-ui-drag-drop-item-dragging{cursor:move}`;
|
|
1004
1036
|
let nodeClone = element;
|
|
1005
1037
|
let distanceStartElementAndMouseLeft = -1;
|
|
@@ -1017,21 +1049,23 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
1017
1049
|
const containerItem = this.elementContainer() || containerById?.elementScroll || containerById?.element || document.body;
|
|
1018
1050
|
const rectContainer = containerItem.getBoundingClientRect();
|
|
1019
1051
|
const rectNodeClone = nodeClone.getBoundingClientRect();
|
|
1020
|
-
const numberSub = Number((getComputedStyle(containerItem).border.match(/\d+px/gi) || ['0'])[0].replace(/\D+/
|
|
1021
|
-
element.style.left =
|
|
1022
|
-
element.style.top =
|
|
1052
|
+
const numberSub = Number((getComputedStyle(containerItem).border.match(/\d+px/gi) || ['0'])[0].replace(/\D+/gi, '')).valueOf();
|
|
1053
|
+
element.style.left = rectNodeClone.left - rectContainer.left - numberSub + 'px';
|
|
1054
|
+
element.style.top = rectNodeClone.top - rectContainer.top - numberSub + 'px';
|
|
1023
1055
|
element.classList.remove('opacity-0');
|
|
1024
1056
|
}
|
|
1025
1057
|
distanceStartElementAndMouseLeft = -1;
|
|
1026
1058
|
distanceStartElementAndMouseTop = -1;
|
|
1027
1059
|
nodeClone.remove();
|
|
1028
1060
|
};
|
|
1029
|
-
fromEvent(document, 'contextmenu')
|
|
1061
|
+
fromEvent(document, 'contextmenu')
|
|
1062
|
+
.pipe(tap(() => {
|
|
1030
1063
|
if (this.isDragging()) {
|
|
1031
1064
|
updatePositionElementRootAndRemoveNodeClone();
|
|
1032
1065
|
}
|
|
1033
1066
|
contextMenu = true;
|
|
1034
|
-
}), takeUntil(this.onDestroy))
|
|
1067
|
+
}), takeUntil(this.onDestroy))
|
|
1068
|
+
.subscribe();
|
|
1035
1069
|
let ignoreMousedown = false;
|
|
1036
1070
|
getDragEventByElement({
|
|
1037
1071
|
elementMouseDown: element,
|
|
@@ -1075,8 +1109,9 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
1075
1109
|
styleTag.remove();
|
|
1076
1110
|
updatePositionElementRootAndRemoveNodeClone();
|
|
1077
1111
|
},
|
|
1078
|
-
onDestroy: this.onDestroy
|
|
1079
|
-
})
|
|
1112
|
+
onDestroy: this.onDestroy,
|
|
1113
|
+
})
|
|
1114
|
+
.pipe(tap((dragMouseEvent) => {
|
|
1080
1115
|
const rectElement = element.getBoundingClientRect();
|
|
1081
1116
|
const viewport = getViewport();
|
|
1082
1117
|
if (this.disable() || element.getAttribute('disableDragContainer') || !dragMouseEvent.clientX || (!ignoreMousedown && dragMouseEvent.type === 'mousedown' && rectElement.height + rectElement.top >= viewport.height)) {
|
|
@@ -1089,8 +1124,9 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
1089
1124
|
if (distanceStartElementAndMouseTop === -1) {
|
|
1090
1125
|
distanceStartElementAndMouseTop = clientY - rectElement.top;
|
|
1091
1126
|
}
|
|
1092
|
-
}))
|
|
1093
|
-
|
|
1127
|
+
}))
|
|
1128
|
+
.subscribe((dragMouseEvent) => {
|
|
1129
|
+
if (this.dragDropService.ItemClick.filter((item) => item !== element).some((item) => element.contains(item))) {
|
|
1094
1130
|
return;
|
|
1095
1131
|
}
|
|
1096
1132
|
if (this.disable() || element.getAttribute('disableDragContainer') || !dragMouseEvent.clientX || dragMouseEvent.type === 'mousedown' || contextMenu || (this.itemInContainerVirtualScroll() && this.isDragging())) {
|
|
@@ -1131,7 +1167,7 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
1131
1167
|
elementContainer: this.elementContainer(),
|
|
1132
1168
|
dragBoundary: this.dragBoundary(),
|
|
1133
1169
|
dragBoundaryAcceptMouseLeaveContainer: this.dragBoundaryAcceptMouseLeaveContainer(),
|
|
1134
|
-
ignoreStopEvent: this.ignoreStopEvent()
|
|
1170
|
+
ignoreStopEvent: this.ignoreStopEvent(),
|
|
1135
1171
|
});
|
|
1136
1172
|
return;
|
|
1137
1173
|
}
|
|
@@ -1167,20 +1203,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1167
1203
|
type: Directive,
|
|
1168
1204
|
args: [{
|
|
1169
1205
|
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1170
|
-
selector:
|
|
1171
|
-
standalone: true
|
|
1206
|
+
selector: '[LibsUiDragItemDirective]',
|
|
1207
|
+
standalone: true,
|
|
1172
1208
|
}]
|
|
1173
1209
|
}], ctorParameters: () => [] });
|
|
1174
1210
|
|
|
1175
1211
|
class LibsUiDragDropDemoComponent {
|
|
1176
1212
|
// Basic List Items
|
|
1177
|
-
basicItems = [
|
|
1178
|
-
'Task 1',
|
|
1179
|
-
'Task 2',
|
|
1180
|
-
'Task 3',
|
|
1181
|
-
'Task 4',
|
|
1182
|
-
'Task 5'
|
|
1183
|
-
];
|
|
1213
|
+
basicItems = ['Task 1', 'Task 2', 'Task 3', 'Task 4', 'Task 5'];
|
|
1184
1214
|
// Kanban Board Columns
|
|
1185
1215
|
columnsIds = ['todo', 'in-progress', 'done'];
|
|
1186
1216
|
columns = [
|
|
@@ -1192,15 +1222,15 @@ class LibsUiDragDropDemoComponent {
|
|
|
1192
1222
|
id: 1,
|
|
1193
1223
|
title: 'Implement drag and drop',
|
|
1194
1224
|
description: 'Add drag and drop functionality to the component',
|
|
1195
|
-
status: 'todo'
|
|
1225
|
+
status: 'todo',
|
|
1196
1226
|
},
|
|
1197
1227
|
{
|
|
1198
1228
|
id: 2,
|
|
1199
1229
|
title: 'Add animations',
|
|
1200
1230
|
description: 'Implement smooth animations for drag and drop',
|
|
1201
|
-
status: 'todo'
|
|
1202
|
-
}
|
|
1203
|
-
]
|
|
1231
|
+
status: 'todo',
|
|
1232
|
+
},
|
|
1233
|
+
],
|
|
1204
1234
|
},
|
|
1205
1235
|
{
|
|
1206
1236
|
id: 'in-progress',
|
|
@@ -1210,9 +1240,9 @@ class LibsUiDragDropDemoComponent {
|
|
|
1210
1240
|
id: 3,
|
|
1211
1241
|
title: 'Fix styling issues',
|
|
1212
1242
|
description: 'Resolve CSS conflicts in the component',
|
|
1213
|
-
status: 'in-progress'
|
|
1214
|
-
}
|
|
1215
|
-
]
|
|
1243
|
+
status: 'in-progress',
|
|
1244
|
+
},
|
|
1245
|
+
],
|
|
1216
1246
|
},
|
|
1217
1247
|
{
|
|
1218
1248
|
id: 'done',
|
|
@@ -1222,28 +1252,28 @@ class LibsUiDragDropDemoComponent {
|
|
|
1222
1252
|
id: 4,
|
|
1223
1253
|
title: 'Setup project structure',
|
|
1224
1254
|
description: 'Initialize the project with necessary configurations',
|
|
1225
|
-
status: 'done'
|
|
1226
|
-
}
|
|
1227
|
-
]
|
|
1228
|
-
}
|
|
1255
|
+
status: 'done',
|
|
1256
|
+
},
|
|
1257
|
+
],
|
|
1258
|
+
},
|
|
1229
1259
|
];
|
|
1230
1260
|
// Nested Items
|
|
1231
1261
|
nestedItems = [
|
|
1232
1262
|
{
|
|
1233
1263
|
id: 1,
|
|
1234
1264
|
title: 'Project A',
|
|
1235
|
-
subItems: ['Task 1', 'Task 2', 'Task 3']
|
|
1265
|
+
subItems: ['Task 1', 'Task 2', 'Task 3'],
|
|
1236
1266
|
},
|
|
1237
1267
|
{
|
|
1238
1268
|
id: 2,
|
|
1239
1269
|
title: 'Project B',
|
|
1240
|
-
subItems: ['Task 4', 'Task 5']
|
|
1270
|
+
subItems: ['Task 4', 'Task 5'],
|
|
1241
1271
|
},
|
|
1242
1272
|
{
|
|
1243
1273
|
id: 3,
|
|
1244
1274
|
title: 'Project C',
|
|
1245
|
-
subItems: ['Task 6', 'Task 7', 'Task 8']
|
|
1246
|
-
}
|
|
1275
|
+
subItems: ['Task 6', 'Task 7', 'Task 8'],
|
|
1276
|
+
},
|
|
1247
1277
|
];
|
|
1248
1278
|
// API Documentation
|
|
1249
1279
|
inputsDoc = [
|
|
@@ -1251,99 +1281,99 @@ class LibsUiDragDropDemoComponent {
|
|
|
1251
1281
|
name: 'items',
|
|
1252
1282
|
type: 'Array<unknown>',
|
|
1253
1283
|
default: '[]',
|
|
1254
|
-
description: 'Array of items to be displayed in the container'
|
|
1284
|
+
description: 'Array of items to be displayed in the container',
|
|
1255
1285
|
},
|
|
1256
1286
|
{
|
|
1257
1287
|
name: 'mode',
|
|
1258
1288
|
type: "'move' | 'copy' | 'deepCopy'",
|
|
1259
1289
|
default: "'move'",
|
|
1260
|
-
description: 'Mode for drag and drop operations'
|
|
1290
|
+
description: 'Mode for drag and drop operations',
|
|
1261
1291
|
},
|
|
1262
1292
|
{
|
|
1263
1293
|
name: 'directionDrag',
|
|
1264
1294
|
type: "'horizontal' | 'vertical'",
|
|
1265
1295
|
default: 'undefined',
|
|
1266
|
-
description: 'Direction of drag movement'
|
|
1296
|
+
description: 'Direction of drag movement',
|
|
1267
1297
|
},
|
|
1268
1298
|
{
|
|
1269
1299
|
name: 'viewEncapsulation',
|
|
1270
1300
|
type: "'emulated' | 'none'",
|
|
1271
1301
|
default: "'emulated'",
|
|
1272
|
-
description: 'View encapsulation mode for styling'
|
|
1302
|
+
description: 'View encapsulation mode for styling',
|
|
1273
1303
|
},
|
|
1274
1304
|
{
|
|
1275
1305
|
name: 'disableDragContainer',
|
|
1276
1306
|
type: 'boolean',
|
|
1277
1307
|
default: 'undefined',
|
|
1278
|
-
description: 'Whether to disable drag operations for the container'
|
|
1308
|
+
description: 'Whether to disable drag operations for the container',
|
|
1279
1309
|
},
|
|
1280
1310
|
{
|
|
1281
1311
|
name: 'acceptDragSameGroup',
|
|
1282
1312
|
type: 'boolean',
|
|
1283
1313
|
default: 'false',
|
|
1284
|
-
description: 'Whether to accept drag operations within the same group'
|
|
1314
|
+
description: 'Whether to accept drag operations within the same group',
|
|
1285
1315
|
},
|
|
1286
1316
|
{
|
|
1287
1317
|
name: 'placeholder',
|
|
1288
1318
|
type: 'boolean',
|
|
1289
1319
|
default: 'true',
|
|
1290
|
-
description: 'Whether to show placeholder during drag'
|
|
1320
|
+
description: 'Whether to show placeholder during drag',
|
|
1291
1321
|
},
|
|
1292
1322
|
{
|
|
1293
1323
|
name: 'groupName',
|
|
1294
1324
|
type: 'string',
|
|
1295
1325
|
default: "'groupDragAndDropDefault'",
|
|
1296
|
-
description: 'Name of the group for drag and drop operations'
|
|
1326
|
+
description: 'Name of the group for drag and drop operations',
|
|
1297
1327
|
},
|
|
1298
1328
|
{
|
|
1299
1329
|
name: 'dropToGroupName',
|
|
1300
1330
|
type: 'Array<string> | null',
|
|
1301
1331
|
default: 'null',
|
|
1302
|
-
description: 'List of group names that can accept drops from this container'
|
|
1332
|
+
description: 'List of group names that can accept drops from this container',
|
|
1303
1333
|
},
|
|
1304
1334
|
{
|
|
1305
1335
|
name: 'stylesOverride',
|
|
1306
1336
|
type: 'Array<{ className: string, styles: string }>',
|
|
1307
1337
|
default: 'undefined',
|
|
1308
|
-
description: 'Custom styles to override default drag-drop styling'
|
|
1309
|
-
}
|
|
1338
|
+
description: 'Custom styles to override default drag-drop styling',
|
|
1339
|
+
},
|
|
1310
1340
|
];
|
|
1311
1341
|
outputsDoc = [
|
|
1312
1342
|
{
|
|
1313
1343
|
name: 'outDragStartContainer',
|
|
1314
1344
|
type: 'IDragStart',
|
|
1315
|
-
description: 'Event emitted when dragging starts in the container'
|
|
1345
|
+
description: 'Event emitted when dragging starts in the container',
|
|
1316
1346
|
},
|
|
1317
1347
|
{
|
|
1318
1348
|
name: 'outDragOverContainer',
|
|
1319
1349
|
type: 'IDragOver',
|
|
1320
|
-
description: 'Event emitted when dragging over the container'
|
|
1350
|
+
description: 'Event emitted when dragging over the container',
|
|
1321
1351
|
},
|
|
1322
1352
|
{
|
|
1323
1353
|
name: 'outDragLeaveContainer',
|
|
1324
1354
|
type: 'IDragLeave',
|
|
1325
|
-
description: 'Event emitted when dragging leaves the container'
|
|
1355
|
+
description: 'Event emitted when dragging leaves the container',
|
|
1326
1356
|
},
|
|
1327
1357
|
{
|
|
1328
1358
|
name: 'outDragEndContainer',
|
|
1329
1359
|
type: 'IDragEnd',
|
|
1330
|
-
description: 'Event emitted when dragging ends in the container'
|
|
1360
|
+
description: 'Event emitted when dragging ends in the container',
|
|
1331
1361
|
},
|
|
1332
1362
|
{
|
|
1333
1363
|
name: 'outDroppedContainer',
|
|
1334
1364
|
type: 'IDrop',
|
|
1335
|
-
description: 'Event emitted when an item is dropped in the container'
|
|
1365
|
+
description: 'Event emitted when an item is dropped in the container',
|
|
1336
1366
|
},
|
|
1337
1367
|
{
|
|
1338
1368
|
name: 'outDroppedContainerEmpty',
|
|
1339
1369
|
type: 'IDrop',
|
|
1340
|
-
description: 'Event emitted when an item is dropped in an empty container'
|
|
1370
|
+
description: 'Event emitted when an item is dropped in an empty container',
|
|
1341
1371
|
},
|
|
1342
1372
|
{
|
|
1343
1373
|
name: 'outFunctionControl',
|
|
1344
1374
|
type: 'IDragDropFunctionControlEvent',
|
|
1345
|
-
description: 'Event emitted to control drag-drop functionality'
|
|
1346
|
-
}
|
|
1375
|
+
description: 'Event emitted to control drag-drop functionality',
|
|
1376
|
+
},
|
|
1347
1377
|
];
|
|
1348
1378
|
// Interface Documentation
|
|
1349
1379
|
interfacesDoc = [
|
|
@@ -1355,7 +1385,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1355
1385
|
elementKeepContainer?: boolean;
|
|
1356
1386
|
itemDragInfo?: IItemDragInfo;
|
|
1357
1387
|
}`,
|
|
1358
|
-
description: 'Interface for drag operation events, containing information about the dragged element and mouse position'
|
|
1388
|
+
description: 'Interface for drag operation events, containing information about the dragged element and mouse position',
|
|
1359
1389
|
},
|
|
1360
1390
|
{
|
|
1361
1391
|
name: 'IDragStart',
|
|
@@ -1364,7 +1394,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1364
1394
|
elementDrag: HTMLElement;
|
|
1365
1395
|
itemDragInfo?: IItemDragInfo;
|
|
1366
1396
|
}`,
|
|
1367
|
-
description: 'Interface for drag start events, triggered when dragging begins'
|
|
1397
|
+
description: 'Interface for drag start events, triggered when dragging begins',
|
|
1368
1398
|
},
|
|
1369
1399
|
{
|
|
1370
1400
|
name: 'IDragOver',
|
|
@@ -1374,7 +1404,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1374
1404
|
elementDragOver: HTMLElement;
|
|
1375
1405
|
itemDragInfo?: IItemDragInfo;
|
|
1376
1406
|
}`,
|
|
1377
|
-
description: 'Interface for drag over events, triggered when an element is dragged over another element'
|
|
1407
|
+
description: 'Interface for drag over events, triggered when an element is dragged over another element',
|
|
1378
1408
|
},
|
|
1379
1409
|
{
|
|
1380
1410
|
name: 'IDragLeave',
|
|
@@ -1383,7 +1413,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1383
1413
|
elementDragLeave: HTMLElement;
|
|
1384
1414
|
itemDragInfo?: IItemDragInfo;
|
|
1385
1415
|
}`,
|
|
1386
|
-
description: 'Interface for drag leave events, triggered when a dragged element leaves another element'
|
|
1416
|
+
description: 'Interface for drag leave events, triggered when a dragged element leaves another element',
|
|
1387
1417
|
},
|
|
1388
1418
|
{
|
|
1389
1419
|
name: 'IDragEnd',
|
|
@@ -1392,7 +1422,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1392
1422
|
elementDrag: HTMLElement;
|
|
1393
1423
|
itemDragInfo?: IItemDragInfo;
|
|
1394
1424
|
}`,
|
|
1395
|
-
description: 'Interface for drag end events, triggered when dragging ends'
|
|
1425
|
+
description: 'Interface for drag end events, triggered when dragging ends',
|
|
1396
1426
|
},
|
|
1397
1427
|
{
|
|
1398
1428
|
name: 'IDrop',
|
|
@@ -1401,7 +1431,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1401
1431
|
elementDrop: HTMLElement;
|
|
1402
1432
|
itemDragInfo?: IItemDragInfo;
|
|
1403
1433
|
}`,
|
|
1404
|
-
description: 'Interface for drop events, triggered when an element is dropped'
|
|
1434
|
+
description: 'Interface for drop events, triggered when an element is dropped',
|
|
1405
1435
|
},
|
|
1406
1436
|
{
|
|
1407
1437
|
name: 'IItemDragInfo',
|
|
@@ -1415,7 +1445,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1415
1445
|
containerDrag?: HTMLElement;
|
|
1416
1446
|
containerDrop?: HTMLElement;
|
|
1417
1447
|
}`,
|
|
1418
|
-
description: 'Interface containing information about the dragged item and its containers'
|
|
1448
|
+
description: 'Interface containing information about the dragged item and its containers',
|
|
1419
1449
|
},
|
|
1420
1450
|
{
|
|
1421
1451
|
name: 'IDragItemInContainerVirtualScroll',
|
|
@@ -1429,7 +1459,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1429
1459
|
dragBoundaryAcceptMouseLeaveContainer?: boolean;
|
|
1430
1460
|
ignoreStopEvent?: boolean;
|
|
1431
1461
|
}`,
|
|
1432
|
-
description: 'Interface for virtual scrolling drag operations, containing information about drag boundaries and container elements'
|
|
1462
|
+
description: 'Interface for virtual scrolling drag operations, containing information about drag boundaries and container elements',
|
|
1433
1463
|
},
|
|
1434
1464
|
{
|
|
1435
1465
|
name: 'IMousePosition',
|
|
@@ -1437,15 +1467,15 @@ class LibsUiDragDropDemoComponent {
|
|
|
1437
1467
|
clientX: number;
|
|
1438
1468
|
clientY: number;
|
|
1439
1469
|
}`,
|
|
1440
|
-
description: 'Interface representing mouse position coordinates'
|
|
1470
|
+
description: 'Interface representing mouse position coordinates',
|
|
1441
1471
|
},
|
|
1442
1472
|
{
|
|
1443
1473
|
name: 'IDragDropFunctionControlEvent',
|
|
1444
1474
|
code: `interface IDragDropFunctionControlEvent {
|
|
1445
1475
|
setAttributeElementAndItemDrag: () => Promise<void>;
|
|
1446
1476
|
}`,
|
|
1447
|
-
description: 'Interface for drag and drop control functions'
|
|
1448
|
-
}
|
|
1477
|
+
description: 'Interface for drag and drop control functions',
|
|
1478
|
+
},
|
|
1449
1479
|
];
|
|
1450
1480
|
// Features
|
|
1451
1481
|
features = [
|
|
@@ -1453,26 +1483,26 @@ class LibsUiDragDropDemoComponent {
|
|
|
1453
1483
|
id: 1,
|
|
1454
1484
|
icon: '🔄',
|
|
1455
1485
|
title: 'Flexible Drag and Drop',
|
|
1456
|
-
description: 'Support for container-to-container dragging with customizable group names and drop zones'
|
|
1486
|
+
description: 'Support for container-to-container dragging with customizable group names and drop zones',
|
|
1457
1487
|
},
|
|
1458
1488
|
{
|
|
1459
1489
|
id: 2,
|
|
1460
1490
|
icon: '📜',
|
|
1461
1491
|
title: 'Virtual Scrolling',
|
|
1462
|
-
description: 'Efficient handling of large lists with virtual scrolling support'
|
|
1492
|
+
description: 'Efficient handling of large lists with virtual scrolling support',
|
|
1463
1493
|
},
|
|
1464
1494
|
{
|
|
1465
1495
|
id: 3,
|
|
1466
1496
|
icon: '🎯',
|
|
1467
1497
|
title: 'Custom Boundaries',
|
|
1468
|
-
description: 'Define custom drag boundaries and drop zones for precise control'
|
|
1498
|
+
description: 'Define custom drag boundaries and drop zones for precise control',
|
|
1469
1499
|
},
|
|
1470
1500
|
{
|
|
1471
1501
|
id: 4,
|
|
1472
1502
|
icon: '🎨',
|
|
1473
1503
|
title: 'Styling Options',
|
|
1474
|
-
description: 'Customizable styles for drag items and containers'
|
|
1475
|
-
}
|
|
1504
|
+
description: 'Customizable styles for drag items and containers',
|
|
1505
|
+
},
|
|
1476
1506
|
];
|
|
1477
1507
|
// Code Examples
|
|
1478
1508
|
codeExamples = [
|
|
@@ -1488,7 +1518,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1488
1518
|
{{ item }}
|
|
1489
1519
|
</div>
|
|
1490
1520
|
}
|
|
1491
|
-
</div>
|
|
1521
|
+
</div>`,
|
|
1492
1522
|
},
|
|
1493
1523
|
{
|
|
1494
1524
|
id: 2,
|
|
@@ -1512,8 +1542,8 @@ class LibsUiDragDropDemoComponent {
|
|
|
1512
1542
|
{{ item }}
|
|
1513
1543
|
</div>
|
|
1514
1544
|
}
|
|
1515
|
-
</div>
|
|
1516
|
-
}
|
|
1545
|
+
</div>`,
|
|
1546
|
+
},
|
|
1517
1547
|
];
|
|
1518
1548
|
/**
|
|
1519
1549
|
* Copy text to clipboard
|
|
@@ -1537,14 +1567,15 @@ class LibsUiDragDropDemoComponent {
|
|
|
1537
1567
|
<section class="intro-section">
|
|
1538
1568
|
<h2>Introduction</h2>
|
|
1539
1569
|
<p>
|
|
1540
|
-
<code>@libs-ui/components-drag-drop</code>
|
|
1570
|
+
<code>@libs-ui/components-drag-drop</code>
|
|
1571
|
+
is a powerful Angular component that enables drag and drop functionality with features like virtual scrolling, multi-selection, and custom boundaries.
|
|
1541
1572
|
</p>
|
|
1542
1573
|
</section>
|
|
1543
1574
|
|
|
1544
1575
|
<section class="installation-section">
|
|
1545
1576
|
<h2>Installation</h2>
|
|
1546
1577
|
<p>To install the library, use npm or yarn:</p>
|
|
1547
|
-
|
|
1578
|
+
|
|
1548
1579
|
<div class="install-command">
|
|
1549
1580
|
<pre>
|
|
1550
1581
|
<code>npm install @libs-ui/components-drag-drop</code>
|
|
@@ -1553,9 +1584,9 @@ class LibsUiDragDropDemoComponent {
|
|
|
1553
1584
|
(outClick)="copyToClipboard('npm install @libs-ui/components-drag-drop')" />
|
|
1554
1585
|
</pre>
|
|
1555
1586
|
</div>
|
|
1556
|
-
|
|
1587
|
+
|
|
1557
1588
|
<p>Or with yarn:</p>
|
|
1558
|
-
|
|
1589
|
+
|
|
1559
1590
|
<div class="install-command">
|
|
1560
1591
|
<pre>
|
|
1561
1592
|
<code>yarn add @libs-ui/components-drag-drop</code>
|
|
@@ -1573,12 +1604,14 @@ class LibsUiDragDropDemoComponent {
|
|
|
1573
1604
|
<div class="demo-example">
|
|
1574
1605
|
<h3>Basic List</h3>
|
|
1575
1606
|
<div class="list-container">
|
|
1576
|
-
<div
|
|
1577
|
-
|
|
1578
|
-
|
|
1607
|
+
<div
|
|
1608
|
+
LibsUiComponentsDragContainerDirective
|
|
1609
|
+
[(items)]="basicItems"
|
|
1610
|
+
[acceptDragSameGroup]="true">
|
|
1579
1611
|
@for (item of basicItems; track item) {
|
|
1580
|
-
<div
|
|
1581
|
-
|
|
1612
|
+
<div
|
|
1613
|
+
class="list-item"
|
|
1614
|
+
LibsUiDragItemDirective>
|
|
1582
1615
|
<span class="item-icon">📋</span>
|
|
1583
1616
|
<span class="item-text">{{ item }}</span>
|
|
1584
1617
|
</div>
|
|
@@ -1592,19 +1625,23 @@ class LibsUiDragDropDemoComponent {
|
|
|
1592
1625
|
<h3>Kanban Board</h3>
|
|
1593
1626
|
<div class="kanban-board">
|
|
1594
1627
|
@for (column of columns; track column) {
|
|
1595
|
-
<div
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1628
|
+
<div
|
|
1629
|
+
class="kanban-column"
|
|
1630
|
+
LibsUiComponentsDragContainerDirective
|
|
1631
|
+
[(items)]="column.items"
|
|
1632
|
+
[groupName]="column.id"
|
|
1633
|
+
[dropToGroupName]="columnsIds"
|
|
1634
|
+
[acceptDragSameGroup]="true">
|
|
1601
1635
|
<h4>{{ column.title }}</h4>
|
|
1602
1636
|
@for (item of column.items; track item) {
|
|
1603
|
-
<div
|
|
1604
|
-
|
|
1637
|
+
<div
|
|
1638
|
+
class="kanban-item"
|
|
1639
|
+
LibsUiDragItemDirective>
|
|
1605
1640
|
<div class="kanban-item-header">
|
|
1606
1641
|
<span class="item-title">{{ item.title }}</span>
|
|
1607
|
-
<span
|
|
1642
|
+
<span
|
|
1643
|
+
class="item-status"
|
|
1644
|
+
[class]="'status-' + item.status">
|
|
1608
1645
|
{{ item.status }}
|
|
1609
1646
|
</span>
|
|
1610
1647
|
</div>
|
|
@@ -1620,25 +1657,29 @@ class LibsUiDragDropDemoComponent {
|
|
|
1620
1657
|
<div class="demo-example">
|
|
1621
1658
|
<h3>Nested Containers copy</h3>
|
|
1622
1659
|
<div class="nested-container">
|
|
1623
|
-
<div
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1660
|
+
<div
|
|
1661
|
+
LibsUiComponentsDragContainerDirective
|
|
1662
|
+
[(items)]="nestedItems"
|
|
1663
|
+
[groupName]="'parent'"
|
|
1664
|
+
[mode]="'copy'"
|
|
1665
|
+
[acceptDragSameGroup]="true">
|
|
1628
1666
|
@for (item of nestedItems; track item) {
|
|
1629
|
-
<div
|
|
1630
|
-
|
|
1667
|
+
<div
|
|
1668
|
+
class="nested-item"
|
|
1669
|
+
LibsUiDragItemDirective>
|
|
1631
1670
|
<div class="nested-item-header">
|
|
1632
1671
|
<span class="item-title">{{ item.title }}</span>
|
|
1633
1672
|
</div>
|
|
1634
1673
|
<div class="nested-item-content">
|
|
1635
|
-
<div
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1674
|
+
<div
|
|
1675
|
+
LibsUiComponentsDragContainerDirective
|
|
1676
|
+
[(items)]="item.subItems"
|
|
1677
|
+
[groupName]="'child'"
|
|
1678
|
+
[acceptDragSameGroup]="true">
|
|
1639
1679
|
@for (subItem of item.subItems; track subItem) {
|
|
1640
|
-
<div
|
|
1641
|
-
|
|
1680
|
+
<div
|
|
1681
|
+
class="sub-item"
|
|
1682
|
+
LibsUiDragItemDirective>
|
|
1642
1683
|
{{ subItem }}
|
|
1643
1684
|
</div>
|
|
1644
1685
|
}
|
|
@@ -1654,7 +1695,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1654
1695
|
|
|
1655
1696
|
<section class="api-doc-section">
|
|
1656
1697
|
<h2>API Documentation</h2>
|
|
1657
|
-
|
|
1698
|
+
|
|
1658
1699
|
<h3>Inputs</h3>
|
|
1659
1700
|
<div class="table-container">
|
|
1660
1701
|
<table class="api-table">
|
|
@@ -1669,10 +1710,14 @@ class LibsUiDragDropDemoComponent {
|
|
|
1669
1710
|
<tbody>
|
|
1670
1711
|
@for (input of inputsDoc; track input.name) {
|
|
1671
1712
|
<tr>
|
|
1672
|
-
<td
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
<td>
|
|
1713
|
+
<td>
|
|
1714
|
+
<code>{{ input.name }}</code>
|
|
1715
|
+
</td>
|
|
1716
|
+
<td>
|
|
1717
|
+
<code>{{ input.type }}</code>
|
|
1718
|
+
</td>
|
|
1719
|
+
<td>{{ input.default }}</td>
|
|
1720
|
+
<td>{{ input.description }}</td>
|
|
1676
1721
|
</tr>
|
|
1677
1722
|
}
|
|
1678
1723
|
</tbody>
|
|
@@ -1692,9 +1737,13 @@ class LibsUiDragDropDemoComponent {
|
|
|
1692
1737
|
<tbody>
|
|
1693
1738
|
@for (output of outputsDoc; track output.name) {
|
|
1694
1739
|
<tr>
|
|
1695
|
-
<td
|
|
1696
|
-
|
|
1697
|
-
|
|
1740
|
+
<td>
|
|
1741
|
+
<code>{{ output.name }}</code>
|
|
1742
|
+
</td>
|
|
1743
|
+
<td>
|
|
1744
|
+
<code>{{ output.type }}</code>
|
|
1745
|
+
</td>
|
|
1746
|
+
<td>{{ output.description }}</td>
|
|
1698
1747
|
</tr>
|
|
1699
1748
|
}
|
|
1700
1749
|
</tbody>
|
|
@@ -1707,9 +1756,9 @@ class LibsUiDragDropDemoComponent {
|
|
|
1707
1756
|
<div class="interface-docs">
|
|
1708
1757
|
@for (interfaceItem of interfacesDoc; track interfaceItem.name) {
|
|
1709
1758
|
<div class="interface-item">
|
|
1710
|
-
<h3>{{interfaceItem.name}}</h3>
|
|
1759
|
+
<h3>{{ interfaceItem.name }}</h3>
|
|
1711
1760
|
<pre><code>{{interfaceItem.code}}</code></pre>
|
|
1712
|
-
<p>{{interfaceItem.description}}</p>
|
|
1761
|
+
<p>{{ interfaceItem.description }}</p>
|
|
1713
1762
|
</div>
|
|
1714
1763
|
}
|
|
1715
1764
|
</div>
|
|
@@ -1720,10 +1769,10 @@ class LibsUiDragDropDemoComponent {
|
|
|
1720
1769
|
<ul>
|
|
1721
1770
|
@for (feature of features; track feature.id) {
|
|
1722
1771
|
<li>
|
|
1723
|
-
<span class="feature-icon">{{feature.icon}}</span>
|
|
1772
|
+
<span class="feature-icon">{{ feature.icon }}</span>
|
|
1724
1773
|
<div class="feature-info">
|
|
1725
|
-
<h3>{{feature.title}}</h3>
|
|
1726
|
-
<p>{{feature.description}}</p>
|
|
1774
|
+
<h3>{{ feature.title }}</h3>
|
|
1775
|
+
<p>{{ feature.description }}</p>
|
|
1727
1776
|
</div>
|
|
1728
1777
|
</li>
|
|
1729
1778
|
}
|
|
@@ -1735,7 +1784,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1735
1784
|
<div class="code-examples">
|
|
1736
1785
|
@for (example of codeExamples; track example.id) {
|
|
1737
1786
|
<div class="code-example">
|
|
1738
|
-
<h3>{{example.title}}</h3>
|
|
1787
|
+
<h3>{{ example.title }}</h3>
|
|
1739
1788
|
<pre><code [innerHTML]="example.code"></code></pre>
|
|
1740
1789
|
</div>
|
|
1741
1790
|
}
|
|
@@ -1747,12 +1796,7 @@ class LibsUiDragDropDemoComponent {
|
|
|
1747
1796
|
}
|
|
1748
1797
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiDragDropDemoComponent, decorators: [{
|
|
1749
1798
|
type: Component,
|
|
1750
|
-
args: [{ selector: 'lib-drag-drop-demo', standalone: true, imports: [
|
|
1751
|
-
CommonModule,
|
|
1752
|
-
LibsUiComponentsDragContainerDirective,
|
|
1753
|
-
LibsUiDragItemDirective,
|
|
1754
|
-
LibsUiComponentsButtonsButtonComponent
|
|
1755
|
-
], template: `
|
|
1799
|
+
args: [{ selector: 'lib-drag-drop-demo', standalone: true, imports: [CommonModule, LibsUiComponentsDragContainerDirective, LibsUiDragItemDirective, LibsUiComponentsButtonsButtonComponent], template: `
|
|
1756
1800
|
<div class="page-container">
|
|
1757
1801
|
<header>
|
|
1758
1802
|
<h1>Demo Drag and Drop Component</h1>
|
|
@@ -1763,14 +1807,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1763
1807
|
<section class="intro-section">
|
|
1764
1808
|
<h2>Introduction</h2>
|
|
1765
1809
|
<p>
|
|
1766
|
-
<code>@libs-ui/components-drag-drop</code>
|
|
1810
|
+
<code>@libs-ui/components-drag-drop</code>
|
|
1811
|
+
is a powerful Angular component that enables drag and drop functionality with features like virtual scrolling, multi-selection, and custom boundaries.
|
|
1767
1812
|
</p>
|
|
1768
1813
|
</section>
|
|
1769
1814
|
|
|
1770
1815
|
<section class="installation-section">
|
|
1771
1816
|
<h2>Installation</h2>
|
|
1772
1817
|
<p>To install the library, use npm or yarn:</p>
|
|
1773
|
-
|
|
1818
|
+
|
|
1774
1819
|
<div class="install-command">
|
|
1775
1820
|
<pre>
|
|
1776
1821
|
<code>npm install @libs-ui/components-drag-drop</code>
|
|
@@ -1779,9 +1824,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1779
1824
|
(outClick)="copyToClipboard('npm install @libs-ui/components-drag-drop')" />
|
|
1780
1825
|
</pre>
|
|
1781
1826
|
</div>
|
|
1782
|
-
|
|
1827
|
+
|
|
1783
1828
|
<p>Or with yarn:</p>
|
|
1784
|
-
|
|
1829
|
+
|
|
1785
1830
|
<div class="install-command">
|
|
1786
1831
|
<pre>
|
|
1787
1832
|
<code>yarn add @libs-ui/components-drag-drop</code>
|
|
@@ -1799,12 +1844,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1799
1844
|
<div class="demo-example">
|
|
1800
1845
|
<h3>Basic List</h3>
|
|
1801
1846
|
<div class="list-container">
|
|
1802
|
-
<div
|
|
1803
|
-
|
|
1804
|
-
|
|
1847
|
+
<div
|
|
1848
|
+
LibsUiComponentsDragContainerDirective
|
|
1849
|
+
[(items)]="basicItems"
|
|
1850
|
+
[acceptDragSameGroup]="true">
|
|
1805
1851
|
@for (item of basicItems; track item) {
|
|
1806
|
-
<div
|
|
1807
|
-
|
|
1852
|
+
<div
|
|
1853
|
+
class="list-item"
|
|
1854
|
+
LibsUiDragItemDirective>
|
|
1808
1855
|
<span class="item-icon">📋</span>
|
|
1809
1856
|
<span class="item-text">{{ item }}</span>
|
|
1810
1857
|
</div>
|
|
@@ -1818,19 +1865,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1818
1865
|
<h3>Kanban Board</h3>
|
|
1819
1866
|
<div class="kanban-board">
|
|
1820
1867
|
@for (column of columns; track column) {
|
|
1821
|
-
<div
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1868
|
+
<div
|
|
1869
|
+
class="kanban-column"
|
|
1870
|
+
LibsUiComponentsDragContainerDirective
|
|
1871
|
+
[(items)]="column.items"
|
|
1872
|
+
[groupName]="column.id"
|
|
1873
|
+
[dropToGroupName]="columnsIds"
|
|
1874
|
+
[acceptDragSameGroup]="true">
|
|
1827
1875
|
<h4>{{ column.title }}</h4>
|
|
1828
1876
|
@for (item of column.items; track item) {
|
|
1829
|
-
<div
|
|
1830
|
-
|
|
1877
|
+
<div
|
|
1878
|
+
class="kanban-item"
|
|
1879
|
+
LibsUiDragItemDirective>
|
|
1831
1880
|
<div class="kanban-item-header">
|
|
1832
1881
|
<span class="item-title">{{ item.title }}</span>
|
|
1833
|
-
<span
|
|
1882
|
+
<span
|
|
1883
|
+
class="item-status"
|
|
1884
|
+
[class]="'status-' + item.status">
|
|
1834
1885
|
{{ item.status }}
|
|
1835
1886
|
</span>
|
|
1836
1887
|
</div>
|
|
@@ -1846,25 +1897,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1846
1897
|
<div class="demo-example">
|
|
1847
1898
|
<h3>Nested Containers copy</h3>
|
|
1848
1899
|
<div class="nested-container">
|
|
1849
|
-
<div
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1900
|
+
<div
|
|
1901
|
+
LibsUiComponentsDragContainerDirective
|
|
1902
|
+
[(items)]="nestedItems"
|
|
1903
|
+
[groupName]="'parent'"
|
|
1904
|
+
[mode]="'copy'"
|
|
1905
|
+
[acceptDragSameGroup]="true">
|
|
1854
1906
|
@for (item of nestedItems; track item) {
|
|
1855
|
-
<div
|
|
1856
|
-
|
|
1907
|
+
<div
|
|
1908
|
+
class="nested-item"
|
|
1909
|
+
LibsUiDragItemDirective>
|
|
1857
1910
|
<div class="nested-item-header">
|
|
1858
1911
|
<span class="item-title">{{ item.title }}</span>
|
|
1859
1912
|
</div>
|
|
1860
1913
|
<div class="nested-item-content">
|
|
1861
|
-
<div
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1914
|
+
<div
|
|
1915
|
+
LibsUiComponentsDragContainerDirective
|
|
1916
|
+
[(items)]="item.subItems"
|
|
1917
|
+
[groupName]="'child'"
|
|
1918
|
+
[acceptDragSameGroup]="true">
|
|
1865
1919
|
@for (subItem of item.subItems; track subItem) {
|
|
1866
|
-
<div
|
|
1867
|
-
|
|
1920
|
+
<div
|
|
1921
|
+
class="sub-item"
|
|
1922
|
+
LibsUiDragItemDirective>
|
|
1868
1923
|
{{ subItem }}
|
|
1869
1924
|
</div>
|
|
1870
1925
|
}
|
|
@@ -1880,7 +1935,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1880
1935
|
|
|
1881
1936
|
<section class="api-doc-section">
|
|
1882
1937
|
<h2>API Documentation</h2>
|
|
1883
|
-
|
|
1938
|
+
|
|
1884
1939
|
<h3>Inputs</h3>
|
|
1885
1940
|
<div class="table-container">
|
|
1886
1941
|
<table class="api-table">
|
|
@@ -1895,10 +1950,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1895
1950
|
<tbody>
|
|
1896
1951
|
@for (input of inputsDoc; track input.name) {
|
|
1897
1952
|
<tr>
|
|
1898
|
-
<td
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
<td>
|
|
1953
|
+
<td>
|
|
1954
|
+
<code>{{ input.name }}</code>
|
|
1955
|
+
</td>
|
|
1956
|
+
<td>
|
|
1957
|
+
<code>{{ input.type }}</code>
|
|
1958
|
+
</td>
|
|
1959
|
+
<td>{{ input.default }}</td>
|
|
1960
|
+
<td>{{ input.description }}</td>
|
|
1902
1961
|
</tr>
|
|
1903
1962
|
}
|
|
1904
1963
|
</tbody>
|
|
@@ -1918,9 +1977,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1918
1977
|
<tbody>
|
|
1919
1978
|
@for (output of outputsDoc; track output.name) {
|
|
1920
1979
|
<tr>
|
|
1921
|
-
<td
|
|
1922
|
-
|
|
1923
|
-
|
|
1980
|
+
<td>
|
|
1981
|
+
<code>{{ output.name }}</code>
|
|
1982
|
+
</td>
|
|
1983
|
+
<td>
|
|
1984
|
+
<code>{{ output.type }}</code>
|
|
1985
|
+
</td>
|
|
1986
|
+
<td>{{ output.description }}</td>
|
|
1924
1987
|
</tr>
|
|
1925
1988
|
}
|
|
1926
1989
|
</tbody>
|
|
@@ -1933,9 +1996,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1933
1996
|
<div class="interface-docs">
|
|
1934
1997
|
@for (interfaceItem of interfacesDoc; track interfaceItem.name) {
|
|
1935
1998
|
<div class="interface-item">
|
|
1936
|
-
<h3>{{interfaceItem.name}}</h3>
|
|
1999
|
+
<h3>{{ interfaceItem.name }}</h3>
|
|
1937
2000
|
<pre><code>{{interfaceItem.code}}</code></pre>
|
|
1938
|
-
<p>{{interfaceItem.description}}</p>
|
|
2001
|
+
<p>{{ interfaceItem.description }}</p>
|
|
1939
2002
|
</div>
|
|
1940
2003
|
}
|
|
1941
2004
|
</div>
|
|
@@ -1946,10 +2009,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1946
2009
|
<ul>
|
|
1947
2010
|
@for (feature of features; track feature.id) {
|
|
1948
2011
|
<li>
|
|
1949
|
-
<span class="feature-icon">{{feature.icon}}</span>
|
|
2012
|
+
<span class="feature-icon">{{ feature.icon }}</span>
|
|
1950
2013
|
<div class="feature-info">
|
|
1951
|
-
<h3>{{feature.title}}</h3>
|
|
1952
|
-
<p>{{feature.description}}</p>
|
|
2014
|
+
<h3>{{ feature.title }}</h3>
|
|
2015
|
+
<p>{{ feature.description }}</p>
|
|
1953
2016
|
</div>
|
|
1954
2017
|
</li>
|
|
1955
2018
|
}
|
|
@@ -1961,7 +2024,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1961
2024
|
<div class="code-examples">
|
|
1962
2025
|
@for (example of codeExamples; track example.id) {
|
|
1963
2026
|
<div class="code-example">
|
|
1964
|
-
<h3>{{example.title}}</h3>
|
|
2027
|
+
<h3>{{ example.title }}</h3>
|
|
1965
2028
|
<pre><code [innerHTML]="example.code"></code></pre>
|
|
1966
2029
|
</div>
|
|
1967
2030
|
}
|