@matechat/ng 20.2.1-alpha.2 → 20.2.1-alpha.4
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 +21 -21
- package/fesm2022/matechat-ng.mjs.map +1 -1
- package/index.d.ts +8 -5
- 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,15 +365,10 @@ 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
|
}
|
|
366
|
-
get dropAreaClasses() {
|
|
367
|
-
return {
|
|
368
|
-
'mc-attachment-drop-area': true,
|
|
369
|
-
'hide-drop-area': !this.isDragging,
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
372
|
ngOnChanges(changes) {
|
|
373
373
|
if (changes['getDropContainer'] && this.getDropContainer) {
|
|
374
374
|
const newContainer = this.getDropContainer();
|
|
@@ -378,28 +378,28 @@ class DropAreaComponent {
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
ngAfterViewInit() {
|
|
381
|
-
|
|
381
|
+
this.renderer.appendChild(document.body, this.dropAreaEl.nativeElement);
|
|
382
382
|
if (this.getDropContainer) {
|
|
383
383
|
this.container = this.getDropContainer();
|
|
384
384
|
}
|
|
385
|
-
document.body
|
|
386
|
-
document.body
|
|
387
|
-
document.body
|
|
388
|
-
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);
|
|
389
389
|
}
|
|
390
390
|
ngOnDestroy() {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
391
|
+
this.dragEnterListener?.();
|
|
392
|
+
this.dragOverListener?.();
|
|
393
|
+
this.dragLeaveListener?.();
|
|
394
|
+
this.dropListener?.();
|
|
395
395
|
}
|
|
396
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DropAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
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
|
|
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 }); }
|
|
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"] }] }); }
|
|
398
398
|
}
|
|
399
399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DropAreaComponent, decorators: [{
|
|
400
400
|
type: Component,
|
|
401
|
-
args: [{ selector: 'mc-drop-area', standalone: true, imports: [CommonModule], template: "<div
|
|
402
|
-
}], propDecorators: { getDropContainer: [{
|
|
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"] }]
|
|
402
|
+
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], propDecorators: { getDropContainer: [{
|
|
403
403
|
type: Input
|
|
404
404
|
}], isDisabled: [{
|
|
405
405
|
type: Input
|
|
@@ -2970,7 +2970,7 @@ class MarkdownCardFoundation extends BaseFoundation {
|
|
|
2970
2970
|
const thinkClass = thinkOptions?.customClass || 'mc-think-block';
|
|
2971
2971
|
return (content
|
|
2972
2972
|
?.replace('<think>', `<div class="${thinkClass}">`)
|
|
2973
|
-
?.replace('</think>', '\n</div
|
|
2973
|
+
?.replace('</think>', '\n\n</div>\n\n') || '');
|
|
2974
2974
|
};
|
|
2975
2975
|
this.parseTypingContent = (content) => {
|
|
2976
2976
|
const { typingOptions } = this.getProps();
|