@matechat/ng 17.2.1-alpha.3 → 17.2.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/fesm2022/matechat-ng.mjs +18 -12
- package/fesm2022/matechat-ng.mjs.map +1 -1
- package/index.d.ts +8 -1
- package/package.json +5 -3
package/fesm2022/matechat-ng.mjs
CHANGED
|
@@ -311,7 +311,9 @@ function upload(config) {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
class DropAreaComponent {
|
|
314
|
-
constructor() {
|
|
314
|
+
constructor(renderer, cdr) {
|
|
315
|
+
this.renderer = renderer;
|
|
316
|
+
this.cdr = cdr;
|
|
315
317
|
this.isDisabled = false;
|
|
316
318
|
this.drop = new EventEmitter();
|
|
317
319
|
this.isDragging = false;
|
|
@@ -322,6 +324,7 @@ class DropAreaComponent {
|
|
|
322
324
|
this.dragCounter++;
|
|
323
325
|
if (this.dragCounter === 1) {
|
|
324
326
|
this.isDragging = true;
|
|
327
|
+
this.cdr.detectChanges();
|
|
325
328
|
}
|
|
326
329
|
if (this.container && this.dropAreaEl.nativeElement) {
|
|
327
330
|
if (this.container === document.body) {
|
|
@@ -344,11 +347,13 @@ class DropAreaComponent {
|
|
|
344
347
|
this.dragCounter--;
|
|
345
348
|
if (this.dragCounter === 0) {
|
|
346
349
|
this.isDragging = false;
|
|
350
|
+
this.cdr.detectChanges();
|
|
347
351
|
}
|
|
348
352
|
};
|
|
349
353
|
this.handleDrop = (e) => {
|
|
350
354
|
e.preventDefault();
|
|
351
355
|
this.isDragging = false;
|
|
356
|
+
this.cdr.detectChanges();
|
|
352
357
|
this.dragCounter = 0; // 重置计数器
|
|
353
358
|
if (this.isDisabled)
|
|
354
359
|
return;
|
|
@@ -360,6 +365,7 @@ class DropAreaComponent {
|
|
|
360
365
|
this.onBodyDrop = (e) => {
|
|
361
366
|
e.preventDefault();
|
|
362
367
|
this.isDragging = false;
|
|
368
|
+
this.cdr.detectChanges();
|
|
363
369
|
this.dragCounter = 0;
|
|
364
370
|
};
|
|
365
371
|
}
|
|
@@ -372,28 +378,28 @@ class DropAreaComponent {
|
|
|
372
378
|
}
|
|
373
379
|
}
|
|
374
380
|
ngAfterViewInit() {
|
|
375
|
-
|
|
381
|
+
this.renderer.appendChild(document.body, this.dropAreaEl.nativeElement);
|
|
376
382
|
if (this.getDropContainer) {
|
|
377
383
|
this.container = this.getDropContainer();
|
|
378
384
|
}
|
|
379
|
-
document.body
|
|
380
|
-
document.body
|
|
381
|
-
document.body
|
|
382
|
-
document.body
|
|
385
|
+
this.dragEnterListener = this.renderer.listen(document.body, 'dragenter', this.handleDragEnter);
|
|
386
|
+
this.dragOverListener = this.renderer.listen(document.body, 'dragover', this.handleDragOver);
|
|
387
|
+
this.dragLeaveListener = this.renderer.listen(document.body, 'dragleave', this.handleDragLeave);
|
|
388
|
+
this.dropListener = this.renderer.listen(document.body, 'drop', this.onBodyDrop);
|
|
383
389
|
}
|
|
384
390
|
ngOnDestroy() {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
391
|
+
this.dragEnterListener?.();
|
|
392
|
+
this.dragOverListener?.();
|
|
393
|
+
this.dragLeaveListener?.();
|
|
394
|
+
this.dropListener?.();
|
|
389
395
|
}
|
|
390
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DropAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
396
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DropAreaComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
391
397
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.10", type: DropAreaComponent, isStandalone: true, selector: "mc-drop-area", inputs: { getDropContainer: "getDropContainer", isDisabled: "isDisabled" }, outputs: { drop: "drop" }, viewQueries: [{ propertyName: "dropAreaEl", first: true, predicate: ["dropArea"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div\n #dropArea\n [ngClass]=\"{\n 'mc-attachment-drop-area': true,\n 'hide-drop-area': !isDragging,\n }\"\n (drop)=\"handleDrop($event)\"\n>\n <ng-content />\n</div>\n", styles: [".mc-attachment-drop-area{position:fixed;padding:20px 40px;display:flex;justify-content:center;align-items:center;border:2px dashed var(--devui-brand, #5e7ce0);border-radius:var(--devui-border-radius, 2px);color:var(--devui-text, #252b3a);font-size:var(--devui-font-size, 12px);font-weight:700;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:9999;box-sizing:border-box}.mc-attachment-drop-area.hide-drop-area{display:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
392
398
|
}
|
|
393
399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DropAreaComponent, decorators: [{
|
|
394
400
|
type: Component,
|
|
395
401
|
args: [{ selector: 'mc-drop-area', standalone: true, imports: [CommonModule], template: "<div\n #dropArea\n [ngClass]=\"{\n 'mc-attachment-drop-area': true,\n 'hide-drop-area': !isDragging,\n }\"\n (drop)=\"handleDrop($event)\"\n>\n <ng-content />\n</div>\n", styles: [".mc-attachment-drop-area{position:fixed;padding:20px 40px;display:flex;justify-content:center;align-items:center;border:2px dashed var(--devui-brand, #5e7ce0);border-radius:var(--devui-border-radius, 2px);color:var(--devui-text, #252b3a);font-size:var(--devui-font-size, 12px);font-weight:700;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);z-index:9999;box-sizing:border-box}.mc-attachment-drop-area.hide-drop-area{display:none}\n"] }]
|
|
396
|
-
}], propDecorators: { getDropContainer: [{
|
|
402
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { getDropContainer: [{
|
|
397
403
|
type: Input
|
|
398
404
|
}], isDisabled: [{
|
|
399
405
|
type: Input
|