@libs-ui/components-drag-drop 0.2.190 → 0.2.192
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 +444 -2
- package/demo/demo.component.d.ts +56 -0
- package/drag-item.directive.d.ts +1 -2
- package/esm2022/demo/demo.component.mjs +804 -0
- package/esm2022/drag-drop.directive.mjs +10 -8
- package/esm2022/drag-item.directive.mjs +2 -4
- package/esm2022/index.mjs +2 -1
- package/fesm2022/libs-ui-components-drag-drop.mjs +812 -12
- package/fesm2022/libs-ui-components-drag-drop.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +3 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { signal, Injectable, input, inject, ElementRef, Directive, model, output, effect, untracked } from '@angular/core';
|
|
2
|
+
import { signal, Injectable, input, inject, ElementRef, Directive, model, output, effect, untracked, Component } from '@angular/core';
|
|
3
3
|
import { get, checkMouseOverInContainer, cloneIBoundingClientRect, uuid, set, cloneDeep, getViewport, checkViewInScreen, getDragEventByElement } from '@libs-ui/utils';
|
|
4
4
|
import { Subject, takeUntil, debounceTime, filter, fromEvent, tap, throttleTime } from 'rxjs';
|
|
5
|
+
import { CommonModule } from '@angular/common';
|
|
6
|
+
import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
|
|
5
7
|
|
|
6
8
|
const styleContainer = (config, viewEncapsulation, groupID) => {
|
|
7
9
|
const defaultConfig = [{
|
|
@@ -426,8 +428,8 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
426
428
|
items.splice(indexDragOver, 0, item);
|
|
427
429
|
return [...items];
|
|
428
430
|
});
|
|
429
|
-
indexSpliceListTo = indexDragOver;
|
|
430
431
|
this.setAttributeElementAndItemDrag(elementContainer, false, indexSpliceListTo);
|
|
432
|
+
indexSpliceListTo = indexDragOver;
|
|
431
433
|
}
|
|
432
434
|
return;
|
|
433
435
|
}
|
|
@@ -459,8 +461,8 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
459
461
|
items.splice(childElementIndex, 1);
|
|
460
462
|
return [...items];
|
|
461
463
|
});
|
|
464
|
+
indexSpliceListTo = -1;
|
|
462
465
|
}
|
|
463
|
-
indexSpliceListTo = -1;
|
|
464
466
|
this.removeAttributes(elementContainer, isDragging);
|
|
465
467
|
this.setIndexElement(elementContainer);
|
|
466
468
|
return;
|
|
@@ -470,8 +472,8 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
470
472
|
items.splice(indexSpliceListTo, 1);
|
|
471
473
|
return [...items];
|
|
472
474
|
});
|
|
475
|
+
indexSpliceListTo = -1;
|
|
473
476
|
}
|
|
474
|
-
indexSpliceListTo = -1;
|
|
475
477
|
};
|
|
476
478
|
const handlerDragging = (eventDragging) => {
|
|
477
479
|
this.setAttributeElementAndItemDrag(elementContainer);
|
|
@@ -602,7 +604,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
602
604
|
if (this.groupID() !== elementDrop.getAttribute('groupID') || elementDrag.getAttribute('groupID') === elementDrop.getAttribute('groupID')) {
|
|
603
605
|
return;
|
|
604
606
|
}
|
|
605
|
-
const indexDragOver = Number(elementDrop.getAttribute('index')).valueOf() - (elementDrop.getAttribute('dropContainer') ? 0 : 1);
|
|
607
|
+
const indexDragOver = this.groupID() !== elementDrag.getAttribute('groupID') ? Number(elementDrop.getAttribute('index')).valueOf() : Number(elementDrop.getAttribute('index')).valueOf() - (elementDrop.getAttribute('dropContainer') ? 0 : 1);
|
|
606
608
|
const item = this.mode() === 'deepCopy' ? cloneDeep(itemDragInfo?.item) : itemDragInfo?.item;
|
|
607
609
|
if (itemDragInfo) {
|
|
608
610
|
itemDragInfo.indexDrop = indexDragOver;
|
|
@@ -618,7 +620,7 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
618
620
|
});
|
|
619
621
|
if (itemDragInfo && itemDragInfo.itemsMove && itemDragInfo.itemsMove()) {
|
|
620
622
|
itemDragInfo.itemsDrag.set([...itemDragInfo.itemsMove()]);
|
|
621
|
-
this.setAttributeElementAndItemDrag(elementContainer);
|
|
623
|
+
setTimeout(() => this.setAttributeElementAndItemDrag(elementContainer));
|
|
622
624
|
}
|
|
623
625
|
this.outDroppedContainer.emit(eventDrop);
|
|
624
626
|
this.removeAttributes(elementContainer);
|
|
@@ -631,7 +633,8 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
631
633
|
}, {
|
|
632
634
|
name: 'OnDragOver',
|
|
633
635
|
event: this.dragDropService.OnDragOver,
|
|
634
|
-
functionCall: handlerDragOver
|
|
636
|
+
functionCall: handlerDragOver,
|
|
637
|
+
debounceTime: 5
|
|
635
638
|
}, {
|
|
636
639
|
name: 'OnDragging',
|
|
637
640
|
event: this.dragDropService.OnDragging,
|
|
@@ -644,7 +647,8 @@ class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollD
|
|
|
644
647
|
name: 'OnDrop',
|
|
645
648
|
event: this.dragDropService.OnDrop,
|
|
646
649
|
functionCall: handlerDrop
|
|
647
|
-
}
|
|
650
|
+
}
|
|
651
|
+
].forEach((item) => (item.event.pipe(debounceTime(item.debounceTime || 0), takeUntil(this.onDestroy)).subscribe(item.functionCall)));
|
|
648
652
|
}
|
|
649
653
|
/* */
|
|
650
654
|
async setAttributeElementAndItemDrag(elementContainer, setItemDrag, indexInsert) {
|
|
@@ -928,7 +932,6 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
928
932
|
ignoreStopEvent = input();
|
|
929
933
|
onlyMouseDownStopEvent = input();
|
|
930
934
|
dragRootElement = input();
|
|
931
|
-
groupName = input('groupDragAndDropDefault', { transform: value => value ?? 'groupDragAndDropDefault' });
|
|
932
935
|
dragBoundary = input();
|
|
933
936
|
dragBoundaryAcceptMouseLeaveContainer = input();
|
|
934
937
|
elementContainer = input();
|
|
@@ -963,7 +966,6 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
963
966
|
element.setAttribute('item_id', get(this.item(), this.fieldId()));
|
|
964
967
|
}
|
|
965
968
|
}
|
|
966
|
-
element.setAttribute('groupName', this.groupName());
|
|
967
969
|
element.classList.add(this.dragDropService.ClassItemDefine);
|
|
968
970
|
this.dragDropService.OnDragging.pipe(throttleTime(this.throttleTimeHandlerDraggingEvent()), takeUntil(this.onDestroy)).subscribe((eventDragging) => {
|
|
969
971
|
if (this.disable() || element.getAttribute('disableDragContainer') || (this.fieldId() && this.item() && eventDragging.elementDrag.getAttribute('item_id') === get(this.item(), this.fieldId()))) {
|
|
@@ -1161,7 +1163,7 @@ class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDire
|
|
|
1161
1163
|
});
|
|
1162
1164
|
}
|
|
1163
1165
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiDragItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1164
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiDragItemDirective, isStandalone: true, selector: "[LibsUiDragItemDirective]", inputs: { fieldId: { classPropertyName: "fieldId", publicName: "fieldId", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, itemInContainerVirtualScroll: { classPropertyName: "itemInContainerVirtualScroll", publicName: "itemInContainerVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, throttleTimeHandlerDraggingEvent: { classPropertyName: "throttleTimeHandlerDraggingEvent", publicName: "throttleTimeHandlerDraggingEvent", isSignal: true, isRequired: false, transformFunction: null }, ignoreStopEvent: { classPropertyName: "ignoreStopEvent", publicName: "ignoreStopEvent", isSignal: true, isRequired: false, transformFunction: null }, onlyMouseDownStopEvent: { classPropertyName: "onlyMouseDownStopEvent", publicName: "onlyMouseDownStopEvent", isSignal: true, isRequired: false, transformFunction: null }, dragRootElement: { classPropertyName: "dragRootElement", publicName: "dragRootElement", isSignal: true, isRequired: false, transformFunction: null },
|
|
1166
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.13", type: LibsUiDragItemDirective, isStandalone: true, selector: "[LibsUiDragItemDirective]", inputs: { fieldId: { classPropertyName: "fieldId", publicName: "fieldId", isSignal: true, isRequired: false, transformFunction: null }, item: { classPropertyName: "item", publicName: "item", isSignal: true, isRequired: false, transformFunction: null }, itemInContainerVirtualScroll: { classPropertyName: "itemInContainerVirtualScroll", publicName: "itemInContainerVirtualScroll", isSignal: true, isRequired: false, transformFunction: null }, throttleTimeHandlerDraggingEvent: { classPropertyName: "throttleTimeHandlerDraggingEvent", publicName: "throttleTimeHandlerDraggingEvent", isSignal: true, isRequired: false, transformFunction: null }, ignoreStopEvent: { classPropertyName: "ignoreStopEvent", publicName: "ignoreStopEvent", isSignal: true, isRequired: false, transformFunction: null }, onlyMouseDownStopEvent: { classPropertyName: "onlyMouseDownStopEvent", publicName: "onlyMouseDownStopEvent", isSignal: true, isRequired: false, transformFunction: null }, dragRootElement: { classPropertyName: "dragRootElement", publicName: "dragRootElement", isSignal: true, isRequired: false, transformFunction: null }, dragBoundary: { classPropertyName: "dragBoundary", publicName: "dragBoundary", isSignal: true, isRequired: false, transformFunction: null }, dragBoundaryAcceptMouseLeaveContainer: { classPropertyName: "dragBoundaryAcceptMouseLeaveContainer", publicName: "dragBoundaryAcceptMouseLeaveContainer", isSignal: true, isRequired: false, transformFunction: null }, elementContainer: { classPropertyName: "elementContainer", publicName: "elementContainer", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { outDragStart: "outDragStart", outDragOver: "outDragOver", outDragLeave: "outDragLeave", outDragEnd: "outDragEnd", outDropped: "outDropped" }, usesInheritance: true, ngImport: i0 });
|
|
1165
1167
|
}
|
|
1166
1168
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiDragItemDirective, decorators: [{
|
|
1167
1169
|
type: Directive,
|
|
@@ -1172,9 +1174,807 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1172
1174
|
}]
|
|
1173
1175
|
}], ctorParameters: () => [] });
|
|
1174
1176
|
|
|
1177
|
+
class LibsUiDragDropDemoComponent {
|
|
1178
|
+
// Basic List Items
|
|
1179
|
+
basicItems = [
|
|
1180
|
+
'Task 1',
|
|
1181
|
+
'Task 2',
|
|
1182
|
+
'Task 3',
|
|
1183
|
+
'Task 4',
|
|
1184
|
+
'Task 5'
|
|
1185
|
+
];
|
|
1186
|
+
// Kanban Board Columns
|
|
1187
|
+
columnsIds = ['todo', 'in-progress', 'done'];
|
|
1188
|
+
columns = [
|
|
1189
|
+
{
|
|
1190
|
+
id: 'todo',
|
|
1191
|
+
title: 'To Do',
|
|
1192
|
+
items: [
|
|
1193
|
+
{
|
|
1194
|
+
id: 1,
|
|
1195
|
+
title: 'Implement drag and drop',
|
|
1196
|
+
description: 'Add drag and drop functionality to the component',
|
|
1197
|
+
status: 'todo'
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
id: 2,
|
|
1201
|
+
title: 'Add animations',
|
|
1202
|
+
description: 'Implement smooth animations for drag and drop',
|
|
1203
|
+
status: 'todo'
|
|
1204
|
+
}
|
|
1205
|
+
]
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
id: 'in-progress',
|
|
1209
|
+
title: 'In Progress',
|
|
1210
|
+
items: [
|
|
1211
|
+
{
|
|
1212
|
+
id: 3,
|
|
1213
|
+
title: 'Fix styling issues',
|
|
1214
|
+
description: 'Resolve CSS conflicts in the component',
|
|
1215
|
+
status: 'in-progress'
|
|
1216
|
+
}
|
|
1217
|
+
]
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
id: 'done',
|
|
1221
|
+
title: 'Done',
|
|
1222
|
+
items: [
|
|
1223
|
+
{
|
|
1224
|
+
id: 4,
|
|
1225
|
+
title: 'Setup project structure',
|
|
1226
|
+
description: 'Initialize the project with necessary configurations',
|
|
1227
|
+
status: 'done'
|
|
1228
|
+
}
|
|
1229
|
+
]
|
|
1230
|
+
}
|
|
1231
|
+
];
|
|
1232
|
+
// Nested Items
|
|
1233
|
+
nestedItems = [
|
|
1234
|
+
{
|
|
1235
|
+
id: 1,
|
|
1236
|
+
title: 'Project A',
|
|
1237
|
+
subItems: ['Task 1', 'Task 2', 'Task 3']
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
id: 2,
|
|
1241
|
+
title: 'Project B',
|
|
1242
|
+
subItems: ['Task 4', 'Task 5']
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
id: 3,
|
|
1246
|
+
title: 'Project C',
|
|
1247
|
+
subItems: ['Task 6', 'Task 7', 'Task 8']
|
|
1248
|
+
}
|
|
1249
|
+
];
|
|
1250
|
+
// API Documentation
|
|
1251
|
+
inputsDoc = [
|
|
1252
|
+
{
|
|
1253
|
+
name: 'items',
|
|
1254
|
+
type: 'Array<unknown>',
|
|
1255
|
+
default: '[]',
|
|
1256
|
+
description: 'Array of items to be displayed in the container'
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
name: 'mode',
|
|
1260
|
+
type: "'move' | 'copy' | 'deepCopy'",
|
|
1261
|
+
default: "'move'",
|
|
1262
|
+
description: 'Mode for drag and drop operations'
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
name: 'directionDrag',
|
|
1266
|
+
type: "'horizontal' | 'vertical'",
|
|
1267
|
+
default: 'undefined',
|
|
1268
|
+
description: 'Direction of drag movement'
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
name: 'viewEncapsulation',
|
|
1272
|
+
type: "'emulated' | 'none'",
|
|
1273
|
+
default: "'emulated'",
|
|
1274
|
+
description: 'View encapsulation mode for styling'
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
name: 'disableDragContainer',
|
|
1278
|
+
type: 'boolean',
|
|
1279
|
+
default: 'undefined',
|
|
1280
|
+
description: 'Whether to disable drag operations for the container'
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
name: 'acceptDragSameGroup',
|
|
1284
|
+
type: 'boolean',
|
|
1285
|
+
default: 'false',
|
|
1286
|
+
description: 'Whether to accept drag operations within the same group'
|
|
1287
|
+
},
|
|
1288
|
+
{
|
|
1289
|
+
name: 'placeholder',
|
|
1290
|
+
type: 'boolean',
|
|
1291
|
+
default: 'true',
|
|
1292
|
+
description: 'Whether to show placeholder during drag'
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
name: 'groupName',
|
|
1296
|
+
type: 'string',
|
|
1297
|
+
default: "'groupDragAndDropDefault'",
|
|
1298
|
+
description: 'Name of the group for drag and drop operations'
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
name: 'dropToGroupName',
|
|
1302
|
+
type: 'Array<string> | null',
|
|
1303
|
+
default: 'null',
|
|
1304
|
+
description: 'List of group names that can accept drops from this container'
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
name: 'stylesOverride',
|
|
1308
|
+
type: 'Array<{ className: string, styles: string }>',
|
|
1309
|
+
default: 'undefined',
|
|
1310
|
+
description: 'Custom styles to override default drag-drop styling'
|
|
1311
|
+
}
|
|
1312
|
+
];
|
|
1313
|
+
outputsDoc = [
|
|
1314
|
+
{
|
|
1315
|
+
name: 'outDragStartContainer',
|
|
1316
|
+
type: 'IDragStart',
|
|
1317
|
+
description: 'Event emitted when dragging starts in the container'
|
|
1318
|
+
},
|
|
1319
|
+
{
|
|
1320
|
+
name: 'outDragOverContainer',
|
|
1321
|
+
type: 'IDragOver',
|
|
1322
|
+
description: 'Event emitted when dragging over the container'
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
name: 'outDragLeaveContainer',
|
|
1326
|
+
type: 'IDragLeave',
|
|
1327
|
+
description: 'Event emitted when dragging leaves the container'
|
|
1328
|
+
},
|
|
1329
|
+
{
|
|
1330
|
+
name: 'outDragEndContainer',
|
|
1331
|
+
type: 'IDragEnd',
|
|
1332
|
+
description: 'Event emitted when dragging ends in the container'
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
name: 'outDroppedContainer',
|
|
1336
|
+
type: 'IDrop',
|
|
1337
|
+
description: 'Event emitted when an item is dropped in the container'
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
name: 'outDroppedContainerEmpty',
|
|
1341
|
+
type: 'IDrop',
|
|
1342
|
+
description: 'Event emitted when an item is dropped in an empty container'
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
name: 'outFunctionControl',
|
|
1346
|
+
type: 'IDragDropFunctionControlEvent',
|
|
1347
|
+
description: 'Event emitted to control drag-drop functionality'
|
|
1348
|
+
}
|
|
1349
|
+
];
|
|
1350
|
+
// Interface Documentation
|
|
1351
|
+
interfacesDoc = [
|
|
1352
|
+
{
|
|
1353
|
+
name: 'IDragging',
|
|
1354
|
+
code: `interface IDragging {
|
|
1355
|
+
mousePosition: IMousePosition;
|
|
1356
|
+
elementDrag: HTMLElement;
|
|
1357
|
+
elementKeepContainer?: boolean;
|
|
1358
|
+
itemDragInfo?: IItemDragInfo;
|
|
1359
|
+
}`,
|
|
1360
|
+
description: 'Interface for drag operation events, containing information about the dragged element and mouse position'
|
|
1361
|
+
},
|
|
1362
|
+
{
|
|
1363
|
+
name: 'IDragStart',
|
|
1364
|
+
code: `interface IDragStart {
|
|
1365
|
+
mousePosition: IMousePosition;
|
|
1366
|
+
elementDrag: HTMLElement;
|
|
1367
|
+
itemDragInfo?: IItemDragInfo;
|
|
1368
|
+
}`,
|
|
1369
|
+
description: 'Interface for drag start events, triggered when dragging begins'
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
name: 'IDragOver',
|
|
1373
|
+
code: `interface IDragOver {
|
|
1374
|
+
mousePosition: IMousePosition;
|
|
1375
|
+
elementDrag: HTMLElement;
|
|
1376
|
+
elementDragOver: HTMLElement;
|
|
1377
|
+
itemDragInfo?: IItemDragInfo;
|
|
1378
|
+
}`,
|
|
1379
|
+
description: 'Interface for drag over events, triggered when an element is dragged over another element'
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
name: 'IDragLeave',
|
|
1383
|
+
code: `interface IDragLeave {
|
|
1384
|
+
elementDrag: HTMLElement;
|
|
1385
|
+
elementDragLeave: HTMLElement;
|
|
1386
|
+
itemDragInfo?: IItemDragInfo;
|
|
1387
|
+
}`,
|
|
1388
|
+
description: 'Interface for drag leave events, triggered when a dragged element leaves another element'
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
name: 'IDragEnd',
|
|
1392
|
+
code: `interface IDragEnd {
|
|
1393
|
+
mousePosition: IMousePosition;
|
|
1394
|
+
elementDrag: HTMLElement;
|
|
1395
|
+
itemDragInfo?: IItemDragInfo;
|
|
1396
|
+
}`,
|
|
1397
|
+
description: 'Interface for drag end events, triggered when dragging ends'
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
name: 'IDrop',
|
|
1401
|
+
code: `interface IDrop {
|
|
1402
|
+
elementDrag: HTMLElement;
|
|
1403
|
+
elementDrop: HTMLElement;
|
|
1404
|
+
itemDragInfo?: IItemDragInfo;
|
|
1405
|
+
}`,
|
|
1406
|
+
description: 'Interface for drop events, triggered when an element is dropped'
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
name: 'IItemDragInfo',
|
|
1410
|
+
code: `interface IItemDragInfo {
|
|
1411
|
+
item: object;
|
|
1412
|
+
itemsMove?: WritableSignal<Array<unknown>>;
|
|
1413
|
+
indexDrag?: number;
|
|
1414
|
+
indexDrop?: number;
|
|
1415
|
+
itemsDrag: WritableSignal<Array<unknown>>;
|
|
1416
|
+
itemsDrop?: WritableSignal<Array<unknown>>;
|
|
1417
|
+
containerDrag?: HTMLElement;
|
|
1418
|
+
containerDrop?: HTMLElement;
|
|
1419
|
+
}`,
|
|
1420
|
+
description: 'Interface containing information about the dragged item and its containers'
|
|
1421
|
+
},
|
|
1422
|
+
{
|
|
1423
|
+
name: 'IDragItemInContainerVirtualScroll',
|
|
1424
|
+
code: `interface IDragItemInContainerVirtualScroll {
|
|
1425
|
+
itemDragInfo?: IItemDragInfo;
|
|
1426
|
+
elementDrag: HTMLElement;
|
|
1427
|
+
distanceStartElementAndMouseTop: number;
|
|
1428
|
+
distanceStartElementAndMouseLeft: number;
|
|
1429
|
+
elementContainer?: HTMLElement;
|
|
1430
|
+
dragBoundary?: boolean;
|
|
1431
|
+
dragBoundaryAcceptMouseLeaveContainer?: boolean;
|
|
1432
|
+
ignoreStopEvent?: boolean;
|
|
1433
|
+
}`,
|
|
1434
|
+
description: 'Interface for virtual scrolling drag operations, containing information about drag boundaries and container elements'
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
name: 'IMousePosition',
|
|
1438
|
+
code: `interface IMousePosition {
|
|
1439
|
+
clientX: number;
|
|
1440
|
+
clientY: number;
|
|
1441
|
+
}`,
|
|
1442
|
+
description: 'Interface representing mouse position coordinates'
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
name: 'IDragDropFunctionControlEvent',
|
|
1446
|
+
code: `interface IDragDropFunctionControlEvent {
|
|
1447
|
+
setAttributeElementAndItemDrag: () => Promise<void>;
|
|
1448
|
+
}`,
|
|
1449
|
+
description: 'Interface for drag and drop control functions'
|
|
1450
|
+
}
|
|
1451
|
+
];
|
|
1452
|
+
// Features
|
|
1453
|
+
features = [
|
|
1454
|
+
{
|
|
1455
|
+
id: 1,
|
|
1456
|
+
icon: '🔄',
|
|
1457
|
+
title: 'Flexible Drag and Drop',
|
|
1458
|
+
description: 'Support for container-to-container dragging with customizable group names and drop zones'
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
id: 2,
|
|
1462
|
+
icon: '📜',
|
|
1463
|
+
title: 'Virtual Scrolling',
|
|
1464
|
+
description: 'Efficient handling of large lists with virtual scrolling support'
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
id: 3,
|
|
1468
|
+
icon: '🎯',
|
|
1469
|
+
title: 'Custom Boundaries',
|
|
1470
|
+
description: 'Define custom drag boundaries and drop zones for precise control'
|
|
1471
|
+
},
|
|
1472
|
+
{
|
|
1473
|
+
id: 4,
|
|
1474
|
+
icon: '🎨',
|
|
1475
|
+
title: 'Styling Options',
|
|
1476
|
+
description: 'Customizable styles for drag items and containers'
|
|
1477
|
+
}
|
|
1478
|
+
];
|
|
1479
|
+
// Code Examples
|
|
1480
|
+
codeExamples = [
|
|
1481
|
+
{
|
|
1482
|
+
id: 1,
|
|
1483
|
+
title: 'Basic Usage',
|
|
1484
|
+
code: `<div LibsUiComponentsDragContainerDirective
|
|
1485
|
+
[(items)]="items"
|
|
1486
|
+
[groupName]="'myGroup'"
|
|
1487
|
+
[acceptDragSameGroup]="true">
|
|
1488
|
+
@for (item of items; track item) {
|
|
1489
|
+
<div LibsUiDragItemDirective>
|
|
1490
|
+
{{ item }}
|
|
1491
|
+
</div>
|
|
1492
|
+
}
|
|
1493
|
+
</div>`
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
id: 2,
|
|
1497
|
+
title: 'Container-to-Container',
|
|
1498
|
+
code: `<div LibsUiComponentsDragContainerDirective
|
|
1499
|
+
[(items)]="sourceItems"
|
|
1500
|
+
[groupName]="'source'">
|
|
1501
|
+
@for (item of sourceItems; track item) {
|
|
1502
|
+
<div LibsUiDragItemDirective>
|
|
1503
|
+
{{ item }}
|
|
1504
|
+
</div>
|
|
1505
|
+
}
|
|
1506
|
+
</div>
|
|
1507
|
+
|
|
1508
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1509
|
+
[(items)]="targetItems"
|
|
1510
|
+
[groupName]="'target'"
|
|
1511
|
+
[dropToGroupName]="['source']">
|
|
1512
|
+
@for (item of targetItems; track item) {
|
|
1513
|
+
<div LibsUiDragItemDirective>
|
|
1514
|
+
{{ item }}
|
|
1515
|
+
</div>
|
|
1516
|
+
}
|
|
1517
|
+
</div>`
|
|
1518
|
+
}
|
|
1519
|
+
];
|
|
1520
|
+
/**
|
|
1521
|
+
* Copy text to clipboard
|
|
1522
|
+
*/
|
|
1523
|
+
copyToClipboard(text) {
|
|
1524
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
1525
|
+
alert('Copied to clipboard');
|
|
1526
|
+
}, (err) => {
|
|
1527
|
+
console.error('Could not copy text: ', err);
|
|
1528
|
+
});
|
|
1529
|
+
}
|
|
1530
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiDragDropDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1531
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiDragDropDemoComponent, isStandalone: true, selector: "lib-drag-drop-demo", ngImport: i0, template: `
|
|
1532
|
+
<div class="page-container">
|
|
1533
|
+
<header>
|
|
1534
|
+
<h1>Demo Drag and Drop Component</h1>
|
|
1535
|
+
<p>Angular component library for drag and drop functionality</p>
|
|
1536
|
+
</header>
|
|
1537
|
+
|
|
1538
|
+
<main>
|
|
1539
|
+
<section class="intro-section">
|
|
1540
|
+
<h2>Introduction</h2>
|
|
1541
|
+
<p>
|
|
1542
|
+
<code>@libs-ui/components-drag-drop</code> is a powerful Angular component that enables drag and drop functionality with features like virtual scrolling, multi-selection, and custom boundaries.
|
|
1543
|
+
</p>
|
|
1544
|
+
</section>
|
|
1545
|
+
|
|
1546
|
+
<section class="installation-section">
|
|
1547
|
+
<h2>Installation</h2>
|
|
1548
|
+
<p>To install the library, use npm or yarn:</p>
|
|
1549
|
+
|
|
1550
|
+
<div class="install-command">
|
|
1551
|
+
<pre>
|
|
1552
|
+
<code>npm install @libs-ui/components-drag-drop</code>
|
|
1553
|
+
<libs_ui-components-buttons-button
|
|
1554
|
+
[label]="'Copy'"
|
|
1555
|
+
(outClick)="copyToClipboard('npm install @libs-ui/components-drag-drop')" />
|
|
1556
|
+
</pre>
|
|
1557
|
+
</div>
|
|
1558
|
+
|
|
1559
|
+
<p>Or with yarn:</p>
|
|
1560
|
+
|
|
1561
|
+
<div class="install-command">
|
|
1562
|
+
<pre>
|
|
1563
|
+
<code>yarn add @libs-ui/components-drag-drop</code>
|
|
1564
|
+
<libs_ui-components-buttons-button
|
|
1565
|
+
[label]="'Copy'"
|
|
1566
|
+
(outClick)="copyToClipboard('yarn add @libs-ui/components-drag-drop')" />
|
|
1567
|
+
</pre>
|
|
1568
|
+
</div>
|
|
1569
|
+
</section>
|
|
1570
|
+
|
|
1571
|
+
<section class="demo-section">
|
|
1572
|
+
<h2>Live Demo</h2>
|
|
1573
|
+
<div class="demo-container">
|
|
1574
|
+
<!-- Basic List Demo -->
|
|
1575
|
+
<div class="demo-example">
|
|
1576
|
+
<h3>Basic List</h3>
|
|
1577
|
+
<div class="list-container">
|
|
1578
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1579
|
+
[(items)]="basicItems"
|
|
1580
|
+
[acceptDragSameGroup]="true">
|
|
1581
|
+
@for (item of basicItems; track item) {
|
|
1582
|
+
<div class="list-item"
|
|
1583
|
+
LibsUiDragItemDirective>
|
|
1584
|
+
<span class="item-icon">📋</span>
|
|
1585
|
+
<span class="item-text">{{ item }}</span>
|
|
1586
|
+
</div>
|
|
1587
|
+
}
|
|
1588
|
+
</div>
|
|
1589
|
+
</div>
|
|
1590
|
+
</div>
|
|
1591
|
+
|
|
1592
|
+
<!-- Kanban Board Demo -->
|
|
1593
|
+
<div class="demo-example">
|
|
1594
|
+
<h3>Kanban Board</h3>
|
|
1595
|
+
<div class="kanban-board">
|
|
1596
|
+
@for (column of columns; track column) {
|
|
1597
|
+
<div class="kanban-column"
|
|
1598
|
+
LibsUiComponentsDragContainerDirective
|
|
1599
|
+
[(items)]="column.items"
|
|
1600
|
+
[groupName]="column.id"
|
|
1601
|
+
[dropToGroupName]="columnsIds"
|
|
1602
|
+
[acceptDragSameGroup]="true">
|
|
1603
|
+
<h4>{{ column.title }}</h4>
|
|
1604
|
+
@for (item of column.items; track item) {
|
|
1605
|
+
<div class="kanban-item"
|
|
1606
|
+
LibsUiDragItemDirective>
|
|
1607
|
+
<div class="kanban-item-header">
|
|
1608
|
+
<span class="item-title">{{ item.title }}</span>
|
|
1609
|
+
<span class="item-status" [class]="'status-' + item.status">
|
|
1610
|
+
{{ item.status }}
|
|
1611
|
+
</span>
|
|
1612
|
+
</div>
|
|
1613
|
+
<p class="item-description">{{ item.description }}</p>
|
|
1614
|
+
</div>
|
|
1615
|
+
}
|
|
1616
|
+
</div>
|
|
1617
|
+
}
|
|
1618
|
+
</div>
|
|
1619
|
+
</div>
|
|
1620
|
+
|
|
1621
|
+
<!-- Nested Containers Demo -->
|
|
1622
|
+
<div class="demo-example">
|
|
1623
|
+
<h3>Nested Containers</h3>
|
|
1624
|
+
<div class="nested-container">
|
|
1625
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1626
|
+
[(items)]="nestedItems"
|
|
1627
|
+
[groupName]="'parent'"
|
|
1628
|
+
[acceptDragSameGroup]="true">
|
|
1629
|
+
@for (item of nestedItems; track item) {
|
|
1630
|
+
<div class="nested-item"
|
|
1631
|
+
LibsUiDragItemDirective>
|
|
1632
|
+
<div class="nested-item-header">
|
|
1633
|
+
<span class="item-title">{{ item.title }}</span>
|
|
1634
|
+
</div>
|
|
1635
|
+
<div class="nested-item-content">
|
|
1636
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1637
|
+
[(items)]="item.subItems"
|
|
1638
|
+
[groupName]="'child'"
|
|
1639
|
+
[acceptDragSameGroup]="true">
|
|
1640
|
+
@for (subItem of item.subItems; track subItem) {
|
|
1641
|
+
<div class="sub-item"
|
|
1642
|
+
LibsUiDragItemDirective>
|
|
1643
|
+
{{ subItem }}
|
|
1644
|
+
</div>
|
|
1645
|
+
}
|
|
1646
|
+
</div>
|
|
1647
|
+
</div>
|
|
1648
|
+
</div>
|
|
1649
|
+
}
|
|
1650
|
+
</div>
|
|
1651
|
+
</div>
|
|
1652
|
+
</div>
|
|
1653
|
+
</div>
|
|
1654
|
+
</section>
|
|
1655
|
+
|
|
1656
|
+
<section class="api-doc-section">
|
|
1657
|
+
<h2>API Documentation</h2>
|
|
1658
|
+
|
|
1659
|
+
<h3>Inputs</h3>
|
|
1660
|
+
<div class="table-container">
|
|
1661
|
+
<table class="api-table">
|
|
1662
|
+
<thead>
|
|
1663
|
+
<tr>
|
|
1664
|
+
<th>Name</th>
|
|
1665
|
+
<th>Type</th>
|
|
1666
|
+
<th>Default</th>
|
|
1667
|
+
<th>Description</th>
|
|
1668
|
+
</tr>
|
|
1669
|
+
</thead>
|
|
1670
|
+
<tbody>
|
|
1671
|
+
@for (input of inputsDoc; track input.name) {
|
|
1672
|
+
<tr>
|
|
1673
|
+
<td><code>{{input.name}}</code></td>
|
|
1674
|
+
<td><code>{{input.type}}</code></td>
|
|
1675
|
+
<td>{{input.default}}</td>
|
|
1676
|
+
<td>{{input.description}}</td>
|
|
1677
|
+
</tr>
|
|
1678
|
+
}
|
|
1679
|
+
</tbody>
|
|
1680
|
+
</table>
|
|
1681
|
+
</div>
|
|
1682
|
+
|
|
1683
|
+
<h3>Outputs</h3>
|
|
1684
|
+
<div class="table-container">
|
|
1685
|
+
<table class="api-table">
|
|
1686
|
+
<thead>
|
|
1687
|
+
<tr>
|
|
1688
|
+
<th>Name</th>
|
|
1689
|
+
<th>Type</th>
|
|
1690
|
+
<th>Description</th>
|
|
1691
|
+
</tr>
|
|
1692
|
+
</thead>
|
|
1693
|
+
<tbody>
|
|
1694
|
+
@for (output of outputsDoc; track output.name) {
|
|
1695
|
+
<tr>
|
|
1696
|
+
<td><code>{{output.name}}</code></td>
|
|
1697
|
+
<td><code>{{output.type}}</code></td>
|
|
1698
|
+
<td>{{output.description}}</td>
|
|
1699
|
+
</tr>
|
|
1700
|
+
}
|
|
1701
|
+
</tbody>
|
|
1702
|
+
</table>
|
|
1703
|
+
</div>
|
|
1704
|
+
</section>
|
|
1705
|
+
|
|
1706
|
+
<section class="interfaces-section">
|
|
1707
|
+
<h2>Interfaces</h2>
|
|
1708
|
+
<div class="interface-docs">
|
|
1709
|
+
@for (interfaceItem of interfacesDoc; track interfaceItem.name) {
|
|
1710
|
+
<div class="interface-item">
|
|
1711
|
+
<h3>{{interfaceItem.name}}</h3>
|
|
1712
|
+
<pre><code>{{interfaceItem.code}}</code></pre>
|
|
1713
|
+
<p>{{interfaceItem.description}}</p>
|
|
1714
|
+
</div>
|
|
1715
|
+
}
|
|
1716
|
+
</div>
|
|
1717
|
+
</section>
|
|
1718
|
+
|
|
1719
|
+
<section class="features-section">
|
|
1720
|
+
<h2>Features</h2>
|
|
1721
|
+
<ul>
|
|
1722
|
+
@for (feature of features; track feature.id) {
|
|
1723
|
+
<li>
|
|
1724
|
+
<span class="feature-icon">{{feature.icon}}</span>
|
|
1725
|
+
<div class="feature-info">
|
|
1726
|
+
<h3>{{feature.title}}</h3>
|
|
1727
|
+
<p>{{feature.description}}</p>
|
|
1728
|
+
</div>
|
|
1729
|
+
</li>
|
|
1730
|
+
}
|
|
1731
|
+
</ul>
|
|
1732
|
+
</section>
|
|
1733
|
+
|
|
1734
|
+
<section class="usage-section">
|
|
1735
|
+
<h2>Usage</h2>
|
|
1736
|
+
<div class="code-examples">
|
|
1737
|
+
@for (example of codeExamples; track example.id) {
|
|
1738
|
+
<div class="code-example">
|
|
1739
|
+
<h3>{{example.title}}</h3>
|
|
1740
|
+
<pre><code [innerHTML]="example.code"></code></pre>
|
|
1741
|
+
</div>
|
|
1742
|
+
}
|
|
1743
|
+
</div>
|
|
1744
|
+
</section>
|
|
1745
|
+
</main>
|
|
1746
|
+
</div>
|
|
1747
|
+
`, isInline: true, styles: [".page-container{max-width:1200px;margin:0 auto;padding:20px;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;line-height:1.6;color:#333}header{text-align:center;padding:40px 0;background-color:#fff;border-radius:8px;margin-bottom:30px;box-shadow:0 2px 5px #0000001a}header h1{font-size:2.5rem;color:#2c3e50;margin-bottom:10px}header p{font-size:1.2rem;color:#7f8c8d}section{background-color:#fff;border-radius:8px;padding:30px;margin-bottom:30px;box-shadow:0 2px 5px #0000001a}h2{font-size:1.8rem;color:#2c3e50;margin-bottom:20px;padding-bottom:10px;border-bottom:2px solid #ecf0f1}h3{font-size:1.4rem;color:#34495e;margin-bottom:15px}h4{font-size:1.2rem;color:#34495e;margin-bottom:10px}p{margin-bottom:15px}code{font-family:Courier New,Courier,monospace;background-color:#f7f7f7;padding:2px 5px;border-radius:3px;font-size:.9em}pre{background-color:#f7f7f7;padding:15px;border-radius:5px;overflow-x:auto;margin-bottom:20px;display:flex;align-items:center;justify-content:space-between}pre code{background-color:transparent;padding:0}.installation-section .install-command{position:relative;margin-bottom:20px}.installation-section .copy-button{position:absolute;top:10px;right:10px;background:#3498db;color:#fff;border:none;border-radius:4px;padding:5px 10px;font-size:.9rem;cursor:pointer;transition:background .2s}.installation-section .copy-button:hover{background:#2980b9}.demo-container{display:grid;grid-template-columns:1fr;gap:30px}.demo-example{background:#f7f7f7;padding:20px;border-radius:8px;margin-bottom:20px}.list-container{max-width:400px;margin:20px auto}.list-item{padding:12px;margin:8px 0;background:#fff;border:1px solid #e0e0e0;border-radius:6px;display:flex;align-items:center;transition:transform .2s,box-shadow .2s}.list-item:hover{transform:translateY(-2px);box-shadow:0 4px 8px #0000001a}.item-icon{margin-right:12px;font-size:1.2em}.kanban-board{display:flex;gap:20px;padding:20px;overflow-x:auto}.kanban-column{flex:1;min-width:300px;background:#f5f5f5;padding:15px;border-radius:8px}.kanban-item{background:#fff;padding:12px;margin:8px 0;border-radius:6px;box-shadow:0 1px 3px #0000001a}.kanban-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.item-title{font-weight:500}.item-status{padding:4px 8px;border-radius:4px;font-size:.8em}.status-todo{background:#ffebee;color:#c62828}.status-in-progress{background:#fff3e0;color:#ef6c00}.status-done{background:#e8f5e9;color:#2e7d32}.item-description{font-size:.9em;color:#666}.nested-container{max-width:800px;margin:0 auto}.nested-item{background:#fff;border:1px solid #e0e0e0;border-radius:8px;margin:12px 0;overflow:hidden}.nested-item-header{padding:12px;background:#f5f5f5;border-bottom:1px solid #e0e0e0}.nested-item-content{padding:12px}.sub-item{padding:8px;margin:4px 0;background:#f9f9f9;border:1px solid #e0e0e0;border-radius:4px}.api-doc-section{margin-bottom:40px}.table-container{overflow-x:auto;margin-bottom:30px}.api-table{width:100%;border-collapse:collapse;margin-bottom:20px}.api-table th,.api-table td{padding:12px 15px;text-align:left;border-bottom:1px solid #e1e1e1}.api-table th{background-color:#f5f5f5;font-weight:700}.api-table tbody tr:hover{background-color:#f9f9f9}.features-section ul{list-style:none}.features-section li{display:flex;margin-bottom:25px;align-items:flex-start}.feature-icon{font-size:2rem;margin-right:20px;min-width:40px;text-align:center}.feature-info{flex:1}.code-examples{display:grid;grid-template-columns:1fr;gap:20px}@media (min-width: 768px){.code-examples{grid-template-columns:repeat(2,1fr)}}@media (min-width: 992px){.code-examples{grid-template-columns:repeat(3,1fr)}}.code-example{border:1px solid #ecf0f1;border-radius:5px;padding:15px}@media (max-width: 768px){header{padding:30px 0}header h1{font-size:2rem}section{padding:20px}.kanban-board{flex-direction:column}.kanban-column{min-width:100%}.feature-icon{font-size:1.5rem;margin-right:15px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: LibsUiComponentsDragContainerDirective, selector: "[LibsUiComponentsDragContainerDirective]", inputs: ["disableDragContainer", "mode", "directionDrag", "viewEncapsulation", "acceptDragSameGroup", "placeholder", "groupName", "dropToGroupName", "items", "stylesOverride"], outputs: ["itemsChange", "outDragStartContainer", "outDragOverContainer", "outDragLeaveContainer", "outDragEndContainer", "outDroppedContainer", "outDroppedContainerEmpty", "outFunctionControl"] }, { kind: "directive", type: LibsUiDragItemDirective, selector: "[LibsUiDragItemDirective]", inputs: ["fieldId", "item", "itemInContainerVirtualScroll", "throttleTimeHandlerDraggingEvent", "ignoreStopEvent", "onlyMouseDownStopEvent", "dragRootElement", "dragBoundary", "dragBoundaryAcceptMouseLeaveContainer", "elementContainer", "zIndex", "disable"], outputs: ["outDragStart", "outDragOver", "outDragLeave", "outDragEnd", "outDropped"] }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive", "isHandlerEnterDocumentClickButton"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }] });
|
|
1748
|
+
}
|
|
1749
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiDragDropDemoComponent, decorators: [{
|
|
1750
|
+
type: Component,
|
|
1751
|
+
args: [{ selector: 'lib-drag-drop-demo', standalone: true, imports: [
|
|
1752
|
+
CommonModule,
|
|
1753
|
+
LibsUiComponentsDragContainerDirective,
|
|
1754
|
+
LibsUiDragItemDirective,
|
|
1755
|
+
LibsUiComponentsButtonsButtonComponent
|
|
1756
|
+
], template: `
|
|
1757
|
+
<div class="page-container">
|
|
1758
|
+
<header>
|
|
1759
|
+
<h1>Demo Drag and Drop Component</h1>
|
|
1760
|
+
<p>Angular component library for drag and drop functionality</p>
|
|
1761
|
+
</header>
|
|
1762
|
+
|
|
1763
|
+
<main>
|
|
1764
|
+
<section class="intro-section">
|
|
1765
|
+
<h2>Introduction</h2>
|
|
1766
|
+
<p>
|
|
1767
|
+
<code>@libs-ui/components-drag-drop</code> is a powerful Angular component that enables drag and drop functionality with features like virtual scrolling, multi-selection, and custom boundaries.
|
|
1768
|
+
</p>
|
|
1769
|
+
</section>
|
|
1770
|
+
|
|
1771
|
+
<section class="installation-section">
|
|
1772
|
+
<h2>Installation</h2>
|
|
1773
|
+
<p>To install the library, use npm or yarn:</p>
|
|
1774
|
+
|
|
1775
|
+
<div class="install-command">
|
|
1776
|
+
<pre>
|
|
1777
|
+
<code>npm install @libs-ui/components-drag-drop</code>
|
|
1778
|
+
<libs_ui-components-buttons-button
|
|
1779
|
+
[label]="'Copy'"
|
|
1780
|
+
(outClick)="copyToClipboard('npm install @libs-ui/components-drag-drop')" />
|
|
1781
|
+
</pre>
|
|
1782
|
+
</div>
|
|
1783
|
+
|
|
1784
|
+
<p>Or with yarn:</p>
|
|
1785
|
+
|
|
1786
|
+
<div class="install-command">
|
|
1787
|
+
<pre>
|
|
1788
|
+
<code>yarn add @libs-ui/components-drag-drop</code>
|
|
1789
|
+
<libs_ui-components-buttons-button
|
|
1790
|
+
[label]="'Copy'"
|
|
1791
|
+
(outClick)="copyToClipboard('yarn add @libs-ui/components-drag-drop')" />
|
|
1792
|
+
</pre>
|
|
1793
|
+
</div>
|
|
1794
|
+
</section>
|
|
1795
|
+
|
|
1796
|
+
<section class="demo-section">
|
|
1797
|
+
<h2>Live Demo</h2>
|
|
1798
|
+
<div class="demo-container">
|
|
1799
|
+
<!-- Basic List Demo -->
|
|
1800
|
+
<div class="demo-example">
|
|
1801
|
+
<h3>Basic List</h3>
|
|
1802
|
+
<div class="list-container">
|
|
1803
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1804
|
+
[(items)]="basicItems"
|
|
1805
|
+
[acceptDragSameGroup]="true">
|
|
1806
|
+
@for (item of basicItems; track item) {
|
|
1807
|
+
<div class="list-item"
|
|
1808
|
+
LibsUiDragItemDirective>
|
|
1809
|
+
<span class="item-icon">📋</span>
|
|
1810
|
+
<span class="item-text">{{ item }}</span>
|
|
1811
|
+
</div>
|
|
1812
|
+
}
|
|
1813
|
+
</div>
|
|
1814
|
+
</div>
|
|
1815
|
+
</div>
|
|
1816
|
+
|
|
1817
|
+
<!-- Kanban Board Demo -->
|
|
1818
|
+
<div class="demo-example">
|
|
1819
|
+
<h3>Kanban Board</h3>
|
|
1820
|
+
<div class="kanban-board">
|
|
1821
|
+
@for (column of columns; track column) {
|
|
1822
|
+
<div class="kanban-column"
|
|
1823
|
+
LibsUiComponentsDragContainerDirective
|
|
1824
|
+
[(items)]="column.items"
|
|
1825
|
+
[groupName]="column.id"
|
|
1826
|
+
[dropToGroupName]="columnsIds"
|
|
1827
|
+
[acceptDragSameGroup]="true">
|
|
1828
|
+
<h4>{{ column.title }}</h4>
|
|
1829
|
+
@for (item of column.items; track item) {
|
|
1830
|
+
<div class="kanban-item"
|
|
1831
|
+
LibsUiDragItemDirective>
|
|
1832
|
+
<div class="kanban-item-header">
|
|
1833
|
+
<span class="item-title">{{ item.title }}</span>
|
|
1834
|
+
<span class="item-status" [class]="'status-' + item.status">
|
|
1835
|
+
{{ item.status }}
|
|
1836
|
+
</span>
|
|
1837
|
+
</div>
|
|
1838
|
+
<p class="item-description">{{ item.description }}</p>
|
|
1839
|
+
</div>
|
|
1840
|
+
}
|
|
1841
|
+
</div>
|
|
1842
|
+
}
|
|
1843
|
+
</div>
|
|
1844
|
+
</div>
|
|
1845
|
+
|
|
1846
|
+
<!-- Nested Containers Demo -->
|
|
1847
|
+
<div class="demo-example">
|
|
1848
|
+
<h3>Nested Containers</h3>
|
|
1849
|
+
<div class="nested-container">
|
|
1850
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1851
|
+
[(items)]="nestedItems"
|
|
1852
|
+
[groupName]="'parent'"
|
|
1853
|
+
[acceptDragSameGroup]="true">
|
|
1854
|
+
@for (item of nestedItems; track item) {
|
|
1855
|
+
<div class="nested-item"
|
|
1856
|
+
LibsUiDragItemDirective>
|
|
1857
|
+
<div class="nested-item-header">
|
|
1858
|
+
<span class="item-title">{{ item.title }}</span>
|
|
1859
|
+
</div>
|
|
1860
|
+
<div class="nested-item-content">
|
|
1861
|
+
<div LibsUiComponentsDragContainerDirective
|
|
1862
|
+
[(items)]="item.subItems"
|
|
1863
|
+
[groupName]="'child'"
|
|
1864
|
+
[acceptDragSameGroup]="true">
|
|
1865
|
+
@for (subItem of item.subItems; track subItem) {
|
|
1866
|
+
<div class="sub-item"
|
|
1867
|
+
LibsUiDragItemDirective>
|
|
1868
|
+
{{ subItem }}
|
|
1869
|
+
</div>
|
|
1870
|
+
}
|
|
1871
|
+
</div>
|
|
1872
|
+
</div>
|
|
1873
|
+
</div>
|
|
1874
|
+
}
|
|
1875
|
+
</div>
|
|
1876
|
+
</div>
|
|
1877
|
+
</div>
|
|
1878
|
+
</div>
|
|
1879
|
+
</section>
|
|
1880
|
+
|
|
1881
|
+
<section class="api-doc-section">
|
|
1882
|
+
<h2>API Documentation</h2>
|
|
1883
|
+
|
|
1884
|
+
<h3>Inputs</h3>
|
|
1885
|
+
<div class="table-container">
|
|
1886
|
+
<table class="api-table">
|
|
1887
|
+
<thead>
|
|
1888
|
+
<tr>
|
|
1889
|
+
<th>Name</th>
|
|
1890
|
+
<th>Type</th>
|
|
1891
|
+
<th>Default</th>
|
|
1892
|
+
<th>Description</th>
|
|
1893
|
+
</tr>
|
|
1894
|
+
</thead>
|
|
1895
|
+
<tbody>
|
|
1896
|
+
@for (input of inputsDoc; track input.name) {
|
|
1897
|
+
<tr>
|
|
1898
|
+
<td><code>{{input.name}}</code></td>
|
|
1899
|
+
<td><code>{{input.type}}</code></td>
|
|
1900
|
+
<td>{{input.default}}</td>
|
|
1901
|
+
<td>{{input.description}}</td>
|
|
1902
|
+
</tr>
|
|
1903
|
+
}
|
|
1904
|
+
</tbody>
|
|
1905
|
+
</table>
|
|
1906
|
+
</div>
|
|
1907
|
+
|
|
1908
|
+
<h3>Outputs</h3>
|
|
1909
|
+
<div class="table-container">
|
|
1910
|
+
<table class="api-table">
|
|
1911
|
+
<thead>
|
|
1912
|
+
<tr>
|
|
1913
|
+
<th>Name</th>
|
|
1914
|
+
<th>Type</th>
|
|
1915
|
+
<th>Description</th>
|
|
1916
|
+
</tr>
|
|
1917
|
+
</thead>
|
|
1918
|
+
<tbody>
|
|
1919
|
+
@for (output of outputsDoc; track output.name) {
|
|
1920
|
+
<tr>
|
|
1921
|
+
<td><code>{{output.name}}</code></td>
|
|
1922
|
+
<td><code>{{output.type}}</code></td>
|
|
1923
|
+
<td>{{output.description}}</td>
|
|
1924
|
+
</tr>
|
|
1925
|
+
}
|
|
1926
|
+
</tbody>
|
|
1927
|
+
</table>
|
|
1928
|
+
</div>
|
|
1929
|
+
</section>
|
|
1930
|
+
|
|
1931
|
+
<section class="interfaces-section">
|
|
1932
|
+
<h2>Interfaces</h2>
|
|
1933
|
+
<div class="interface-docs">
|
|
1934
|
+
@for (interfaceItem of interfacesDoc; track interfaceItem.name) {
|
|
1935
|
+
<div class="interface-item">
|
|
1936
|
+
<h3>{{interfaceItem.name}}</h3>
|
|
1937
|
+
<pre><code>{{interfaceItem.code}}</code></pre>
|
|
1938
|
+
<p>{{interfaceItem.description}}</p>
|
|
1939
|
+
</div>
|
|
1940
|
+
}
|
|
1941
|
+
</div>
|
|
1942
|
+
</section>
|
|
1943
|
+
|
|
1944
|
+
<section class="features-section">
|
|
1945
|
+
<h2>Features</h2>
|
|
1946
|
+
<ul>
|
|
1947
|
+
@for (feature of features; track feature.id) {
|
|
1948
|
+
<li>
|
|
1949
|
+
<span class="feature-icon">{{feature.icon}}</span>
|
|
1950
|
+
<div class="feature-info">
|
|
1951
|
+
<h3>{{feature.title}}</h3>
|
|
1952
|
+
<p>{{feature.description}}</p>
|
|
1953
|
+
</div>
|
|
1954
|
+
</li>
|
|
1955
|
+
}
|
|
1956
|
+
</ul>
|
|
1957
|
+
</section>
|
|
1958
|
+
|
|
1959
|
+
<section class="usage-section">
|
|
1960
|
+
<h2>Usage</h2>
|
|
1961
|
+
<div class="code-examples">
|
|
1962
|
+
@for (example of codeExamples; track example.id) {
|
|
1963
|
+
<div class="code-example">
|
|
1964
|
+
<h3>{{example.title}}</h3>
|
|
1965
|
+
<pre><code [innerHTML]="example.code"></code></pre>
|
|
1966
|
+
</div>
|
|
1967
|
+
}
|
|
1968
|
+
</div>
|
|
1969
|
+
</section>
|
|
1970
|
+
</main>
|
|
1971
|
+
</div>
|
|
1972
|
+
`, styles: [".page-container{max-width:1200px;margin:0 auto;padding:20px;font-family:Segoe UI,Tahoma,Geneva,Verdana,sans-serif;line-height:1.6;color:#333}header{text-align:center;padding:40px 0;background-color:#fff;border-radius:8px;margin-bottom:30px;box-shadow:0 2px 5px #0000001a}header h1{font-size:2.5rem;color:#2c3e50;margin-bottom:10px}header p{font-size:1.2rem;color:#7f8c8d}section{background-color:#fff;border-radius:8px;padding:30px;margin-bottom:30px;box-shadow:0 2px 5px #0000001a}h2{font-size:1.8rem;color:#2c3e50;margin-bottom:20px;padding-bottom:10px;border-bottom:2px solid #ecf0f1}h3{font-size:1.4rem;color:#34495e;margin-bottom:15px}h4{font-size:1.2rem;color:#34495e;margin-bottom:10px}p{margin-bottom:15px}code{font-family:Courier New,Courier,monospace;background-color:#f7f7f7;padding:2px 5px;border-radius:3px;font-size:.9em}pre{background-color:#f7f7f7;padding:15px;border-radius:5px;overflow-x:auto;margin-bottom:20px;display:flex;align-items:center;justify-content:space-between}pre code{background-color:transparent;padding:0}.installation-section .install-command{position:relative;margin-bottom:20px}.installation-section .copy-button{position:absolute;top:10px;right:10px;background:#3498db;color:#fff;border:none;border-radius:4px;padding:5px 10px;font-size:.9rem;cursor:pointer;transition:background .2s}.installation-section .copy-button:hover{background:#2980b9}.demo-container{display:grid;grid-template-columns:1fr;gap:30px}.demo-example{background:#f7f7f7;padding:20px;border-radius:8px;margin-bottom:20px}.list-container{max-width:400px;margin:20px auto}.list-item{padding:12px;margin:8px 0;background:#fff;border:1px solid #e0e0e0;border-radius:6px;display:flex;align-items:center;transition:transform .2s,box-shadow .2s}.list-item:hover{transform:translateY(-2px);box-shadow:0 4px 8px #0000001a}.item-icon{margin-right:12px;font-size:1.2em}.kanban-board{display:flex;gap:20px;padding:20px;overflow-x:auto}.kanban-column{flex:1;min-width:300px;background:#f5f5f5;padding:15px;border-radius:8px}.kanban-item{background:#fff;padding:12px;margin:8px 0;border-radius:6px;box-shadow:0 1px 3px #0000001a}.kanban-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.item-title{font-weight:500}.item-status{padding:4px 8px;border-radius:4px;font-size:.8em}.status-todo{background:#ffebee;color:#c62828}.status-in-progress{background:#fff3e0;color:#ef6c00}.status-done{background:#e8f5e9;color:#2e7d32}.item-description{font-size:.9em;color:#666}.nested-container{max-width:800px;margin:0 auto}.nested-item{background:#fff;border:1px solid #e0e0e0;border-radius:8px;margin:12px 0;overflow:hidden}.nested-item-header{padding:12px;background:#f5f5f5;border-bottom:1px solid #e0e0e0}.nested-item-content{padding:12px}.sub-item{padding:8px;margin:4px 0;background:#f9f9f9;border:1px solid #e0e0e0;border-radius:4px}.api-doc-section{margin-bottom:40px}.table-container{overflow-x:auto;margin-bottom:30px}.api-table{width:100%;border-collapse:collapse;margin-bottom:20px}.api-table th,.api-table td{padding:12px 15px;text-align:left;border-bottom:1px solid #e1e1e1}.api-table th{background-color:#f5f5f5;font-weight:700}.api-table tbody tr:hover{background-color:#f9f9f9}.features-section ul{list-style:none}.features-section li{display:flex;margin-bottom:25px;align-items:flex-start}.feature-icon{font-size:2rem;margin-right:20px;min-width:40px;text-align:center}.feature-info{flex:1}.code-examples{display:grid;grid-template-columns:1fr;gap:20px}@media (min-width: 768px){.code-examples{grid-template-columns:repeat(2,1fr)}}@media (min-width: 992px){.code-examples{grid-template-columns:repeat(3,1fr)}}.code-example{border:1px solid #ecf0f1;border-radius:5px;padding:15px}@media (max-width: 768px){header{padding:30px 0}header h1{font-size:2rem}section{padding:20px}.kanban-board{flex-direction:column}.kanban-column{min-width:100%}.feature-icon{font-size:1.5rem;margin-right:15px}}\n"] }]
|
|
1973
|
+
}] });
|
|
1974
|
+
|
|
1175
1975
|
/**
|
|
1176
1976
|
* Generated bundle index. Do not edit.
|
|
1177
1977
|
*/
|
|
1178
1978
|
|
|
1179
|
-
export { LibsUiComponentsDragContainerDirective, LibsUiComponentsDragScrollDirective, LibsUiDragItemDirective, LibsUiDragItemInContainerVirtualScrollDirective };
|
|
1979
|
+
export { LibsUiComponentsDragContainerDirective, LibsUiComponentsDragScrollDirective, LibsUiDragDropDemoComponent, LibsUiDragItemDirective, LibsUiDragItemInContainerVirtualScrollDirective };
|
|
1180
1980
|
//# sourceMappingURL=libs-ui-components-drag-drop.mjs.map
|