cmat 0.0.34 → 0.0.35
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.
|
@@ -9,7 +9,7 @@ import { FieldType as FieldType$1 } from '@ngx-formly/material';
|
|
|
9
9
|
import { CmatCalendarView, CmatDatetimepickerMode, CmatDatetimepickerType } from 'cmat/components/material-datetimepicker';
|
|
10
10
|
import { MatCheckbox } from '@angular/material/checkbox';
|
|
11
11
|
import { MatRadioGroup } from '@angular/material/radio';
|
|
12
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
12
|
+
import { FormControl, FormGroup, UntypedFormGroup } from '@angular/forms';
|
|
13
13
|
import { FormlyFieldSelectProps } from '@ngx-formly/core/select';
|
|
14
14
|
import { CmatSelectTableDataSource, CmatSelectTableRow } from 'cmat/components/select-table';
|
|
15
15
|
import { MatTable } from '@angular/material/table';
|
|
@@ -579,7 +579,7 @@ interface UploadProps extends CustomFormFieldProps {
|
|
|
579
579
|
editMode: boolean;
|
|
580
580
|
autoUpload: boolean;
|
|
581
581
|
}
|
|
582
|
-
declare class CmatUploadTypeComponent extends FieldType<FieldTypeConfig<UploadProps>> {
|
|
582
|
+
declare class CmatUploadTypeComponent extends FieldType<FieldTypeConfig<UploadProps>> implements AfterViewInit {
|
|
583
583
|
defaultOptions: {
|
|
584
584
|
props: {
|
|
585
585
|
fileAlias: string;
|
|
@@ -591,9 +591,12 @@ declare class CmatUploadTypeComponent extends FieldType<FieldTypeConfig<UploadPr
|
|
|
591
591
|
autoUpload: boolean;
|
|
592
592
|
};
|
|
593
593
|
};
|
|
594
|
+
baseGroup: UntypedFormGroup;
|
|
595
|
+
ngAfterViewInit(): void;
|
|
594
596
|
upload(id: string): void;
|
|
595
597
|
remove(id: string): void;
|
|
596
598
|
updateData(i: any): void;
|
|
599
|
+
private _getRootControl;
|
|
597
600
|
static ɵfac: i0.ɵɵFactoryDeclaration<CmatUploadTypeComponent, never>;
|
|
598
601
|
static ɵcmp: i0.ɵɵComponentDeclaration<CmatUploadTypeComponent, "cmat-upload-type", never, {}, {}, never, never, true, never>;
|
|
599
602
|
}
|
|
@@ -602,7 +605,7 @@ interface QuillProps extends CustomFormFieldProps {
|
|
|
602
605
|
fileAlias: string;
|
|
603
606
|
filePath: string;
|
|
604
607
|
}
|
|
605
|
-
declare class CmatQuillTypeComponent extends FieldType<FieldTypeConfig<QuillProps>> implements OnDestroy {
|
|
608
|
+
declare class CmatQuillTypeComponent extends FieldType<FieldTypeConfig<QuillProps>> implements OnDestroy, AfterViewInit {
|
|
606
609
|
private imgInput;
|
|
607
610
|
private videoInput;
|
|
608
611
|
quillModules: QuillModules;
|
|
@@ -612,6 +615,7 @@ declare class CmatQuillTypeComponent extends FieldType<FieldTypeConfig<QuillProp
|
|
|
612
615
|
filePath: string;
|
|
613
616
|
};
|
|
614
617
|
};
|
|
618
|
+
baseGroup: UntypedFormGroup;
|
|
615
619
|
private _fileService;
|
|
616
620
|
private _urlStateConfigService;
|
|
617
621
|
private _changeDetectorRef;
|
|
@@ -621,6 +625,7 @@ declare class CmatQuillTypeComponent extends FieldType<FieldTypeConfig<QuillProp
|
|
|
621
625
|
private _unsubscribeAll;
|
|
622
626
|
constructor();
|
|
623
627
|
ngOnDestroy(): void;
|
|
628
|
+
ngAfterViewInit(): void;
|
|
624
629
|
fileChangeEvent(file: any): void;
|
|
625
630
|
editorCreated(editorInstance: any): void;
|
|
626
631
|
contentChanged(editorInstance: any): void;
|
|
@@ -629,6 +634,7 @@ declare class CmatQuillTypeComponent extends FieldType<FieldTypeConfig<QuillProp
|
|
|
629
634
|
private _dropFileHandler;
|
|
630
635
|
private _upload;
|
|
631
636
|
private _getMediaType;
|
|
637
|
+
private _getRootControl;
|
|
632
638
|
static ɵfac: i0.ɵɵFactoryDeclaration<CmatQuillTypeComponent, never>;
|
|
633
639
|
static ɵcmp: i0.ɵɵComponentDeclaration<CmatQuillTypeComponent, "cmat-quill-type", never, {}, {}, never, never, true, never>;
|
|
634
640
|
}
|
|
@@ -1405,20 +1405,24 @@ class CmatUploadTypeComponent extends FieldType {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
};
|
|
1407
1407
|
}
|
|
1408
|
-
|
|
1409
|
-
if (this.
|
|
1410
|
-
this.
|
|
1408
|
+
ngAfterViewInit() {
|
|
1409
|
+
if (!this.baseGroup)
|
|
1410
|
+
this.baseGroup = this._getRootControl(this.formControl);
|
|
1411
|
+
if (!this.baseGroup.contains('uploadId')) {
|
|
1412
|
+
this.baseGroup.addControl('uploadId', new FormControl([]));
|
|
1413
|
+
this.baseGroup.addControl('removeId', new FormControl([]));
|
|
1411
1414
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1415
|
+
}
|
|
1416
|
+
upload(id) {
|
|
1417
|
+
var rootValue = this.baseGroup.get('uploadId')?.value;
|
|
1418
|
+
if (rootValue) {
|
|
1419
|
+
this.baseGroup.get('uploadId')?.setValue([id, ...rootValue]);
|
|
1414
1420
|
}
|
|
1415
1421
|
}
|
|
1416
1422
|
remove(id) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
else {
|
|
1421
|
-
this.model['removeId'] = [id];
|
|
1423
|
+
var rootValue = this.baseGroup.get('removeId')?.value;
|
|
1424
|
+
if (rootValue) {
|
|
1425
|
+
this.baseGroup.get('removeId')?.setValue([id, ...rootValue]);
|
|
1422
1426
|
}
|
|
1423
1427
|
}
|
|
1424
1428
|
updateData(i) {
|
|
@@ -1435,6 +1439,12 @@ class CmatUploadTypeComponent extends FieldType {
|
|
|
1435
1439
|
return j;
|
|
1436
1440
|
}));
|
|
1437
1441
|
}
|
|
1442
|
+
_getRootControl(baseControl) {
|
|
1443
|
+
if (baseControl.parent) {
|
|
1444
|
+
return this._getRootControl(baseControl.parent);
|
|
1445
|
+
}
|
|
1446
|
+
return baseControl;
|
|
1447
|
+
}
|
|
1438
1448
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CmatUploadTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
1439
1449
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: CmatUploadTypeComponent, isStandalone: true, selector: "cmat-upload-type", usesInheritance: true, ngImport: i0, template: "<cmat-upload-queue [tabindex]=\"props.tabindex\" [fileAlias]=\"props.fileAlias\"\r\n [filePath]=\"props.filePath\" [required]=\"required\" [fileCategory]=\"props.fileCategory\" [multiple]=\"props.multiple\"\r\n [accept]=\"props.accept\" [title]=\"props.label??'\u9644\u4EF6'\" [editMode]=\"props.editMode&&!disabled\" [filesData]=\"formControl.value\"\r\n [autoUpload]=\"props.autoUpload\" (outputUploadIdEvent)=\"upload($event)\" (outputRemoveIdEvent)=\"remove($event)\" (outputFilesDataEvent)=\"updateData($event)\">\r\n</cmat-upload-queue>", styles: [":host{width:100%}\n"], dependencies: [{ kind: "component", type: CmatUploadQueueComponent, selector: "cmat-upload-queue", inputs: ["fileAlias", "filePath", "fileCategory", "required", "autoUpload", "multiple", "accept", "title", "editMode", "filesData"], outputs: ["outputRemoveIdEvent", "outputUploadIdEvent", "outputFilesDataEvent"], exportAs: ["cmatUploadQueue"] }, { kind: "ngmodule", type: ReactiveFormsModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1440
1450
|
}
|
|
@@ -1494,6 +1504,14 @@ class CmatQuillTypeComponent extends FieldType {
|
|
|
1494
1504
|
this._unsubscribeAll.next(void 0);
|
|
1495
1505
|
this._unsubscribeAll.complete();
|
|
1496
1506
|
}
|
|
1507
|
+
ngAfterViewInit() {
|
|
1508
|
+
if (!this.baseGroup)
|
|
1509
|
+
this.baseGroup = this._getRootControl(this.formControl);
|
|
1510
|
+
if (!this.baseGroup.contains('uploadId')) {
|
|
1511
|
+
this.baseGroup.addControl('uploadId', new FormControl([]));
|
|
1512
|
+
this.baseGroup.addControl('removeId', new FormControl([]));
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1497
1515
|
fileChangeEvent(file) {
|
|
1498
1516
|
const fileModel = {
|
|
1499
1517
|
id: null,
|
|
@@ -1542,11 +1560,9 @@ class CmatQuillTypeComponent extends FieldType {
|
|
|
1542
1560
|
}
|
|
1543
1561
|
});
|
|
1544
1562
|
this._imgIds.forEach((i) => {
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
else {
|
|
1549
|
-
this.model['removeId'] = [i];
|
|
1563
|
+
var rootValue = this.baseGroup.get('removeId')?.value;
|
|
1564
|
+
if (rootValue) {
|
|
1565
|
+
this.baseGroup.get('removeId')?.setValue([i, ...rootValue]);
|
|
1550
1566
|
}
|
|
1551
1567
|
});
|
|
1552
1568
|
this._imgIds = arr;
|
|
@@ -1561,11 +1577,9 @@ class CmatQuillTypeComponent extends FieldType {
|
|
|
1561
1577
|
this.fileChangeEvent(fileData.toFile());
|
|
1562
1578
|
}
|
|
1563
1579
|
_upload(id) {
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
else {
|
|
1568
|
-
this.model['uploadId'] = [id];
|
|
1580
|
+
var rootValue = this.baseGroup.get('uploadId')?.value;
|
|
1581
|
+
if (rootValue) {
|
|
1582
|
+
this.baseGroup.get('uploadId')?.setValue([id, ...rootValue]);
|
|
1569
1583
|
}
|
|
1570
1584
|
}
|
|
1571
1585
|
_getMediaType(accept) {
|
|
@@ -1585,6 +1599,12 @@ class CmatQuillTypeComponent extends FieldType {
|
|
|
1585
1599
|
}
|
|
1586
1600
|
return fileType;
|
|
1587
1601
|
}
|
|
1602
|
+
_getRootControl(baseControl) {
|
|
1603
|
+
if (baseControl.parent) {
|
|
1604
|
+
return this._getRootControl(baseControl.parent);
|
|
1605
|
+
}
|
|
1606
|
+
return baseControl;
|
|
1607
|
+
}
|
|
1588
1608
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CmatQuillTypeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1589
1609
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: CmatQuillTypeComponent, isStandalone: true, selector: "cmat-quill-type", viewQueries: [{ propertyName: "imgInput", first: true, predicate: ["imgInput"], descendants: true }, { propertyName: "videoInput", first: true, predicate: ["videoInput"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<quill-editor class=\"w-full\" defaultEmptyValue=\"\" [formControl]=\"formControl\" [required]=\"required\" [placeholder]=\"placeholder\" [tabindex]=\"props.tabindex\"\r\n [readOnly]=\"disabled\" [modules]=\"quillModules\" (onEditorCreated)=\"editorCreated($event)\"\r\n (onContentChanged)=\"contentChanged($event)\">\r\n <input #imgInput type=\"file\" accept=\"image/png,image/jpeg,image/jpg,image/gif\" class=\"hidden\" (change)=\"fileChangeEvent(imgInput.files?.[0])\" />\r\n <input #videoInput type=\"file\" accept=\"video/mpeg,video/mp4,audio/mp4\" class=\"hidden\" (change)=\"fileChangeEvent(videoInput.files?.[0])\" />\r\n</quill-editor>", styles: [":host{display:block;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i1$4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: QuillModule }, { kind: "component", type: i2$4.QuillEditorComponent, selector: "quill-editor" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
1590
1610
|
}
|