@libs-ui/components-drag-drop 0.1.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +451 -0
- package/defines/css.define.d.ts +4 -0
- package/demo/demo.component.d.ts +56 -0
- package/drag-drop.directive.d.ts +39 -0
- package/drag-drop.service.d.ts +45 -0
- package/drag-item-in-container-virtual-scroll.directive.d.ts +25 -0
- package/drag-item.directive.d.ts +30 -0
- package/drag-scroll.directive.d.ts +24 -0
- package/esm2022/defines/css.define.mjs +104 -0
- package/esm2022/demo/demo.component.mjs +833 -0
- package/esm2022/drag-drop.directive.mjs +482 -0
- package/esm2022/drag-drop.service.mjs +96 -0
- package/esm2022/drag-item-in-container-virtual-scroll.directive.mjs +134 -0
- package/esm2022/drag-item.directive.mjs +267 -0
- package/esm2022/drag-scroll.directive.mjs +144 -0
- package/esm2022/index.mjs +7 -0
- package/esm2022/interfaces/event.interface.mjs +2 -0
- package/esm2022/libs-ui-components-drag-drop.mjs +5 -0
- package/fesm2022/libs-ui-components-drag-drop.mjs +2043 -0
- package/fesm2022/libs-ui-components-drag-drop.mjs.map +1 -0
- package/index.d.ts +6 -0
- package/interfaces/event.interface.d.ts +60 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
# Drag and Drop Component Documentation
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Drag and Drop component provides a powerful and flexible way to implement drag and drop functionality in your Angular applications. It supports various scenarios including container-to-container dragging, virtual scrolling, and custom drag boundaries.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @libs-ui/drag-drop
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Basic Implementation
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { LibsUiComponentsDragContainerDirective, LibsUiDragItemDirective } from '@libs-ui/drag-drop';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'app-drag-drop-demo',
|
|
22
|
+
template: `
|
|
23
|
+
<div
|
|
24
|
+
LibsUiComponentsDragContainerDirective
|
|
25
|
+
[items]="items">
|
|
26
|
+
<div
|
|
27
|
+
*ngFor="let item of items"
|
|
28
|
+
LibsUiDragItemDirective
|
|
29
|
+
[item]="item">
|
|
30
|
+
{{ item.name }}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`,
|
|
34
|
+
standalone: true,
|
|
35
|
+
imports: [LibsUiComponentsDragContainerDirective, LibsUiDragItemDirective],
|
|
36
|
+
})
|
|
37
|
+
export class DragDropDemoComponent {
|
|
38
|
+
items = [
|
|
39
|
+
{ id: 1, name: 'Item 1' },
|
|
40
|
+
{ id: 2, name: 'Item 2' },
|
|
41
|
+
{ id: 3, name: 'Item 3' },
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
### 1. Container-to-Container Drag
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
@Component({
|
|
52
|
+
template: `
|
|
53
|
+
<div class="container">
|
|
54
|
+
<h3>Source</h3>
|
|
55
|
+
<div LibsUiComponentsDragContainerDirective
|
|
56
|
+
[items]="sourceItems"
|
|
57
|
+
[groupName]="'source'"
|
|
58
|
+
[dropToGroupName]="['target']">
|
|
59
|
+
<div *ngFor="let item of sourceItems"
|
|
60
|
+
LibsUiDragItemDirective
|
|
61
|
+
[item]="item">
|
|
62
|
+
{{ item.name }}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="container">
|
|
68
|
+
<h3>Target</h3>
|
|
69
|
+
<div LibsUiComponentsDragContainerDirective
|
|
70
|
+
[items]="targetItems"
|
|
71
|
+
[groupName]="'target'"
|
|
72
|
+
[dropToGroupName]="['source']">
|
|
73
|
+
<div *ngFor="let item of targetItems"
|
|
74
|
+
LibsUiDragItemDirective
|
|
75
|
+
[item]="item">
|
|
76
|
+
{{ item.name }}
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
`,
|
|
81
|
+
styles: [`
|
|
82
|
+
.container {
|
|
83
|
+
border: 1px solid #ccc;
|
|
84
|
+
padding: 10px;
|
|
85
|
+
margin: 10px;
|
|
86
|
+
min-height: 200px;
|
|
87
|
+
}
|
|
88
|
+
`]
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 2. Virtual Scrolling Support
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
@Component({
|
|
96
|
+
template: `
|
|
97
|
+
<virtual-scroller [items]="items">
|
|
98
|
+
<div LibsUiComponentsDragContainerDirective [items]="items">
|
|
99
|
+
<div *ngFor="let item of items"
|
|
100
|
+
LibsUiDragItemDirective
|
|
101
|
+
[item]="item"
|
|
102
|
+
[itemInContainerVirtualScroll]="true"
|
|
103
|
+
[fieldId]="'id'">
|
|
104
|
+
{{ item.name }}
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</virtual-scroller>
|
|
108
|
+
`
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 3. Custom Drag Boundaries
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
@Component({
|
|
116
|
+
template: `
|
|
117
|
+
<div class="boundary-container">
|
|
118
|
+
<div LibsUiComponentsDragContainerDirective
|
|
119
|
+
[items]="items"
|
|
120
|
+
[dragBoundary]="true">
|
|
121
|
+
<div *ngFor="let item of items"
|
|
122
|
+
LibsUiDragItemDirective
|
|
123
|
+
[item]="item"
|
|
124
|
+
[dragBoundary]="true">
|
|
125
|
+
{{ item.name }}
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
`,
|
|
130
|
+
styles: [`
|
|
131
|
+
.boundary-container {
|
|
132
|
+
position: relative;
|
|
133
|
+
width: 500px;
|
|
134
|
+
height: 500px;
|
|
135
|
+
border: 2px solid #333;
|
|
136
|
+
}
|
|
137
|
+
`]
|
|
138
|
+
})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Configuration Options
|
|
142
|
+
|
|
143
|
+
### Container Directive
|
|
144
|
+
|
|
145
|
+
| Property | Type | Default | Description |
|
|
146
|
+
| ---------------------- | ------------------------------ | ------------------------- | ---------------------------- |
|
|
147
|
+
| `mode` | 'move' \| 'copy' \| 'deepCopy' | 'move' | Drag operation mode |
|
|
148
|
+
| `directionDrag` | 'horizontal' \| 'vertical' | undefined | Drag direction |
|
|
149
|
+
| `groupName` | string | 'groupDragAndDropDefault' | Group identifier |
|
|
150
|
+
| `dropToGroupName` | string[] | null | Allowed drop targets |
|
|
151
|
+
| `disableDragContainer` | boolean | false | Disable drag functionality |
|
|
152
|
+
| `placeholder` | boolean | true | Show placeholder during drag |
|
|
153
|
+
|
|
154
|
+
### Item Directive
|
|
155
|
+
|
|
156
|
+
| Property | Type | Default | Description |
|
|
157
|
+
| ------------------------------ | ------- | --------- | ------------------------------------- |
|
|
158
|
+
| `fieldId` | string | '' | Item identifier field |
|
|
159
|
+
| `item` | any | undefined | Item data |
|
|
160
|
+
| `itemInContainerVirtualScroll` | boolean | false | Enable virtual scroll support |
|
|
161
|
+
| `dragBoundary` | boolean | false | Restrict drag to container boundaries |
|
|
162
|
+
| `zIndex` | number | 1300 | Drag element z-index |
|
|
163
|
+
|
|
164
|
+
## Events
|
|
165
|
+
|
|
166
|
+
### Container Events
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
@Component({
|
|
170
|
+
template: `
|
|
171
|
+
<div LibsUiComponentsDragContainerDirective
|
|
172
|
+
(outDragStartContainer)="onDragStart($event)"
|
|
173
|
+
(outDragOverContainer)="onDragOver($event)"
|
|
174
|
+
(outDragLeaveContainer)="onDragLeave($event)"
|
|
175
|
+
(outDragEndContainer)="onDragEnd($event)"
|
|
176
|
+
(outDroppedContainer)="onDrop($event)">
|
|
177
|
+
<!-- Items -->
|
|
178
|
+
</div>
|
|
179
|
+
`
|
|
180
|
+
})
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Item Events
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
@Component({
|
|
187
|
+
template: `
|
|
188
|
+
<div LibsUiDragItemDirective
|
|
189
|
+
(outDragStart)="onItemDragStart($event)"
|
|
190
|
+
(outDragOver)="onItemDragOver($event)"
|
|
191
|
+
(outDragLeave)="onItemDragLeave($event)"
|
|
192
|
+
(outDragEnd)="onItemDragEnd($event)"
|
|
193
|
+
(outDropped)="onItemDrop($event)">
|
|
194
|
+
<!-- Item content -->
|
|
195
|
+
</div>
|
|
196
|
+
`
|
|
197
|
+
})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Interfaces
|
|
201
|
+
|
|
202
|
+
### Event Interfaces
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
interface IDragging {
|
|
206
|
+
mousePosition: IMousePosition;
|
|
207
|
+
elementDrag: HTMLElement;
|
|
208
|
+
elementKeepContainer?: boolean;
|
|
209
|
+
itemDragInfo?: IItemDragInfo;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
interface IDragStart {
|
|
213
|
+
mousePosition: IMousePosition;
|
|
214
|
+
elementDrag: HTMLElement;
|
|
215
|
+
itemDragInfo?: IItemDragInfo;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
interface IDragOver {
|
|
219
|
+
mousePosition: IMousePosition;
|
|
220
|
+
elementDrag: HTMLElement;
|
|
221
|
+
elementDragOver: HTMLElement;
|
|
222
|
+
itemDragInfo?: IItemDragInfo;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
interface IDragLeave {
|
|
226
|
+
elementDrag: HTMLElement;
|
|
227
|
+
elementDragLeave: HTMLElement;
|
|
228
|
+
itemDragInfo?: IItemDragInfo;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
interface IDragEnd {
|
|
232
|
+
mousePosition: IMousePosition;
|
|
233
|
+
elementDrag: HTMLElement;
|
|
234
|
+
itemDragInfo?: IItemDragInfo;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface IDrop {
|
|
238
|
+
elementDrag: HTMLElement;
|
|
239
|
+
elementDrop: HTMLElement;
|
|
240
|
+
itemDragInfo?: IItemDragInfo;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface IItemDragInfo {
|
|
244
|
+
item: object;
|
|
245
|
+
itemsMove?: WritableSignal<Array<unknown>>;
|
|
246
|
+
indexDrag?: number;
|
|
247
|
+
indexDrop?: number;
|
|
248
|
+
itemsDrag: WritableSignal<Array<unknown>>;
|
|
249
|
+
itemsDrop?: WritableSignal<Array<unknown>>;
|
|
250
|
+
containerDrag?: HTMLElement;
|
|
251
|
+
containerDrop?: HTMLElement;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface IDragItemInContainerVirtualScroll {
|
|
255
|
+
itemDragInfo?: IItemDragInfo;
|
|
256
|
+
elementDrag: HTMLElement;
|
|
257
|
+
distanceStartElementAndMouseTop: number;
|
|
258
|
+
distanceStartElementAndMouseLeft: number;
|
|
259
|
+
elementContainer?: HTMLElement;
|
|
260
|
+
dragBoundary?: boolean;
|
|
261
|
+
dragBoundaryAcceptMouseLeaveContainer?: boolean;
|
|
262
|
+
ignoreStopEvent?: boolean;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
interface IMousePosition {
|
|
266
|
+
clientX: number;
|
|
267
|
+
clientY: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface IDragDropFunctionControlEvent {
|
|
271
|
+
setAttributeElementAndItemDrag: () => Promise<void>;
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## Styling
|
|
276
|
+
|
|
277
|
+
### Default Classes
|
|
278
|
+
|
|
279
|
+
```css
|
|
280
|
+
/* Container */
|
|
281
|
+
.libs-ui-drag-drop-container {
|
|
282
|
+
position: relative;
|
|
283
|
+
min-height: 100px;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* Item */
|
|
287
|
+
.libs-ui-drag-drop-item {
|
|
288
|
+
cursor: move;
|
|
289
|
+
transition: transform 0.2s;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/* Dragging */
|
|
293
|
+
.libs-ui-drag-drop-item-dragging {
|
|
294
|
+
opacity: 0.8;
|
|
295
|
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* Placeholder */
|
|
299
|
+
.libs-ui-drag-drop-item-placeholder {
|
|
300
|
+
background: #f0f0f0;
|
|
301
|
+
border: 2px dashed #ccc;
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Custom Styling
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
@Component({
|
|
309
|
+
template: `
|
|
310
|
+
<div
|
|
311
|
+
LibsUiComponentsDragContainerDirective
|
|
312
|
+
[stylesOverride]="customStyles">
|
|
313
|
+
<!-- Items -->
|
|
314
|
+
</div>
|
|
315
|
+
`,
|
|
316
|
+
})
|
|
317
|
+
export class CustomStyledComponent {
|
|
318
|
+
customStyles = [
|
|
319
|
+
{
|
|
320
|
+
className: 'custom-container',
|
|
321
|
+
styles: `
|
|
322
|
+
.custom-container {
|
|
323
|
+
background: #f5f5f5;
|
|
324
|
+
border-radius: 8px;
|
|
325
|
+
padding: 15px;
|
|
326
|
+
}
|
|
327
|
+
`,
|
|
328
|
+
},
|
|
329
|
+
];
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Best Practices
|
|
334
|
+
|
|
335
|
+
1. **Performance Optimization**
|
|
336
|
+
- Use virtual scrolling for lists with more than 100 items
|
|
337
|
+
- Implement proper event throttling
|
|
338
|
+
- Clean up event listeners in ngOnDestroy
|
|
339
|
+
|
|
340
|
+
2. **User Experience**
|
|
341
|
+
- Provide clear visual feedback during drag operations
|
|
342
|
+
- Implement smooth animations
|
|
343
|
+
- Handle edge cases (container boundaries, scrolling)
|
|
344
|
+
|
|
345
|
+
3. **Accessibility**
|
|
346
|
+
- Ensure keyboard navigation support
|
|
347
|
+
- Provide proper ARIA labels
|
|
348
|
+
- Support screen readers
|
|
349
|
+
|
|
350
|
+
## Troubleshooting
|
|
351
|
+
|
|
352
|
+
### Common Issues
|
|
353
|
+
|
|
354
|
+
1. **Drag Not Working**
|
|
355
|
+
- Verify container and item configurations
|
|
356
|
+
- Check event bindings
|
|
357
|
+
- Ensure proper group settings
|
|
358
|
+
|
|
359
|
+
2. **Performance Issues**
|
|
360
|
+
- Implement virtual scrolling
|
|
361
|
+
- Use event throttling
|
|
362
|
+
- Optimize event handlers
|
|
363
|
+
|
|
364
|
+
3. **Container Boundaries**
|
|
365
|
+
- Verify dragBoundary settings
|
|
366
|
+
- Check container dimensions
|
|
367
|
+
- Ensure proper event handling
|
|
368
|
+
|
|
369
|
+
## Examples
|
|
370
|
+
|
|
371
|
+
### Basic List
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
@Component({
|
|
375
|
+
template: `
|
|
376
|
+
<div class="list-container">
|
|
377
|
+
<div LibsUiComponentsDragContainerDirective [items]="items">
|
|
378
|
+
<div *ngFor="let item of items"
|
|
379
|
+
class="list-item"
|
|
380
|
+
LibsUiDragItemDirective
|
|
381
|
+
[item]="item">
|
|
382
|
+
<span class="item-icon">📋</span>
|
|
383
|
+
<span class="item-text">{{ item.name }}</span>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
</div>
|
|
387
|
+
`,
|
|
388
|
+
styles: [`
|
|
389
|
+
.list-container {
|
|
390
|
+
max-width: 400px;
|
|
391
|
+
margin: 20px auto;
|
|
392
|
+
}
|
|
393
|
+
.list-item {
|
|
394
|
+
padding: 10px;
|
|
395
|
+
margin: 5px 0;
|
|
396
|
+
background: white;
|
|
397
|
+
border: 1px solid #ddd;
|
|
398
|
+
border-radius: 4px;
|
|
399
|
+
display: flex;
|
|
400
|
+
align-items: center;
|
|
401
|
+
}
|
|
402
|
+
.item-icon {
|
|
403
|
+
margin-right: 10px;
|
|
404
|
+
}
|
|
405
|
+
`]
|
|
406
|
+
})
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Kanban Board
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
@Component({
|
|
413
|
+
template: `
|
|
414
|
+
<div class="kanban-board">
|
|
415
|
+
<div *ngFor="let column of columns"
|
|
416
|
+
class="kanban-column"
|
|
417
|
+
LibsUiComponentsDragContainerDirective
|
|
418
|
+
[items]="column.items"
|
|
419
|
+
[groupName]="column.id">
|
|
420
|
+
<h3>{{ column.title }}</h3>
|
|
421
|
+
<div *ngFor="let item of column.items"
|
|
422
|
+
class="kanban-item"
|
|
423
|
+
LibsUiDragItemDirective
|
|
424
|
+
[item]="item">
|
|
425
|
+
{{ item.title }}
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
</div>
|
|
429
|
+
`,
|
|
430
|
+
styles: [`
|
|
431
|
+
.kanban-board {
|
|
432
|
+
display: flex;
|
|
433
|
+
gap: 20px;
|
|
434
|
+
padding: 20px;
|
|
435
|
+
}
|
|
436
|
+
.kanban-column {
|
|
437
|
+
flex: 1;
|
|
438
|
+
background: #f5f5f5;
|
|
439
|
+
padding: 15px;
|
|
440
|
+
border-radius: 8px;
|
|
441
|
+
}
|
|
442
|
+
.kanban-item {
|
|
443
|
+
background: white;
|
|
444
|
+
padding: 10px;
|
|
445
|
+
margin: 5px 0;
|
|
446
|
+
border-radius: 4px;
|
|
447
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
448
|
+
}
|
|
449
|
+
`]
|
|
450
|
+
})
|
|
451
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
interface Task {
|
|
3
|
+
id: number;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
status: 'todo' | 'in-progress' | 'done';
|
|
7
|
+
}
|
|
8
|
+
interface Column {
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
items: Task[];
|
|
12
|
+
}
|
|
13
|
+
export declare class LibsUiDragDropDemoComponent {
|
|
14
|
+
basicItems: string[];
|
|
15
|
+
columnsIds: string[];
|
|
16
|
+
columns: Column[];
|
|
17
|
+
nestedItems: {
|
|
18
|
+
id: number;
|
|
19
|
+
title: string;
|
|
20
|
+
subItems: string[];
|
|
21
|
+
}[];
|
|
22
|
+
inputsDoc: {
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
default: string;
|
|
26
|
+
description: string;
|
|
27
|
+
}[];
|
|
28
|
+
outputsDoc: {
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
}[];
|
|
33
|
+
interfacesDoc: {
|
|
34
|
+
name: string;
|
|
35
|
+
code: string;
|
|
36
|
+
description: string;
|
|
37
|
+
}[];
|
|
38
|
+
features: {
|
|
39
|
+
id: number;
|
|
40
|
+
icon: string;
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
}[];
|
|
44
|
+
codeExamples: {
|
|
45
|
+
id: number;
|
|
46
|
+
title: string;
|
|
47
|
+
code: string;
|
|
48
|
+
}[];
|
|
49
|
+
/**
|
|
50
|
+
* Copy text to clipboard
|
|
51
|
+
*/
|
|
52
|
+
copyToClipboard(text: string): void;
|
|
53
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDragDropDemoComponent, never>;
|
|
54
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LibsUiDragDropDemoComponent, "lib-drag-drop-demo", never, {}, {}, never, never, true, never>;
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AfterViewInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { LibsUiComponentsDragScrollDirective } from './drag-scroll.directive';
|
|
3
|
+
import { IDragDropFunctionControlEvent, IDragEnd, IDragLeave, IDragOver, IDragStart, IDrop } from './interfaces/event.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class LibsUiComponentsDragContainerDirective extends LibsUiComponentsDragScrollDirective implements AfterViewInit, OnDestroy {
|
|
6
|
+
private groupID;
|
|
7
|
+
private isDragOver;
|
|
8
|
+
private cdr;
|
|
9
|
+
readonly disableDragContainer: import("@angular/core").InputSignal<boolean | undefined>;
|
|
10
|
+
readonly mode: import("@angular/core").InputSignalWithTransform<string, "move" | "copy">;
|
|
11
|
+
readonly directionDrag: import("@angular/core").InputSignal<"horizontal" | "vertical" | undefined>;
|
|
12
|
+
readonly viewEncapsulation: import("@angular/core").InputSignalWithTransform<"emulated" | "none", "emulated" | "none" | undefined>;
|
|
13
|
+
readonly acceptDragSameGroup: import("@angular/core").InputSignalWithTransform<boolean, boolean | undefined>;
|
|
14
|
+
readonly placeholder: import("@angular/core").InputSignalWithTransform<boolean, boolean | undefined>;
|
|
15
|
+
readonly groupName: import("@angular/core").InputSignalWithTransform<string, string | undefined>;
|
|
16
|
+
readonly dropToGroupName: import("@angular/core").InputSignal<string[] | null>;
|
|
17
|
+
readonly items: import("@angular/core").ModelSignal<unknown[]>;
|
|
18
|
+
readonly stylesOverride: import("@angular/core").InputSignal<{
|
|
19
|
+
className: string;
|
|
20
|
+
styles: string;
|
|
21
|
+
}[] | undefined>;
|
|
22
|
+
readonly outDragStartContainer: import("@angular/core").OutputEmitterRef<IDragStart>;
|
|
23
|
+
readonly outDragOverContainer: import("@angular/core").OutputEmitterRef<IDragOver>;
|
|
24
|
+
readonly outDragLeaveContainer: import("@angular/core").OutputEmitterRef<IDragLeave>;
|
|
25
|
+
readonly outDragEndContainer: import("@angular/core").OutputEmitterRef<IDragEnd>;
|
|
26
|
+
readonly outDroppedContainer: import("@angular/core").OutputEmitterRef<IDrop>;
|
|
27
|
+
readonly outDroppedContainerEmpty: import("@angular/core").OutputEmitterRef<IDrop>;
|
|
28
|
+
readonly outFunctionControl: import("@angular/core").OutputEmitterRef<IDragDropFunctionControlEvent>;
|
|
29
|
+
constructor();
|
|
30
|
+
ngAfterViewInit(): void;
|
|
31
|
+
get FunctionsControl(): IDragDropFunctionControlEvent;
|
|
32
|
+
private setAttributeElementAndItemDrag;
|
|
33
|
+
private initStyleAndAttribute;
|
|
34
|
+
private setAnimationElementDragOver;
|
|
35
|
+
private setIndexElement;
|
|
36
|
+
private removeAttributes;
|
|
37
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsDragContainerDirective, never>;
|
|
38
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LibsUiComponentsDragContainerDirective, "[LibsUiComponentsDragContainerDirective]", never, { "disableDragContainer": { "alias": "disableDragContainer"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "directionDrag": { "alias": "directionDrag"; "required": false; "isSignal": true; }; "viewEncapsulation": { "alias": "viewEncapsulation"; "required": false; "isSignal": true; }; "acceptDragSameGroup": { "alias": "acceptDragSameGroup"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "groupName": { "alias": "groupName"; "required": false; "isSignal": true; }; "dropToGroupName": { "alias": "dropToGroupName"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": true; "isSignal": true; }; "stylesOverride": { "alias": "stylesOverride"; "required": false; "isSignal": true; }; }, { "items": "itemsChange"; "outDragStartContainer": "outDragStartContainer"; "outDragOverContainer": "outDragOverContainer"; "outDragLeaveContainer": "outDragLeaveContainer"; "outDragEndContainer": "outDragEndContainer"; "outDroppedContainer": "outDroppedContainer"; "outDroppedContainerEmpty": "outDroppedContainerEmpty"; "outFunctionControl": "outFunctionControl"; }, never, never, true, never>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { WritableSignal } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { IDragEnd, IDragItemInContainerVirtualScroll, IDragLeave, IDragOver, IDragStart, IDragging, IDrop, IItemDragInfo } from './interfaces/event.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class MoLibsSharedDragDropService {
|
|
6
|
+
private itemsClick;
|
|
7
|
+
private onDragItemInContainerVirtualScroll;
|
|
8
|
+
private itemDragInfo?;
|
|
9
|
+
private container;
|
|
10
|
+
private targetItemDragFlag;
|
|
11
|
+
private classContainerDefine;
|
|
12
|
+
private classItemDefine;
|
|
13
|
+
private onDragging;
|
|
14
|
+
private onDragStart;
|
|
15
|
+
private onDragEnd;
|
|
16
|
+
private onDragOver;
|
|
17
|
+
private onDragLeave;
|
|
18
|
+
private onDrop;
|
|
19
|
+
private onDropContainer;
|
|
20
|
+
private onItemInit;
|
|
21
|
+
get OnDragItemInContainerVirtualScroll(): Subject<IDragItemInContainerVirtualScroll>;
|
|
22
|
+
set ItemDragInfo(data: IItemDragInfo | undefined);
|
|
23
|
+
get ItemDragInfo(): IItemDragInfo | undefined;
|
|
24
|
+
get Container(): WritableSignal<Map<string, {
|
|
25
|
+
element: HTMLElement;
|
|
26
|
+
elementScroll?: HTMLElement;
|
|
27
|
+
}>>;
|
|
28
|
+
get TargetItemDragFlag(): string;
|
|
29
|
+
get ClassContainerDefine(): string;
|
|
30
|
+
get ClassItemDefine(): string;
|
|
31
|
+
get OnDragging(): Subject<IDragging>;
|
|
32
|
+
get OnDragOver(): Subject<IDragOver>;
|
|
33
|
+
get OnDragLeave(): Subject<IDragLeave>;
|
|
34
|
+
get OnDragStart(): Subject<IDragStart>;
|
|
35
|
+
get OnDragEnd(): Subject<IDragEnd>;
|
|
36
|
+
get OnDropContainer(): Subject<IDrop>;
|
|
37
|
+
get OnDrop(): Subject<IDrop>;
|
|
38
|
+
get OnItemInit(): Subject<string>;
|
|
39
|
+
get ItemClick(): Array<HTMLElement>;
|
|
40
|
+
set ItemClick(item: HTMLElement);
|
|
41
|
+
resetItemClick(): void;
|
|
42
|
+
checkElementOverAcceptElementDrag(groupNameOfContainer: string | null, groupNameOfElementDrag: string | null, groupNameOfDropTo: string | null): boolean;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MoLibsSharedDragDropService, never>;
|
|
44
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MoLibsSharedDragDropService>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AfterViewInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { IBoundingClientRect } from '@libs-ui/interfaces-types';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { MoLibsSharedDragDropService } from './drag-drop.service';
|
|
5
|
+
import { IDragEnd } from './interfaces/event.interface';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class LibsUiDragItemInContainerVirtualScrollDirective implements AfterViewInit, OnDestroy {
|
|
8
|
+
protected onDestroy: Subject<void>;
|
|
9
|
+
readonly outDragEndContainer: import("@angular/core").OutputEmitterRef<IDragEnd>;
|
|
10
|
+
protected dragDropService: MoLibsSharedDragDropService;
|
|
11
|
+
ngAfterViewInit(): void;
|
|
12
|
+
protected getClientPosition(element: HTMLElement, mousePosition: {
|
|
13
|
+
clientX: number;
|
|
14
|
+
clientY: number;
|
|
15
|
+
}, distanceStartElementAndMouseLeft: number, distanceStartElementAndMouseTop: number, dragBoundary?: boolean, elementContainer?: HTMLElement): {
|
|
16
|
+
clientX: number;
|
|
17
|
+
clientY: number;
|
|
18
|
+
elementKeepContainer: boolean;
|
|
19
|
+
viewport: IBoundingClientRect;
|
|
20
|
+
};
|
|
21
|
+
protected updateMouseEventsWhenMoveOverIframe(pointerEvents: 'none' | 'auto'): void;
|
|
22
|
+
ngOnDestroy(): void;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDragItemInContainerVirtualScrollDirective, never>;
|
|
24
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LibsUiDragItemInContainerVirtualScrollDirective, "[LibsUiDragItemInContainerVirtualScrollDirective]", never, {}, { "outDragEndContainer": "outDragEndContainer"; }, never, never, true, never>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AfterViewInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { LibsUiDragItemInContainerVirtualScrollDirective } from './drag-item-in-container-virtual-scroll.directive';
|
|
3
|
+
import { IDragEnd, IDragLeave, IDragOver, IDragStart, IDrop } from './interfaces/event.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class LibsUiDragItemDirective extends LibsUiDragItemInContainerVirtualScrollDirective implements AfterViewInit, OnDestroy {
|
|
6
|
+
private isDragOver;
|
|
7
|
+
private isDragging;
|
|
8
|
+
readonly fieldId: import("@angular/core").InputSignal<string>;
|
|
9
|
+
readonly item: import("@angular/core").InputSignal<any>;
|
|
10
|
+
readonly itemInContainerVirtualScroll: import("@angular/core").InputSignal<boolean | undefined>;
|
|
11
|
+
readonly throttleTimeHandlerDraggingEvent: import("@angular/core").InputSignalWithTransform<number, number | undefined>;
|
|
12
|
+
readonly ignoreStopEvent: import("@angular/core").InputSignal<boolean | undefined>;
|
|
13
|
+
readonly onlyMouseDownStopEvent: import("@angular/core").InputSignal<boolean | undefined>;
|
|
14
|
+
readonly dragRootElement: import("@angular/core").InputSignal<boolean | undefined>;
|
|
15
|
+
readonly dragBoundary: import("@angular/core").InputSignal<boolean | undefined>;
|
|
16
|
+
readonly dragBoundaryAcceptMouseLeaveContainer: import("@angular/core").InputSignal<boolean | undefined>;
|
|
17
|
+
readonly elementContainer: import("@angular/core").InputSignal<HTMLElement | undefined>;
|
|
18
|
+
readonly zIndex: import("@angular/core").InputSignalWithTransform<number, number | undefined>;
|
|
19
|
+
readonly disable: import("@angular/core").InputSignal<boolean | undefined>;
|
|
20
|
+
readonly outDragStart: import("@angular/core").OutputEmitterRef<IDragStart>;
|
|
21
|
+
readonly outDragOver: import("@angular/core").OutputEmitterRef<IDragOver>;
|
|
22
|
+
readonly outDragLeave: import("@angular/core").OutputEmitterRef<IDragLeave>;
|
|
23
|
+
readonly outDragEnd: import("@angular/core").OutputEmitterRef<IDragEnd>;
|
|
24
|
+
readonly outDropped: import("@angular/core").OutputEmitterRef<IDrop>;
|
|
25
|
+
private elementRef;
|
|
26
|
+
constructor();
|
|
27
|
+
ngAfterViewInit(): void;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDragItemDirective, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LibsUiDragItemDirective, "[LibsUiDragItemDirective]", never, { "fieldId": { "alias": "fieldId"; "required": false; "isSignal": true; }; "item": { "alias": "item"; "required": false; "isSignal": true; }; "itemInContainerVirtualScroll": { "alias": "itemInContainerVirtualScroll"; "required": false; "isSignal": true; }; "throttleTimeHandlerDraggingEvent": { "alias": "throttleTimeHandlerDraggingEvent"; "required": false; "isSignal": true; }; "ignoreStopEvent": { "alias": "ignoreStopEvent"; "required": false; "isSignal": true; }; "onlyMouseDownStopEvent": { "alias": "onlyMouseDownStopEvent"; "required": false; "isSignal": true; }; "dragRootElement": { "alias": "dragRootElement"; "required": false; "isSignal": true; }; "dragBoundary": { "alias": "dragBoundary"; "required": false; "isSignal": true; }; "dragBoundaryAcceptMouseLeaveContainer": { "alias": "dragBoundaryAcceptMouseLeaveContainer"; "required": false; "isSignal": true; }; "elementContainer": { "alias": "elementContainer"; "required": false; "isSignal": true; }; "zIndex": { "alias": "zIndex"; "required": false; "isSignal": true; }; "disable": { "alias": "disable"; "required": false; "isSignal": true; }; }, { "outDragStart": "outDragStart"; "outDragOver": "outDragOver"; "outDragLeave": "outDragLeave"; "outDragEnd": "outDragEnd"; "outDropped": "outDropped"; }, never, never, true, never>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import { VirtualScrollerComponent } from '@iharbeck/ngx-virtual-scroller';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { MoLibsSharedDragDropService } from './drag-drop.service';
|
|
5
|
+
import { IDragging } from './interfaces/event.interface';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export declare class LibsUiComponentsDragScrollDirective implements AfterViewInit, OnDestroy {
|
|
8
|
+
private stopScroll;
|
|
9
|
+
private virtualScrollPageInfo;
|
|
10
|
+
protected intervalScrollToElement: import("@angular/core").WritableSignal<number | undefined>;
|
|
11
|
+
protected onDestroy: Subject<void>;
|
|
12
|
+
readonly ignoreAutoScroll: import("@angular/core").InputSignal<boolean | undefined>;
|
|
13
|
+
readonly widthZoneDetect: import("@angular/core").InputSignalWithTransform<number, number | undefined>;
|
|
14
|
+
readonly movementLength: import("@angular/core").InputSignalWithTransform<number, number | undefined>;
|
|
15
|
+
readonly rootElementScroll: import("@angular/core").InputSignal<HTMLElement | undefined>;
|
|
16
|
+
readonly virtualScrollerComponent: import("@angular/core").InputSignal<VirtualScrollerComponent | undefined>;
|
|
17
|
+
protected elementRef: ElementRef<any>;
|
|
18
|
+
protected dragDropService: MoLibsSharedDragDropService;
|
|
19
|
+
ngAfterViewInit(): void;
|
|
20
|
+
protected checkAndScrollElementToPosition(eventDragging: IDragging, ignoreAutoScroll?: boolean): void;
|
|
21
|
+
ngOnDestroy(): void;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsDragScrollDirective, never>;
|
|
23
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<LibsUiComponentsDragScrollDirective, "[LibsUiComponentsDragScrollDirective]", never, { "ignoreAutoScroll": { "alias": "ignoreAutoScroll"; "required": false; "isSignal": true; }; "widthZoneDetect": { "alias": "widthZoneDetect"; "required": false; "isSignal": true; }; "movementLength": { "alias": "movementLength"; "required": false; "isSignal": true; }; "rootElementScroll": { "alias": "rootElementScroll"; "required": false; "isSignal": true; }; "virtualScrollerComponent": { "alias": "virtualScrollerComponent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
24
|
+
}
|