@quadrel-enterprise-ui/framework 21.7.1 → 21.8.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/quadrel-enterprise-ui-framework.mjs +288 -52
- package/fesm2022/quadrel-enterprise-ui-framework.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/i18n/de.json +3 -0
- package/src/assets/i18n/en.json +3 -0
- package/src/assets/i18n/fr.json +3 -0
- package/src/assets/i18n/it.json +3 -0
- package/types/quadrel-enterprise-ui-framework.d.ts +238 -95
|
@@ -1727,7 +1727,7 @@ class QdDialogComponent {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
bindEscToClose() {
|
|
1729
1729
|
this.dialogRef.keydownEvents
|
|
1730
|
-
.pipe(takeUntil(this._destroyed$), filter((e) => e.key === 'Escape'))
|
|
1730
|
+
.pipe(takeUntil(this._destroyed$), filter((e) => e.key === 'Escape' && !e.defaultPrevented))
|
|
1731
1731
|
.subscribe(e => {
|
|
1732
1732
|
e.preventDefault();
|
|
1733
1733
|
this.close();
|
|
@@ -2494,10 +2494,11 @@ class QdMockFileCollectorItemComponent {
|
|
|
2494
2494
|
readonly = false;
|
|
2495
2495
|
viewonly = false;
|
|
2496
2496
|
downloadFilesWithHttpClient = false;
|
|
2497
|
+
metadataFields = [];
|
|
2497
2498
|
uploadTimestamp;
|
|
2498
2499
|
testId;
|
|
2499
2500
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockFileCollectorItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2500
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockFileCollectorItemComponent, isStandalone: false, selector: "qd-file-collector-item", inputs: { progress: "progress", newlyUploaded: "newlyUploaded", collectedFile: "collectedFile", error: "error", readonly: "readonly", viewonly: "viewonly", downloadFilesWithHttpClient: "downloadFilesWithHttpClient", uploadTimestamp: "uploadTimestamp", testId: ["data-test-id", "testId"] }, ngImport: i0, template: 'progress: {{ progress }}, newlyUploaded: {{ newlyUploaded ? "true" : "false" }}, collectedFile: {{ collectedFile | json }}, error: {{ error | json }}, readonly: {{ readonly ? "true" : "false" }}, viewonly: {{ viewonly ? "true" : "false" }}, downloadFilesWithHttpClient: {{ downloadFilesWithHttpClient ? "true" : "false" }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
2501
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockFileCollectorItemComponent, isStandalone: false, selector: "qd-file-collector-item", inputs: { progress: "progress", newlyUploaded: "newlyUploaded", collectedFile: "collectedFile", error: "error", readonly: "readonly", viewonly: "viewonly", downloadFilesWithHttpClient: "downloadFilesWithHttpClient", metadataFields: "metadataFields", uploadTimestamp: "uploadTimestamp", testId: ["data-test-id", "testId"] }, ngImport: i0, template: 'progress: {{ progress }}, newlyUploaded: {{ newlyUploaded ? "true" : "false" }}, collectedFile: {{ collectedFile | json }}, error: {{ error | json }}, readonly: {{ readonly ? "true" : "false" }}, viewonly: {{ viewonly ? "true" : "false" }}, downloadFilesWithHttpClient: {{ downloadFilesWithHttpClient ? "true" : "false" }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
2501
2502
|
}
|
|
2502
2503
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockFileCollectorItemComponent, decorators: [{
|
|
2503
2504
|
type: Component,
|
|
@@ -2520,6 +2521,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2520
2521
|
type: Input
|
|
2521
2522
|
}], downloadFilesWithHttpClient: [{
|
|
2522
2523
|
type: Input
|
|
2524
|
+
}], metadataFields: [{
|
|
2525
|
+
type: Input
|
|
2523
2526
|
}], uploadTimestamp: [{
|
|
2524
2527
|
type: Input
|
|
2525
2528
|
}], testId: [{
|
|
@@ -2606,9 +2609,10 @@ class QdMockFileCollectorDialogItemComponent {
|
|
|
2606
2609
|
progress;
|
|
2607
2610
|
collectedFile;
|
|
2608
2611
|
error;
|
|
2612
|
+
showProgress = true;
|
|
2609
2613
|
testId;
|
|
2610
2614
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockFileCollectorDialogItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2611
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockFileCollectorDialogItemComponent, isStandalone: false, selector: "qd-file-collector-dialog-item", inputs: { progress: "progress", collectedFile: "collectedFile", error: "error", testId: ["data-test-id", "testId"] }, ngImport: i0, template: 'progress: {{ progress }}, collectedFile: {{ collectedFile | json }}, error: {{ error | json }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
2615
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdMockFileCollectorDialogItemComponent, isStandalone: false, selector: "qd-file-collector-dialog-item", inputs: { progress: "progress", collectedFile: "collectedFile", error: "error", showProgress: "showProgress", testId: ["data-test-id", "testId"] }, ngImport: i0, template: 'progress: {{ progress }}, collectedFile: {{ collectedFile | json }}, error: {{ error | json }}', isInline: true, dependencies: [{ kind: "pipe", type: i1$1.JsonPipe, name: "json" }] });
|
|
2612
2616
|
}
|
|
2613
2617
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdMockFileCollectorDialogItemComponent, decorators: [{
|
|
2614
2618
|
type: Component,
|
|
@@ -2623,6 +2627,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
2623
2627
|
type: Input
|
|
2624
2628
|
}], error: [{
|
|
2625
2629
|
type: Input
|
|
2630
|
+
}], showProgress: [{
|
|
2631
|
+
type: Input
|
|
2626
2632
|
}], testId: [{
|
|
2627
2633
|
type: Input,
|
|
2628
2634
|
args: ['data-test-id']
|
|
@@ -20698,11 +20704,16 @@ class QdFileCollectorService {
|
|
|
20698
20704
|
fileManager = inject(QD_FILE_MANAGER_TOKEN);
|
|
20699
20705
|
fileCollectorValidationService = inject(QdFileCollectorValidationService);
|
|
20700
20706
|
changeDetectorRef = inject(ChangeDetectorRef);
|
|
20707
|
+
_pendingFile = null;
|
|
20701
20708
|
config;
|
|
20702
20709
|
fileUploads = [];
|
|
20710
|
+
get requiresSingleFileUpload() {
|
|
20711
|
+
return !!this.config?.fileNameInput || (this.config?.metadata?.length ?? 0) > 0;
|
|
20712
|
+
}
|
|
20703
20713
|
initialize(config) {
|
|
20704
20714
|
this.config = config;
|
|
20705
20715
|
this.fileUploads = [];
|
|
20716
|
+
this._pendingFile = null;
|
|
20706
20717
|
this.getStoredFileUploadsFromConfig(config).forEach(fileUpload => this.fileUploads.push(fileUpload));
|
|
20707
20718
|
}
|
|
20708
20719
|
getStoredFileUploadsFromConfig(config) {
|
|
@@ -20750,6 +20761,55 @@ class QdFileCollectorService {
|
|
|
20750
20761
|
}
|
|
20751
20762
|
});
|
|
20752
20763
|
}
|
|
20764
|
+
prepareFile(file) {
|
|
20765
|
+
const fileUpload = {
|
|
20766
|
+
progress: 0,
|
|
20767
|
+
collectedFile: {
|
|
20768
|
+
name: file.name,
|
|
20769
|
+
size: file.size,
|
|
20770
|
+
type: file.type,
|
|
20771
|
+
downloadUrl: ''
|
|
20772
|
+
}
|
|
20773
|
+
};
|
|
20774
|
+
const error = this.fileCollectorValidationService.validateFile(file);
|
|
20775
|
+
if (error)
|
|
20776
|
+
fileUpload.error = error;
|
|
20777
|
+
this.fileUploads = [fileUpload];
|
|
20778
|
+
this._pendingFile = { file, fileUpload };
|
|
20779
|
+
}
|
|
20780
|
+
uploadPreparedFile(details) {
|
|
20781
|
+
const pendingFile = this._pendingFile;
|
|
20782
|
+
if (!pendingFile)
|
|
20783
|
+
return throwError(() => new Error('No pending file is available for upload.'));
|
|
20784
|
+
if (pendingFile.fileUpload.error)
|
|
20785
|
+
return throwError(() => new Error('The pending file is invalid.'));
|
|
20786
|
+
delete pendingFile.fileUpload.error;
|
|
20787
|
+
pendingFile.fileUpload.progress = 0;
|
|
20788
|
+
this.changeDetectorRef.detectChanges();
|
|
20789
|
+
return this.fileManager.upload(pendingFile.file, details).pipe(tap({
|
|
20790
|
+
next: uploadProgress => this.updatePreparedUploadProgress(pendingFile.fileUpload, uploadProgress),
|
|
20791
|
+
error: () => {
|
|
20792
|
+
pendingFile.fileUpload.progress = 0;
|
|
20793
|
+
pendingFile.fileUpload.error = { type: QdUploadErrorType.UNKNOWN_ERROR };
|
|
20794
|
+
this.changeDetectorRef.detectChanges();
|
|
20795
|
+
}
|
|
20796
|
+
}), map(() => pendingFile.fileUpload));
|
|
20797
|
+
}
|
|
20798
|
+
updatePreparedUploadProgress(fileUpload, uploadProgress) {
|
|
20799
|
+
if (uploadProgress?.progress !== undefined)
|
|
20800
|
+
fileUpload.progress = uploadProgress.progress;
|
|
20801
|
+
if (uploadProgress?.collectedFile)
|
|
20802
|
+
fileUpload.collectedFile = uploadProgress.collectedFile;
|
|
20803
|
+
if (uploadProgress?.error) {
|
|
20804
|
+
fileUpload.error = {
|
|
20805
|
+
...uploadProgress.error,
|
|
20806
|
+
type: uploadProgress.error.type ?? QdUploadErrorType.UNKNOWN_SERVER_ERROR
|
|
20807
|
+
};
|
|
20808
|
+
}
|
|
20809
|
+
if (fileUpload.progress >= 100 && !uploadProgress?.error)
|
|
20810
|
+
this._pendingFile = null;
|
|
20811
|
+
this.changeDetectorRef.detectChanges();
|
|
20812
|
+
}
|
|
20753
20813
|
deleteFile(collectedFile) {
|
|
20754
20814
|
this.fileManager.delete(collectedFile).subscribe(deleted => {
|
|
20755
20815
|
if (!deleted)
|
|
@@ -20946,6 +21006,7 @@ class QdFileCollectorDialogItemComponent {
|
|
|
20946
21006
|
progress;
|
|
20947
21007
|
collectedFile;
|
|
20948
21008
|
error;
|
|
21009
|
+
showProgress = true;
|
|
20949
21010
|
testId;
|
|
20950
21011
|
get hostTestId() {
|
|
20951
21012
|
return this.testId;
|
|
@@ -20957,17 +21018,19 @@ class QdFileCollectorDialogItemComponent {
|
|
|
20957
21018
|
return !!this.error;
|
|
20958
21019
|
}
|
|
20959
21020
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorDialogItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20960
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorDialogItemComponent, isStandalone: false, selector: "qd-file-collector-dialog-item", inputs: { progress: "progress", collectedFile: "collectedFile", error: "error", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.hostTestId", "class.success": "this.isSuccessful", "class.error": "this.hasError" } }, ngImport: i0, template: "<span class=\"name\" [attr.data-test-id]=\"testId + '-name'\">{{ this.collectedFile.name }}</span>\n<qd-file-collector-dialog-item-progress\n [progress]=\"this.progress\"\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-progress'\"\n></qd-file-collector-dialog-item-progress>\n<span class=\"filesize\" [attr.data-test-id]=\"testId + '-size'\">{{ this.collectedFile.size | filesize | async }}</span>\n@if (!!this.error) {\n<qd-file-collector-dialog-item-error\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-error'\"\n></qd-file-collector-dialog-item-error>\n}\n", styles: [":host{color:#333;font-size:.875rem;font-weight:400;line-height:1.3125rem;position:relative;display:grid;align-items:self-start;padding:.625rem 1rem .625rem 2.875rem;border-left:transparent .1875rem solid;margin-bottom:.75rem;background:#fff;gap:.25rem 1rem;grid-template-columns:30rem auto max-content;outline:rgb(151,151,151) .0625rem solid}:host qd-file-collector-dialog-item-error{grid-column:span 2}:host .filesize{text-align:right}@media(max-width:959.98px){:host{grid-template-columns:18.75rem auto max-content}:host .name{overflow:auto;overflow-wrap:break-word}}@media(max-width:599.98px){:host{grid-template-columns:auto auto auto}:host .name,:host qd-file-collector-dialog-item-progress{grid-column:span 2}:host qd-file-collector-dialog-item-progress,:host .filesize{order:-1}}:host:last-child{margin-bottom:0}:host.error{border-left-color:#c70023}:host.success{border-left-color:#00813a}:host:before{position:absolute;top:.5625rem;left:.875rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}:host .upload{color:#454545;cursor:pointer;font-size:1rem}:host .upload:hover,:host .upload:focus{color:#171717}\n"], dependencies: [{ kind: "component", type: QdFileCollectorDialogItemProgressComponent, selector: "qd-file-collector-dialog-item-progress", inputs: ["progress", "error", "data-test-id"] }, { kind: "component", type: QdFileCollectorDialogItemErrorComponent, selector: "qd-file-collector-dialog-item-error", inputs: ["error", "data-test-id"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: QdFileSizePipe, name: "filesize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
21021
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorDialogItemComponent, isStandalone: false, selector: "qd-file-collector-dialog-item", inputs: { progress: "progress", collectedFile: "collectedFile", error: "error", showProgress: "showProgress", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.hostTestId", "class.success": "this.isSuccessful", "class.error": "this.hasError" } }, ngImport: i0, template: "<span class=\"name\" [attr.data-test-id]=\"testId + '-name'\">{{ this.collectedFile.name }}</span>\n@if (showProgress) {\n<qd-file-collector-dialog-item-progress\n [progress]=\"this.progress\"\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-progress'\"\n></qd-file-collector-dialog-item-progress>\n}\n<span class=\"filesize\" [attr.data-test-id]=\"testId + '-size'\">{{ this.collectedFile.size | filesize | async }}</span>\n@if (!!this.error) {\n<qd-file-collector-dialog-item-error\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-error'\"\n></qd-file-collector-dialog-item-error>\n}\n", styles: [":host{color:#333;font-size:.875rem;font-weight:400;line-height:1.3125rem;position:relative;display:grid;align-items:self-start;padding:.625rem 1rem .625rem 2.875rem;border-left:transparent .1875rem solid;margin-bottom:.75rem;background:#fff;gap:.25rem 1rem;grid-template-columns:30rem auto max-content;outline:rgb(151,151,151) .0625rem solid}:host qd-file-collector-dialog-item-error{grid-column:span 2}:host .filesize{text-align:right}@media(max-width:959.98px){:host{grid-template-columns:18.75rem auto max-content}:host .name{overflow:auto;overflow-wrap:break-word}}@media(max-width:599.98px){:host{grid-template-columns:auto auto auto}:host .name,:host qd-file-collector-dialog-item-progress{grid-column:span 2}:host qd-file-collector-dialog-item-progress,:host .filesize{order:-1}}:host:last-child{margin-bottom:0}:host.error{border-left-color:#c70023}:host.success{border-left-color:#00813a}:host:before{position:absolute;top:.5625rem;left:.875rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}:host .upload{color:#454545;cursor:pointer;font-size:1rem}:host .upload:hover,:host .upload:focus{color:#171717}\n"], dependencies: [{ kind: "component", type: QdFileCollectorDialogItemProgressComponent, selector: "qd-file-collector-dialog-item-progress", inputs: ["progress", "error", "data-test-id"] }, { kind: "component", type: QdFileCollectorDialogItemErrorComponent, selector: "qd-file-collector-dialog-item-error", inputs: ["error", "data-test-id"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: QdFileSizePipe, name: "filesize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
20961
21022
|
}
|
|
20962
21023
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorDialogItemComponent, decorators: [{
|
|
20963
21024
|
type: Component,
|
|
20964
|
-
args: [{ selector: 'qd-file-collector-dialog-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<span class=\"name\" [attr.data-test-id]=\"testId + '-name'\">{{ this.collectedFile.name }}</span>\n<qd-file-collector-dialog-item-progress\n [progress]=\"this.progress\"\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-progress'\"\n></qd-file-collector-dialog-item-progress>\n<span class=\"filesize\" [attr.data-test-id]=\"testId + '-size'\">{{ this.collectedFile.size | filesize | async }}</span>\n@if (!!this.error) {\n<qd-file-collector-dialog-item-error\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-error'\"\n></qd-file-collector-dialog-item-error>\n}\n", styles: [":host{color:#333;font-size:.875rem;font-weight:400;line-height:1.3125rem;position:relative;display:grid;align-items:self-start;padding:.625rem 1rem .625rem 2.875rem;border-left:transparent .1875rem solid;margin-bottom:.75rem;background:#fff;gap:.25rem 1rem;grid-template-columns:30rem auto max-content;outline:rgb(151,151,151) .0625rem solid}:host qd-file-collector-dialog-item-error{grid-column:span 2}:host .filesize{text-align:right}@media(max-width:959.98px){:host{grid-template-columns:18.75rem auto max-content}:host .name{overflow:auto;overflow-wrap:break-word}}@media(max-width:599.98px){:host{grid-template-columns:auto auto auto}:host .name,:host qd-file-collector-dialog-item-progress{grid-column:span 2}:host qd-file-collector-dialog-item-progress,:host .filesize{order:-1}}:host:last-child{margin-bottom:0}:host.error{border-left-color:#c70023}:host.success{border-left-color:#00813a}:host:before{position:absolute;top:.5625rem;left:.875rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}:host .upload{color:#454545;cursor:pointer;font-size:1rem}:host .upload:hover,:host .upload:focus{color:#171717}\n"] }]
|
|
21025
|
+
args: [{ selector: 'qd-file-collector-dialog-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<span class=\"name\" [attr.data-test-id]=\"testId + '-name'\">{{ this.collectedFile.name }}</span>\n@if (showProgress) {\n<qd-file-collector-dialog-item-progress\n [progress]=\"this.progress\"\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-progress'\"\n></qd-file-collector-dialog-item-progress>\n}\n<span class=\"filesize\" [attr.data-test-id]=\"testId + '-size'\">{{ this.collectedFile.size | filesize | async }}</span>\n@if (!!this.error) {\n<qd-file-collector-dialog-item-error\n [error]=\"this.error\"\n [data-test-id]=\"testId + '-error'\"\n></qd-file-collector-dialog-item-error>\n}\n", styles: [":host{color:#333;font-size:.875rem;font-weight:400;line-height:1.3125rem;position:relative;display:grid;align-items:self-start;padding:.625rem 1rem .625rem 2.875rem;border-left:transparent .1875rem solid;margin-bottom:.75rem;background:#fff;gap:.25rem 1rem;grid-template-columns:30rem auto max-content;outline:rgb(151,151,151) .0625rem solid}:host qd-file-collector-dialog-item-error{grid-column:span 2}:host .filesize{text-align:right}@media(max-width:959.98px){:host{grid-template-columns:18.75rem auto max-content}:host .name{overflow:auto;overflow-wrap:break-word}}@media(max-width:599.98px){:host{grid-template-columns:auto auto auto}:host .name,:host qd-file-collector-dialog-item-progress{grid-column:span 2}:host qd-file-collector-dialog-item-progress,:host .filesize{order:-1}}:host:last-child{margin-bottom:0}:host.error{border-left-color:#c70023}:host.success{border-left-color:#00813a}:host:before{position:absolute;top:.5625rem;left:.875rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}:host .upload{color:#454545;cursor:pointer;font-size:1rem}:host .upload:hover,:host .upload:focus{color:#171717}\n"] }]
|
|
20965
21026
|
}], propDecorators: { progress: [{
|
|
20966
21027
|
type: Input
|
|
20967
21028
|
}], collectedFile: [{
|
|
20968
21029
|
type: Input
|
|
20969
21030
|
}], error: [{
|
|
20970
21031
|
type: Input
|
|
21032
|
+
}], showProgress: [{
|
|
21033
|
+
type: Input
|
|
20971
21034
|
}], testId: [{
|
|
20972
21035
|
type: Input,
|
|
20973
21036
|
args: [{ required: true, alias: 'data-test-id' }]
|
|
@@ -20986,15 +21049,78 @@ class QdFileCollectorDialogComponent {
|
|
|
20986
21049
|
fileCollectorService = inject(QdFileCollectorService, { skipSelf: true });
|
|
20987
21050
|
dialogFileCollectorService = inject(QdFileCollectorService);
|
|
20988
21051
|
dialogRef = inject(DialogRef);
|
|
21052
|
+
destroyRef = inject(DestroyRef);
|
|
21053
|
+
selectedFile = null;
|
|
21054
|
+
form;
|
|
21055
|
+
isSaving = false;
|
|
21056
|
+
isDetailsFormVisible = false;
|
|
21057
|
+
fileNameInputConfig = null;
|
|
21058
|
+
metadataFieldConfigs = {};
|
|
20989
21059
|
get fileUploads() {
|
|
20990
21060
|
return this.dialogFileCollectorService.fileUploads;
|
|
20991
21061
|
}
|
|
21062
|
+
get config() {
|
|
21063
|
+
return this.dialogFileCollectorService.config;
|
|
21064
|
+
}
|
|
21065
|
+
get requiresSingleFileUpload() {
|
|
21066
|
+
return this.dialogFileCollectorService.requiresSingleFileUpload;
|
|
21067
|
+
}
|
|
21068
|
+
get isSaveDisabled() {
|
|
21069
|
+
return !this.selectedFile || !!this.form?.invalid || this.isSaving || this.hasFileValidationError;
|
|
21070
|
+
}
|
|
21071
|
+
get showProgress() {
|
|
21072
|
+
return !this.requiresSingleFileUpload || this.isSaving || (this.fileUploads[0]?.progress ?? 0) > 0;
|
|
21073
|
+
}
|
|
21074
|
+
get hasFileValidationError() {
|
|
21075
|
+
const errorType = this.fileUploads[0]?.error?.type;
|
|
21076
|
+
return (errorType === QdUploadErrorType.INVALID_MIME_TYPE ||
|
|
21077
|
+
errorType === QdUploadErrorType.INVALID_FILE_SIZE ||
|
|
21078
|
+
errorType === QdUploadErrorType.INVALID_FILE_NAME);
|
|
21079
|
+
}
|
|
20992
21080
|
constructor() {
|
|
20993
21081
|
this.dialogFileCollectorService.config = this.fileCollectorService.config;
|
|
21082
|
+
this.dialogRef.keydownEvents.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(event => {
|
|
21083
|
+
if (this.isSaving && event.key === 'Escape')
|
|
21084
|
+
event.preventDefault();
|
|
21085
|
+
});
|
|
20994
21086
|
}
|
|
20995
21087
|
uploadFiles(files) {
|
|
21088
|
+
if (this.requiresSingleFileUpload) {
|
|
21089
|
+
const file = files[0];
|
|
21090
|
+
if (!file)
|
|
21091
|
+
return;
|
|
21092
|
+
this.selectedFile = file;
|
|
21093
|
+
this.initForm(file);
|
|
21094
|
+
this.isDetailsFormVisible = true;
|
|
21095
|
+
this.dialogFileCollectorService.prepareFile(file);
|
|
21096
|
+
return;
|
|
21097
|
+
}
|
|
20996
21098
|
Array.from(files).forEach((file) => this.dialogFileCollectorService.uploadFile(file));
|
|
20997
21099
|
}
|
|
21100
|
+
save() {
|
|
21101
|
+
if (this.isSaveDisabled || !this.selectedFile)
|
|
21102
|
+
return;
|
|
21103
|
+
this.isSaving = true;
|
|
21104
|
+
this.setCloseButtonHidden(true);
|
|
21105
|
+
this.dialogFileCollectorService.uploadPreparedFile(this.getFileDetails()).subscribe({
|
|
21106
|
+
next: fileUpload => {
|
|
21107
|
+
if (fileUpload.error) {
|
|
21108
|
+
this.isSaving = false;
|
|
21109
|
+
this.setCloseButtonHidden(false);
|
|
21110
|
+
}
|
|
21111
|
+
else if (fileUpload.progress === 100) {
|
|
21112
|
+
this.close();
|
|
21113
|
+
}
|
|
21114
|
+
},
|
|
21115
|
+
error: () => {
|
|
21116
|
+
this.isSaving = false;
|
|
21117
|
+
this.setCloseButtonHidden(false);
|
|
21118
|
+
}
|
|
21119
|
+
});
|
|
21120
|
+
}
|
|
21121
|
+
cancel() {
|
|
21122
|
+
this.dialogRef.close();
|
|
21123
|
+
}
|
|
20998
21124
|
close() {
|
|
20999
21125
|
this.dialogRef.close(this.fileUploads);
|
|
21000
21126
|
}
|
|
@@ -21004,12 +21130,83 @@ class QdFileCollectorDialogComponent {
|
|
|
21004
21130
|
isFileUploadCompleted(fileUpload) {
|
|
21005
21131
|
return !!fileUpload.error || fileUpload.progress === 100;
|
|
21006
21132
|
}
|
|
21133
|
+
setCloseButtonHidden(hidden) {
|
|
21134
|
+
this.dialogRef.config.hideCloseHeaderButton = hidden;
|
|
21135
|
+
}
|
|
21136
|
+
initForm(file) {
|
|
21137
|
+
const controls = {};
|
|
21138
|
+
const extension = this.getFileExtension(file.name);
|
|
21139
|
+
this.fileNameInputConfig = null;
|
|
21140
|
+
this.metadataFieldConfigs = {};
|
|
21141
|
+
if (this.config.fileNameInput) {
|
|
21142
|
+
this.fileNameInputConfig = this.createFileNameInputConfig(extension);
|
|
21143
|
+
controls['fileName'] = new QdFormControl({
|
|
21144
|
+
value: this.getFileNameWithoutExtension(file.name),
|
|
21145
|
+
...(extension ? { unit: extension } : {})
|
|
21146
|
+
}, QdValidators.required());
|
|
21147
|
+
}
|
|
21148
|
+
(this.config.metadata ?? []).forEach(field => {
|
|
21149
|
+
this.metadataFieldConfigs[field.name] = this.createMetadataConfig(field);
|
|
21150
|
+
controls[field.name] = new QdFormControl(field.defaultValue ?? null, QdValidators.required());
|
|
21151
|
+
});
|
|
21152
|
+
this.form = new QdFormGroup(controls);
|
|
21153
|
+
}
|
|
21154
|
+
createFileNameInputConfig(extension) {
|
|
21155
|
+
const config = this.config.fileNameInput;
|
|
21156
|
+
return {
|
|
21157
|
+
label: config.label ?? { i18n: 'i18n.qd.fileCollector.fileName' },
|
|
21158
|
+
...(config.description ? { hint: config.description } : {}),
|
|
21159
|
+
...(extension ? { units: [{ i18n: extension, value: extension }] } : {})
|
|
21160
|
+
};
|
|
21161
|
+
}
|
|
21162
|
+
createMetadataConfig(field) {
|
|
21163
|
+
return {
|
|
21164
|
+
label: field.label,
|
|
21165
|
+
...(field.description ? { hint: field.description } : {}),
|
|
21166
|
+
options: field.options
|
|
21167
|
+
};
|
|
21168
|
+
}
|
|
21169
|
+
getFileDetails() {
|
|
21170
|
+
const rawValues = this.form?.getRawValue();
|
|
21171
|
+
const details = { metadata: {} };
|
|
21172
|
+
if (this.config.fileNameInput) {
|
|
21173
|
+
details.fileName = this.getFileNameValue(rawValues?.['fileName']);
|
|
21174
|
+
}
|
|
21175
|
+
(this.config.metadata ?? []).forEach(field => {
|
|
21176
|
+
details.metadata[field.name] = this.getStringValue(rawValues?.[field.name]);
|
|
21177
|
+
});
|
|
21178
|
+
return details;
|
|
21179
|
+
}
|
|
21180
|
+
getStringValue(value) {
|
|
21181
|
+
if (typeof value === 'string')
|
|
21182
|
+
return value;
|
|
21183
|
+
if (value && typeof value === 'object' && 'value' in value) {
|
|
21184
|
+
const inputValue = value.value;
|
|
21185
|
+
return typeof inputValue === 'string' ? inputValue : null;
|
|
21186
|
+
}
|
|
21187
|
+
return value == null ? null : String(value);
|
|
21188
|
+
}
|
|
21189
|
+
getFileNameValue(value) {
|
|
21190
|
+
const fileName = this.getStringValue(value) ?? '';
|
|
21191
|
+
const extension = this.selectedFile ? this.getFileExtension(this.selectedFile.name) : '';
|
|
21192
|
+
return extension && fileName.toLowerCase().endsWith(extension.toLowerCase())
|
|
21193
|
+
? fileName.slice(0, -extension.length)
|
|
21194
|
+
: fileName;
|
|
21195
|
+
}
|
|
21196
|
+
getFileNameWithoutExtension(fileName) {
|
|
21197
|
+
const extensionIndex = fileName.lastIndexOf('.');
|
|
21198
|
+
return extensionIndex > 0 ? fileName.slice(0, extensionIndex) : fileName;
|
|
21199
|
+
}
|
|
21200
|
+
getFileExtension(fileName) {
|
|
21201
|
+
const extensionIndex = fileName.lastIndexOf('.');
|
|
21202
|
+
return extensionIndex > 0 ? fileName.slice(extensionIndex) : '';
|
|
21203
|
+
}
|
|
21007
21204
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21008
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorDialogComponent, isStandalone: false, selector: "qd-file-collector-dialog", providers: [QdFileCollectorService], ngImport: i0, template: "<qd-dialog>\n @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) {\n <qd-file-collector-dialog-item\n [progress]=\"fileUpload.progress\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [data-test-id]=\"'file-collector-dialog-item-' + i\"\n ></qd-file-collector-dialog-item>\n }\n <qd-dialog-action>\n <button\n qdButton\n (click)=\"close()\"\n [disabled]=\"isCloseButtonDisabled()\"\n data-test-id=\"file-collector-dialog-button-finish\"\n >\n {{ \"i18n.qd.fileCollector.button.finish\" | translate }}\n </button>\n </qd-dialog-action>\n</qd-dialog>\n", dependencies: [{ kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "component", type: QdDialogActionComponent, selector: "qd-dialog-action" }, { kind: "component", type: QdDialogComponent, selector: "qd-dialog", inputs: ["data-test-id"] }, { kind: "component", type: QdFileCollectorDialogItemComponent, selector: "qd-file-collector-dialog-item", inputs: ["progress", "collectedFile", "error", "data-test-id"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
21205
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorDialogComponent, isStandalone: false, selector: "qd-file-collector-dialog", providers: [QdFileCollectorService], ngImport: i0, template: "<qd-dialog>\n @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) {\n <qd-file-collector-dialog-item\n [progress]=\"fileUpload.progress\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [showProgress]=\"showProgress\"\n [data-test-id]=\"'file-collector-dialog-item-' + i\"\n ></qd-file-collector-dialog-item>\n } @if (isDetailsFormVisible) {\n <form [formGroup]=\"form\" class=\"qd-file-collector-dialog-form\">\n @if (config.fileNameInput && fileNameInputConfig) {\n <qd-input\n formControlName=\"fileName\"\n [config]=\"fileNameInputConfig\"\n data-test-id=\"file-collector-dialog-file-name\"\n ></qd-input>\n } @for (field of config.metadata ?? []; track field.name) {\n <qd-dropdown\n [formControlName]=\"field.name\"\n [config]=\"metadataFieldConfigs[field.name]\"\n [data-test-id]=\"'file-collector-dialog-metadata-' + field.name\"\n ></qd-dropdown>\n }\n </form>\n }\n <qd-dialog-action>\n @if (requiresSingleFileUpload) {\n <button\n qdButton\n qdButtonGhost\n color=\"secondary\"\n (click)=\"cancel()\"\n [disabled]=\"isSaving\"\n data-test-id=\"file-collector-dialog-button-cancel\"\n >\n {{ \"i18n.qd.fileCollector.button.cancel\" | translate }}\n </button>\n <button qdButton (click)=\"save()\" [disabled]=\"isSaveDisabled\" data-test-id=\"file-collector-dialog-button-save\">\n {{ \"i18n.qd.fileCollector.button.save\" | translate }}\n </button>\n } @else {\n <button\n qdButton\n (click)=\"close()\"\n [disabled]=\"isCloseButtonDisabled()\"\n data-test-id=\"file-collector-dialog-button-finish\"\n >\n {{ \"i18n.qd.fileCollector.button.finish\" | translate }}\n </button>\n }\n </qd-dialog-action>\n</qd-dialog>\n", styles: [":host{display:block}.qd-file-collector-dialog-form{display:flex;flex-direction:column}\n"], dependencies: [{ kind: "component", type: QdDropdownComponent, selector: "qd-dropdown", inputs: ["value", "id", "formControlName", "config", "data-test-id", "qdPopoverMaxHeight", "dense"], outputs: ["valueChange", "enterClick", "dropdownOpened", "clickHint", "clickReadonly", "clickViewonly", "optionsResolved"] }, { kind: "component", type: QdInputComponent, selector: "qd-input", inputs: ["formControlName", "value", "config", "isError", "data-test-id"], outputs: ["valueChange", "enterClick", "clickClear", "clickHint", "clickReadonly", "clickViewonly", "optionsResolved"] }, { kind: "directive", type: i1$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonGhostDirective, selector: "button[qdButtonGhost], a[qdButtonGhost]" }, { kind: "component", type: QdDialogActionComponent, selector: "qd-dialog-action" }, { kind: "component", type: QdDialogComponent, selector: "qd-dialog", inputs: ["data-test-id"] }, { kind: "component", type: QdFileCollectorDialogItemComponent, selector: "qd-file-collector-dialog-item", inputs: ["progress", "collectedFile", "error", "showProgress", "data-test-id"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
21009
21206
|
}
|
|
21010
21207
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorDialogComponent, decorators: [{
|
|
21011
21208
|
type: Component,
|
|
21012
|
-
args: [{ selector: 'qd-file-collector-dialog', providers: [QdFileCollectorService], standalone: false, template: "<qd-dialog>\n @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) {\n <qd-file-collector-dialog-item\n [progress]=\"fileUpload.progress\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [data-test-id]=\"'file-collector-dialog-item-' + i\"\n ></qd-file-collector-dialog-item>\n }\n <qd-dialog-action>\n <button\n qdButton\n (click)=\"close()\"\n [disabled]=\"isCloseButtonDisabled()\"\n data-test-id=\"file-collector-dialog-button-finish\"\n >\n {{ \"i18n.qd.fileCollector.button.finish\" | translate }}\n </button>\n </qd-dialog-action>\n</qd-dialog>\n" }]
|
|
21209
|
+
args: [{ selector: 'qd-file-collector-dialog', providers: [QdFileCollectorService], standalone: false, template: "<qd-dialog>\n @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) {\n <qd-file-collector-dialog-item\n [progress]=\"fileUpload.progress\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [showProgress]=\"showProgress\"\n [data-test-id]=\"'file-collector-dialog-item-' + i\"\n ></qd-file-collector-dialog-item>\n } @if (isDetailsFormVisible) {\n <form [formGroup]=\"form\" class=\"qd-file-collector-dialog-form\">\n @if (config.fileNameInput && fileNameInputConfig) {\n <qd-input\n formControlName=\"fileName\"\n [config]=\"fileNameInputConfig\"\n data-test-id=\"file-collector-dialog-file-name\"\n ></qd-input>\n } @for (field of config.metadata ?? []; track field.name) {\n <qd-dropdown\n [formControlName]=\"field.name\"\n [config]=\"metadataFieldConfigs[field.name]\"\n [data-test-id]=\"'file-collector-dialog-metadata-' + field.name\"\n ></qd-dropdown>\n }\n </form>\n }\n <qd-dialog-action>\n @if (requiresSingleFileUpload) {\n <button\n qdButton\n qdButtonGhost\n color=\"secondary\"\n (click)=\"cancel()\"\n [disabled]=\"isSaving\"\n data-test-id=\"file-collector-dialog-button-cancel\"\n >\n {{ \"i18n.qd.fileCollector.button.cancel\" | translate }}\n </button>\n <button qdButton (click)=\"save()\" [disabled]=\"isSaveDisabled\" data-test-id=\"file-collector-dialog-button-save\">\n {{ \"i18n.qd.fileCollector.button.save\" | translate }}\n </button>\n } @else {\n <button\n qdButton\n (click)=\"close()\"\n [disabled]=\"isCloseButtonDisabled()\"\n data-test-id=\"file-collector-dialog-button-finish\"\n >\n {{ \"i18n.qd.fileCollector.button.finish\" | translate }}\n </button>\n }\n </qd-dialog-action>\n</qd-dialog>\n", styles: [":host{display:block}.qd-file-collector-dialog-form{display:flex;flex-direction:column}\n"] }]
|
|
21013
21210
|
}], ctorParameters: () => [] });
|
|
21014
21211
|
|
|
21015
21212
|
class QdSectionToolbarActionService {
|
|
@@ -21333,19 +21530,33 @@ class QdFileCollectorItemComponent {
|
|
|
21333
21530
|
readonly = false;
|
|
21334
21531
|
viewonly = false;
|
|
21335
21532
|
downloadFilesWithHttpClient = false;
|
|
21533
|
+
metadataFields = [];
|
|
21336
21534
|
testId;
|
|
21535
|
+
metadataItems = [];
|
|
21337
21536
|
get hostTestId() {
|
|
21338
21537
|
return this.testId;
|
|
21339
21538
|
}
|
|
21340
21539
|
get isNewlyUploaded() {
|
|
21341
21540
|
return this.newlyUploaded;
|
|
21342
21541
|
}
|
|
21542
|
+
ngOnChanges() {
|
|
21543
|
+
this.metadataItems = this.metadataFields.reduce((items, field) => {
|
|
21544
|
+
const value = this.collectedFile.metadata?.[field.name];
|
|
21545
|
+
if (value == null || value === '')
|
|
21546
|
+
return items;
|
|
21547
|
+
items.push({
|
|
21548
|
+
name: field.name,
|
|
21549
|
+
value: field.options.find(option => option.value === value)?.i18n ?? value
|
|
21550
|
+
});
|
|
21551
|
+
return items;
|
|
21552
|
+
}, []);
|
|
21553
|
+
}
|
|
21343
21554
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21344
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorItemComponent, isStandalone: false, selector: "qd-file-collector-item", inputs: { progress: "progress", newlyUploaded: "newlyUploaded", collectedFile: "collectedFile", error: "error", readonly: "readonly", viewonly: "viewonly", downloadFilesWithHttpClient: "downloadFilesWithHttpClient", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.hostTestId", "class.newly-uploaded": "this.isNewlyUploaded" } }, ngImport: i0, template: "<qd-file-collector-item-name\n [name]=\"collectedFile.name\"\n [data-test-id]=\"testId + '-name'\"\n></qd-file-collector-item-name>\n\n@if (collectedFile.uploadTimestamp) {\n<qd-file-collector-upload-timestamp\n [value]=\"collectedFile.uploadTimestamp\"\n [data-test-id]=\"testId + '-timestamp'\"\n></qd-file-collector-upload-timestamp>\n}\n\n<qd-file-collector-item-size\n [size]=\"collectedFile.size\"\n [data-test-id]=\"testId + '-size'\"\n></qd-file-collector-item-size>\n\n<qd-file-collector-item-tools\n [progress]=\"progress\"\n [collectedFile]=\"collectedFile\"\n [error]=\"error\"\n [readonly]=\"readonly\"\n [viewonly]=\"viewonly\"\n [downloadFilesWithHttpClient]=\"downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-tools'\"\n></qd-file-collector-item-tools>\n", styles: [":host{position:relative;display:flex;flex-wrap:wrap;justify-content:right;padding:.625rem 1rem .625rem 3rem;border:rgb(151,151,151) .0625rem solid;margin-bottom:.75rem;background:#fff;gap:1rem}:host:before{position:absolute;top:.5625rem;left:1rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}@media(max-width:959.98px){:host{gap:.5rem .75rem}:host qd-icon:last-child{margin-right:0}}:host.newly-uploaded{animation:success-background-gradient 2s;animation-iteration-count:1;animation-timing-function:ease-in-out}@keyframes success-background-gradient{0%{background:#c3e8cd}to{background:#fff}}\n"], dependencies: [{ kind: "component", type: QdFileCollectorItemNameComponent, selector: "qd-file-collector-item-name", inputs: ["name", "data-test-id"] }, { kind: "component", type: QdFileCollectorItemSizeComponent, selector: "qd-file-collector-item-size", inputs: ["size", "data-test-id"] }, { kind: "component", type: QdFileCollectorItemToolsComponent, selector: "qd-file-collector-item-tools", inputs: ["progress", "collectedFile", "error", "readonly", "viewonly", "downloadFilesWithHttpClient", "data-test-id"] }, { kind: "component", type: QdFileCollectorUploadTimestampComponent, selector: "qd-file-collector-upload-timestamp", inputs: ["value", "data-test-id"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
21555
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorItemComponent, isStandalone: false, selector: "qd-file-collector-item", inputs: { progress: "progress", newlyUploaded: "newlyUploaded", collectedFile: "collectedFile", error: "error", readonly: "readonly", viewonly: "viewonly", downloadFilesWithHttpClient: "downloadFilesWithHttpClient", metadataFields: "metadataFields", testId: ["data-test-id", "testId"] }, host: { properties: { "attr.data-test-id": "this.hostTestId", "class.newly-uploaded": "this.isNewlyUploaded" } }, usesOnChanges: true, ngImport: i0, template: "<qd-file-collector-item-name\n [name]=\"collectedFile.name\"\n [data-test-id]=\"testId + '-name'\"\n></qd-file-collector-item-name>\n\n@for (metadata of metadataItems; track metadata.name) {\n<span [attr.data-test-id]=\"testId + '-metadata-' + metadata.name\">{{ metadata.value | translate }}</span>\n} @if (collectedFile.uploadTimestamp) {\n<qd-file-collector-upload-timestamp\n [value]=\"collectedFile.uploadTimestamp\"\n [data-test-id]=\"testId + '-timestamp'\"\n></qd-file-collector-upload-timestamp>\n}\n\n<qd-file-collector-item-size\n [size]=\"collectedFile.size\"\n [data-test-id]=\"testId + '-size'\"\n></qd-file-collector-item-size>\n\n<qd-file-collector-item-tools\n [progress]=\"progress\"\n [collectedFile]=\"collectedFile\"\n [error]=\"error\"\n [readonly]=\"readonly\"\n [viewonly]=\"viewonly\"\n [downloadFilesWithHttpClient]=\"downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-tools'\"\n></qd-file-collector-item-tools>\n", styles: [":host{position:relative;display:flex;flex-wrap:wrap;justify-content:right;padding:.625rem 1rem .625rem 3rem;border:rgb(151,151,151) .0625rem solid;margin-bottom:.75rem;background:#fff;gap:1rem}:host:before{position:absolute;top:.5625rem;left:1rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}@media(max-width:959.98px){:host{gap:.5rem .75rem}:host qd-icon:last-child{margin-right:0}}:host.newly-uploaded{animation:success-background-gradient 2s;animation-iteration-count:1;animation-timing-function:ease-in-out}@keyframes success-background-gradient{0%{background:#c3e8cd}to{background:#fff}}\n"], dependencies: [{ kind: "component", type: QdFileCollectorItemNameComponent, selector: "qd-file-collector-item-name", inputs: ["name", "data-test-id"] }, { kind: "component", type: QdFileCollectorItemSizeComponent, selector: "qd-file-collector-item-size", inputs: ["size", "data-test-id"] }, { kind: "component", type: QdFileCollectorItemToolsComponent, selector: "qd-file-collector-item-tools", inputs: ["progress", "collectedFile", "error", "readonly", "viewonly", "downloadFilesWithHttpClient", "data-test-id"] }, { kind: "component", type: QdFileCollectorUploadTimestampComponent, selector: "qd-file-collector-upload-timestamp", inputs: ["value", "data-test-id"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
21345
21556
|
}
|
|
21346
21557
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorItemComponent, decorators: [{
|
|
21347
21558
|
type: Component,
|
|
21348
|
-
args: [{ selector: 'qd-file-collector-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<qd-file-collector-item-name\n [name]=\"collectedFile.name\"\n [data-test-id]=\"testId + '-name'\"\n></qd-file-collector-item-name>\n\n@if (collectedFile.uploadTimestamp) {\n<qd-file-collector-upload-timestamp\n [value]=\"collectedFile.uploadTimestamp\"\n [data-test-id]=\"testId + '-timestamp'\"\n></qd-file-collector-upload-timestamp>\n}\n\n<qd-file-collector-item-size\n [size]=\"collectedFile.size\"\n [data-test-id]=\"testId + '-size'\"\n></qd-file-collector-item-size>\n\n<qd-file-collector-item-tools\n [progress]=\"progress\"\n [collectedFile]=\"collectedFile\"\n [error]=\"error\"\n [readonly]=\"readonly\"\n [viewonly]=\"viewonly\"\n [downloadFilesWithHttpClient]=\"downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-tools'\"\n></qd-file-collector-item-tools>\n", styles: [":host{position:relative;display:flex;flex-wrap:wrap;justify-content:right;padding:.625rem 1rem .625rem 3rem;border:rgb(151,151,151) .0625rem solid;margin-bottom:.75rem;background:#fff;gap:1rem}:host:before{position:absolute;top:.5625rem;left:1rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}@media(max-width:959.98px){:host{gap:.5rem .75rem}:host qd-icon:last-child{margin-right:0}}:host.newly-uploaded{animation:success-background-gradient 2s;animation-iteration-count:1;animation-timing-function:ease-in-out}@keyframes success-background-gradient{0%{background:#c3e8cd}to{background:#fff}}\n"] }]
|
|
21559
|
+
args: [{ selector: 'qd-file-collector-item', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<qd-file-collector-item-name\n [name]=\"collectedFile.name\"\n [data-test-id]=\"testId + '-name'\"\n></qd-file-collector-item-name>\n\n@for (metadata of metadataItems; track metadata.name) {\n<span [attr.data-test-id]=\"testId + '-metadata-' + metadata.name\">{{ metadata.value | translate }}</span>\n} @if (collectedFile.uploadTimestamp) {\n<qd-file-collector-upload-timestamp\n [value]=\"collectedFile.uploadTimestamp\"\n [data-test-id]=\"testId + '-timestamp'\"\n></qd-file-collector-upload-timestamp>\n}\n\n<qd-file-collector-item-size\n [size]=\"collectedFile.size\"\n [data-test-id]=\"testId + '-size'\"\n></qd-file-collector-item-size>\n\n<qd-file-collector-item-tools\n [progress]=\"progress\"\n [collectedFile]=\"collectedFile\"\n [error]=\"error\"\n [readonly]=\"readonly\"\n [viewonly]=\"viewonly\"\n [downloadFilesWithHttpClient]=\"downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-tools'\"\n></qd-file-collector-item-tools>\n", styles: [":host{position:relative;display:flex;flex-wrap:wrap;justify-content:right;padding:.625rem 1rem .625rem 3rem;border:rgb(151,151,151) .0625rem solid;margin-bottom:.75rem;background:#fff;gap:1rem}:host:before{position:absolute;top:.5625rem;left:1rem;content:\"\\e964\";font-family:Quadrel-Icon,sans-serif;font-size:1.25rem}@media(max-width:959.98px){:host{gap:.5rem .75rem}:host qd-icon:last-child{margin-right:0}}:host.newly-uploaded{animation:success-background-gradient 2s;animation-iteration-count:1;animation-timing-function:ease-in-out}@keyframes success-background-gradient{0%{background:#c3e8cd}to{background:#fff}}\n"] }]
|
|
21349
21560
|
}], propDecorators: { progress: [{
|
|
21350
21561
|
type: Input
|
|
21351
21562
|
}], newlyUploaded: [{
|
|
@@ -21360,6 +21571,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
21360
21571
|
type: Input
|
|
21361
21572
|
}], downloadFilesWithHttpClient: [{
|
|
21362
21573
|
type: Input
|
|
21574
|
+
}], metadataFields: [{
|
|
21575
|
+
type: Input
|
|
21363
21576
|
}], testId: [{
|
|
21364
21577
|
type: Input,
|
|
21365
21578
|
args: [{ required: true, alias: 'data-test-id' }]
|
|
@@ -21380,6 +21593,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
21380
21593
|
* - **Download**: directly via URL or through `HttpClient` (e.g. for authorization)
|
|
21381
21594
|
* - **Delete**: with confirmation dialog
|
|
21382
21595
|
* - **Upload Timestamp**: shows the upload date next to the file name when `uploadTimestamp` is set
|
|
21596
|
+
* - **Metadata**: optionally collects a custom file name and metadata fields before uploading
|
|
21383
21597
|
* - **Validation**: restricts file type, size, and name pattern with customizable error messages
|
|
21384
21598
|
* - **Readonly / Viewonly**: disables upload and delete, allows only viewing and downloading
|
|
21385
21599
|
* - **Standalone / Section**: works independently with its own add button, or inside a `QdSection` via the toolbar action
|
|
@@ -21426,10 +21640,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
21426
21640
|
* export class MyFileManager implements QdFileManager {
|
|
21427
21641
|
* private http = inject(HttpClient);
|
|
21428
21642
|
*
|
|
21429
|
-
* upload(file: File): Observable<QdUploadProgress> {
|
|
21643
|
+
* upload(file: File, details?: QdFileDetails): Observable<QdUploadProgress> {
|
|
21430
21644
|
* // Emit progress values from 0 to 100.
|
|
21431
21645
|
* // When done, return the final QdCollectedFile from your backend response.
|
|
21432
|
-
*
|
|
21646
|
+
* const formData = new FormData();
|
|
21647
|
+
* formData.append('file', file);
|
|
21648
|
+
* if (details?.fileName !== undefined) formData.append('fileName', details.fileName);
|
|
21649
|
+
* formData.append('metadata', JSON.stringify(details?.metadata ?? {}));
|
|
21650
|
+
*
|
|
21651
|
+
* return this.http.post('/api/files', formData).pipe(
|
|
21433
21652
|
* map(response => {
|
|
21434
21653
|
*
|
|
21435
21654
|
* const myCollectedFile: QdCollectedFile = {
|
|
@@ -21506,6 +21725,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
21506
21725
|
* - **outside a `QdSection`**: the component shows its own add button
|
|
21507
21726
|
* - **inside a `QdSection`**: the component listens to the section action and opens the file picker when `addNew` is triggered
|
|
21508
21727
|
*
|
|
21728
|
+
* When `metadata` or `fileNameInput` is configured, the upload dialog shows the
|
|
21729
|
+
* configured required fields, accepts one file, and starts the upload only after
|
|
21730
|
+
* the user selects **Save**. Without that configuration, uploads start
|
|
21731
|
+
* immediately and the existing multi-file behavior is preserved.
|
|
21732
|
+
*
|
|
21509
21733
|
* In `readonly` or `viewonly` mode, upload and delete are disabled.
|
|
21510
21734
|
*
|
|
21511
21735
|
* If the component is connected to operation mode changes through the event broker,
|
|
@@ -21529,6 +21753,7 @@ class QdFileCollectorComponent {
|
|
|
21529
21753
|
fileTypeService = inject(QdFileTypeService);
|
|
21530
21754
|
dialogService = inject(QdDialogService);
|
|
21531
21755
|
viewContainerRef = inject(ViewContainerRef);
|
|
21756
|
+
_changeDetectorRef = inject(ChangeDetectorRef);
|
|
21532
21757
|
/**
|
|
21533
21758
|
* Configuration settings for the file collector.
|
|
21534
21759
|
*/
|
|
@@ -21546,6 +21771,9 @@ class QdFileCollectorComponent {
|
|
|
21546
21771
|
get canShowAddButton() {
|
|
21547
21772
|
return !this.sectionActionService && !this.config?.readonly && !this._viewonly$.value;
|
|
21548
21773
|
}
|
|
21774
|
+
get requiresSingleFileUpload() {
|
|
21775
|
+
return this.fileCollectorService.requiresSingleFileUpload;
|
|
21776
|
+
}
|
|
21549
21777
|
ngOnInit() {
|
|
21550
21778
|
this.initializeConfig(this.config);
|
|
21551
21779
|
this.initViewMode();
|
|
@@ -21564,7 +21792,7 @@ class QdFileCollectorComponent {
|
|
|
21564
21792
|
handleFiles(event) {
|
|
21565
21793
|
const dialogRef = this.dialogService.open(QdFileCollectorDialogComponent, {
|
|
21566
21794
|
dialogSize: QdDialogSize.Default,
|
|
21567
|
-
hideCloseHeaderButton:
|
|
21795
|
+
hideCloseHeaderButton: !this.requiresSingleFileUpload,
|
|
21568
21796
|
disableClose: true,
|
|
21569
21797
|
title: { i18n: 'i18n.qd.fileCollector.title' },
|
|
21570
21798
|
viewContainerRef: this.viewContainerRef
|
|
@@ -21574,6 +21802,8 @@ class QdFileCollectorComponent {
|
|
|
21574
21802
|
(fileUploads ?? [])
|
|
21575
21803
|
.filter(fileUpload => !fileUpload.error && fileUpload.progress === 100)
|
|
21576
21804
|
.forEach(fileUpload => this.fileUploads.push({ ...fileUpload, newlyUploaded: true }));
|
|
21805
|
+
if (this.requiresSingleFileUpload)
|
|
21806
|
+
this._changeDetectorRef.detectChanges();
|
|
21577
21807
|
});
|
|
21578
21808
|
const fileCollectorDialog = dialogRef.componentInstance;
|
|
21579
21809
|
const inputElement = event.target;
|
|
@@ -21627,11 +21857,11 @@ class QdFileCollectorComponent {
|
|
|
21627
21857
|
console.error(`Quadrel Framework | QdFileCollector - ${message}`);
|
|
21628
21858
|
}
|
|
21629
21859
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
21630
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorComponent, isStandalone: false, selector: "qd-file-collector", inputs: { config: "config", testId: ["data-test-id", "testId"] }, providers: [QdFileCollectorService, QdFileCollectorValidationService], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (canShowAddButton) {\n<button qdButton qdButtonGhost icon=\"plus\" (click)=\"clickFileInput()\" [data-test-id]=\"testId + '-button-add-new'\">\n {{ config?.standaloneAddNewLabel?.i18n || \"i18n.qd.fileCollector.standalone.addNew\" | translate }}\n</button>\n}\n\n<input\n [disabled]=\"config?.readonly || config?.viewonly\"\n type=\"file\"\n (change)=\"handleFiles($event)\"\n #fileInput\n hidden\n multiple=\"multiple\"\n/>\n\n@if (!config?.readonly && !config?.viewonly) {\n<qd-file-collector-allowed-files-description\n [attr.data-test-id]=\"testId + '-allowed-files-description'\"\n></qd-file-collector-allowed-files-description>\n} @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) { @if (!fileUpload.error &&\nfileUpload.progress === 100) {\n<qd-file-collector-item\n [progress]=\"fileUpload.progress\"\n [newlyUploaded]=\"fileUpload.newlyUploaded\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [readonly]=\"config?.readonly\"\n [viewonly]=\"config?.viewonly\"\n [downloadFilesWithHttpClient]=\"config?.downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-item-' + i\"\n></qd-file-collector-item>\n} }\n", styles: [":host{display:flex;flex-direction:column}:host>.qd-button{align-self:end;margin-bottom:1.5rem}\n"], dependencies: [{ kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonGhostDirective, selector: "button[qdButtonGhost], a[qdButtonGhost]" }, { kind: "component", type: QdFileCollectorAllowedFilesDescriptionComponent, selector: "qd-file-collector-allowed-files-description" }, { kind: "component", type: QdFileCollectorItemComponent, selector: "qd-file-collector-item", inputs: ["progress", "newlyUploaded", "collectedFile", "error", "readonly", "viewonly", "downloadFilesWithHttpClient", "data-test-id"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
21860
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: QdFileCollectorComponent, isStandalone: false, selector: "qd-file-collector", inputs: { config: "config", testId: ["data-test-id", "testId"] }, providers: [QdFileCollectorService, QdFileCollectorValidationService], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "@if (canShowAddButton) {\n<button qdButton qdButtonGhost icon=\"plus\" (click)=\"clickFileInput()\" [data-test-id]=\"testId + '-button-add-new'\">\n {{ config?.standaloneAddNewLabel?.i18n || \"i18n.qd.fileCollector.standalone.addNew\" | translate }}\n</button>\n}\n\n<input\n [disabled]=\"config?.readonly || config?.viewonly\"\n type=\"file\"\n (change)=\"handleFiles($event)\"\n #fileInput\n hidden\n [attr.multiple]=\"requiresSingleFileUpload ? null : 'multiple'\"\n/>\n\n@if (!config?.readonly && !config?.viewonly) {\n<qd-file-collector-allowed-files-description\n [attr.data-test-id]=\"testId + '-allowed-files-description'\"\n></qd-file-collector-allowed-files-description>\n} @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) { @if (!fileUpload.error &&\nfileUpload.progress === 100) {\n<qd-file-collector-item\n [progress]=\"fileUpload.progress\"\n [newlyUploaded]=\"fileUpload.newlyUploaded\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [readonly]=\"config?.readonly\"\n [viewonly]=\"config?.viewonly\"\n [downloadFilesWithHttpClient]=\"config?.downloadFilesWithHttpClient\"\n [metadataFields]=\"config?.metadata ?? []\"\n [data-test-id]=\"testId + '-item-' + i\"\n></qd-file-collector-item>\n} }\n", styles: [":host{display:flex;flex-direction:column}:host>.qd-button{align-self:end;margin-bottom:1.5rem}\n"], dependencies: [{ kind: "component", type: QdButtonComponent, selector: "button[qdButton], a[qdButton]", inputs: ["disabled", "color", "icon", "data-test-id", "additionalInfo"] }, { kind: "directive", type: QdButtonGhostDirective, selector: "button[qdButtonGhost], a[qdButtonGhost]" }, { kind: "component", type: QdFileCollectorAllowedFilesDescriptionComponent, selector: "qd-file-collector-allowed-files-description" }, { kind: "component", type: QdFileCollectorItemComponent, selector: "qd-file-collector-item", inputs: ["progress", "newlyUploaded", "collectedFile", "error", "readonly", "viewonly", "downloadFilesWithHttpClient", "metadataFields", "data-test-id"] }, { kind: "pipe", type: i2.TranslatePipe, name: "translate" }] });
|
|
21631
21861
|
}
|
|
21632
21862
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorComponent, decorators: [{
|
|
21633
21863
|
type: Component,
|
|
21634
|
-
args: [{ selector: 'qd-file-collector', providers: [QdFileCollectorService, QdFileCollectorValidationService], standalone: false, template: "@if (canShowAddButton) {\n<button qdButton qdButtonGhost icon=\"plus\" (click)=\"clickFileInput()\" [data-test-id]=\"testId + '-button-add-new'\">\n {{ config?.standaloneAddNewLabel?.i18n || \"i18n.qd.fileCollector.standalone.addNew\" | translate }}\n</button>\n}\n\n<input\n [disabled]=\"config?.readonly || config?.viewonly\"\n type=\"file\"\n (change)=\"handleFiles($event)\"\n #fileInput\n hidden\n multiple=\"multiple\"\n/>\n\n@if (!config?.readonly && !config?.viewonly) {\n<qd-file-collector-allowed-files-description\n [attr.data-test-id]=\"testId + '-allowed-files-description'\"\n></qd-file-collector-allowed-files-description>\n} @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) { @if (!fileUpload.error &&\nfileUpload.progress === 100) {\n<qd-file-collector-item\n [progress]=\"fileUpload.progress\"\n [newlyUploaded]=\"fileUpload.newlyUploaded\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [readonly]=\"config?.readonly\"\n [viewonly]=\"config?.viewonly\"\n [downloadFilesWithHttpClient]=\"config?.downloadFilesWithHttpClient\"\n [data-test-id]=\"testId + '-item-' + i\"\n></qd-file-collector-item>\n} }\n", styles: [":host{display:flex;flex-direction:column}:host>.qd-button{align-self:end;margin-bottom:1.5rem}\n"] }]
|
|
21864
|
+
args: [{ selector: 'qd-file-collector', providers: [QdFileCollectorService, QdFileCollectorValidationService], standalone: false, template: "@if (canShowAddButton) {\n<button qdButton qdButtonGhost icon=\"plus\" (click)=\"clickFileInput()\" [data-test-id]=\"testId + '-button-add-new'\">\n {{ config?.standaloneAddNewLabel?.i18n || \"i18n.qd.fileCollector.standalone.addNew\" | translate }}\n</button>\n}\n\n<input\n [disabled]=\"config?.readonly || config?.viewonly\"\n type=\"file\"\n (change)=\"handleFiles($event)\"\n #fileInput\n hidden\n [attr.multiple]=\"requiresSingleFileUpload ? null : 'multiple'\"\n/>\n\n@if (!config?.readonly && !config?.viewonly) {\n<qd-file-collector-allowed-files-description\n [attr.data-test-id]=\"testId + '-allowed-files-description'\"\n></qd-file-collector-allowed-files-description>\n} @for (fileUpload of this.fileUploads; track fileUpload; let i = $index) { @if (!fileUpload.error &&\nfileUpload.progress === 100) {\n<qd-file-collector-item\n [progress]=\"fileUpload.progress\"\n [newlyUploaded]=\"fileUpload.newlyUploaded\"\n [collectedFile]=\"fileUpload.collectedFile\"\n [error]=\"fileUpload.error\"\n [readonly]=\"config?.readonly\"\n [viewonly]=\"config?.viewonly\"\n [downloadFilesWithHttpClient]=\"config?.downloadFilesWithHttpClient\"\n [metadataFields]=\"config?.metadata ?? []\"\n [data-test-id]=\"testId + '-item-' + i\"\n></qd-file-collector-item>\n} }\n", styles: [":host{display:flex;flex-direction:column}:host>.qd-button{align-self:end;margin-bottom:1.5rem}\n"] }]
|
|
21635
21865
|
}], propDecorators: { config: [{
|
|
21636
21866
|
type: Input
|
|
21637
21867
|
}], testId: [{
|
|
@@ -21658,6 +21888,8 @@ class QdFileCollectorModule {
|
|
|
21658
21888
|
QdFileCollectorUploadTimestampComponent,
|
|
21659
21889
|
QdFileSizePipe,
|
|
21660
21890
|
QdUploadTimestampPipe], imports: [CommonModule,
|
|
21891
|
+
QdFormModule,
|
|
21892
|
+
ReactiveFormsModule,
|
|
21661
21893
|
TranslateModule,
|
|
21662
21894
|
QdButtonModule,
|
|
21663
21895
|
QdChipModule,
|
|
@@ -21667,6 +21899,8 @@ class QdFileCollectorModule {
|
|
|
21667
21899
|
QdIconModule,
|
|
21668
21900
|
QdProgressBarModule], exports: [QdFileCollectorComponent] });
|
|
21669
21901
|
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdFileCollectorModule, imports: [CommonModule,
|
|
21902
|
+
QdFormModule,
|
|
21903
|
+
ReactiveFormsModule,
|
|
21670
21904
|
TranslateModule,
|
|
21671
21905
|
QdButtonModule,
|
|
21672
21906
|
QdChipModule,
|
|
@@ -21681,6 +21915,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
21681
21915
|
args: [{
|
|
21682
21916
|
imports: [
|
|
21683
21917
|
CommonModule,
|
|
21918
|
+
QdFormModule,
|
|
21919
|
+
ReactiveFormsModule,
|
|
21684
21920
|
TranslateModule,
|
|
21685
21921
|
QdButtonModule,
|
|
21686
21922
|
QdChipModule,
|
|
@@ -33010,7 +33246,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
33010
33246
|
args: ['data-test-id']
|
|
33011
33247
|
}] } });
|
|
33012
33248
|
|
|
33013
|
-
// @ts-strict-ignore
|
|
33014
33249
|
/**
|
|
33015
33250
|
* The **QdPageTab** is a single tab inside the **QdPageTabs** within a **QdPage**.
|
|
33016
33251
|
*
|
|
@@ -33027,25 +33262,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
|
|
|
33027
33262
|
* description: The only place for a tab. The tabs component collects them and renders the selected one.
|
|
33028
33263
|
*/
|
|
33029
33264
|
class QdPageTabComponent {
|
|
33030
|
-
_pageTabs = inject(forwardRef(() => QdPageTabsComponent));
|
|
33031
33265
|
/**
|
|
33032
|
-
* Configuration of
|
|
33033
|
-
*
|
|
33034
|
-
* * @note The use of CDK attributes is not permitted. Please configure this component here.
|
|
33266
|
+
* Configuration of the tab: label, name, id, counters and disabled state.
|
|
33035
33267
|
*/
|
|
33036
33268
|
config;
|
|
33037
|
-
/**
|
|
33038
|
-
|
|
33039
|
-
|
|
33040
|
-
|
|
33269
|
+
/**
|
|
33270
|
+
* Form control of this tab. Drives the error state of the tab header and is
|
|
33271
|
+
* marked as touched on submit. Leave it out for tabs without a form.
|
|
33272
|
+
*/
|
|
33041
33273
|
get tabControl() {
|
|
33042
|
-
return this.
|
|
33274
|
+
return this._control;
|
|
33275
|
+
}
|
|
33276
|
+
set tabControl(tabControl) {
|
|
33277
|
+
this._control = tabControl;
|
|
33043
33278
|
}
|
|
33279
|
+
/**
|
|
33280
|
+
* The `qd-page-info-banner` elements projected into this tab.
|
|
33281
|
+
* They render above the tab content while the tab is selected.
|
|
33282
|
+
*/
|
|
33044
33283
|
infoBanners;
|
|
33284
|
+
/**
|
|
33285
|
+
* Template with the projected tab content. QdPageTabs renders it for the selected tab.
|
|
33286
|
+
*/
|
|
33045
33287
|
content;
|
|
33046
|
-
stepControl;
|
|
33047
33288
|
interacted = false;
|
|
33048
33289
|
editable = true;
|
|
33290
|
+
_pageTabs = inject(forwardRef(() => QdPageTabsComponent));
|
|
33291
|
+
_destroyRef = inject(DestroyRef);
|
|
33292
|
+
_control;
|
|
33049
33293
|
get completed() {
|
|
33050
33294
|
if (!this.interacted)
|
|
33051
33295
|
return false;
|
|
@@ -33057,53 +33301,45 @@ class QdPageTabComponent {
|
|
|
33057
33301
|
get hasError() {
|
|
33058
33302
|
return this.interacted && !!this.tabControl?.invalid;
|
|
33059
33303
|
}
|
|
33060
|
-
_destroyed$ = new Subject();
|
|
33061
|
-
select() {
|
|
33062
|
-
const index = this._pageTabs.tabs.toArray().indexOf(this);
|
|
33063
|
-
if (index >= 0)
|
|
33064
|
-
this._pageTabs.selectedIndex = index;
|
|
33065
|
-
}
|
|
33066
33304
|
ngOnInit() {
|
|
33067
33305
|
this.validateLabel();
|
|
33068
33306
|
if (this.tabControl)
|
|
33069
33307
|
this.initErrorCheck();
|
|
33070
33308
|
}
|
|
33071
|
-
|
|
33072
|
-
|
|
33073
|
-
|
|
33074
|
-
|
|
33075
|
-
|
|
33076
|
-
|
|
33077
|
-
|
|
33078
|
-
}
|
|
33079
|
-
blockCdkInput(inputName) {
|
|
33080
|
-
throw new Error(`Quadrel Framework | QdPageTab - The use of the "${inputName}" attribute is not permitted. Please use QdPageTabConfig instead.`);
|
|
33309
|
+
/**
|
|
33310
|
+
* Selects this tab in the surrounding QdPageTabs.
|
|
33311
|
+
*/
|
|
33312
|
+
select() {
|
|
33313
|
+
const index = this._pageTabs.tabs.toArray().indexOf(this);
|
|
33314
|
+
if (index >= 0)
|
|
33315
|
+
this._pageTabs.selectedIndex = index;
|
|
33081
33316
|
}
|
|
33082
33317
|
validateLabel() {
|
|
33083
33318
|
if (!this.config?.label?.i18n)
|
|
33084
33319
|
console.error('Quadrel Framework | QdPageTab - Please provide a label for the tab.');
|
|
33085
33320
|
}
|
|
33086
33321
|
initErrorCheck() {
|
|
33087
|
-
this.
|
|
33088
|
-
|
|
33089
|
-
|
|
33090
|
-
}
|
|
33322
|
+
this.markInteractedOnError();
|
|
33323
|
+
this.tabControl.statusChanges.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
|
|
33324
|
+
this.markInteractedOnError();
|
|
33091
33325
|
this._pageTabs._stateChanged();
|
|
33092
33326
|
});
|
|
33093
33327
|
}
|
|
33328
|
+
markInteractedOnError() {
|
|
33329
|
+
if (this.hasAnyError(this.tabControl))
|
|
33330
|
+
this.interacted = true;
|
|
33331
|
+
}
|
|
33094
33332
|
hasAnyError(control) {
|
|
33095
33333
|
if (control.errors && control.touched)
|
|
33096
33334
|
return true;
|
|
33097
|
-
if (control instanceof FormGroup)
|
|
33098
|
-
return Object.values(control.controls).some(
|
|
33099
|
-
|
|
33100
|
-
|
|
33101
|
-
return control.controls.some(control => this.hasAnyError(control));
|
|
33102
|
-
}
|
|
33335
|
+
if (control instanceof FormGroup)
|
|
33336
|
+
return Object.values(control.controls).some(child => this.hasAnyError(child));
|
|
33337
|
+
if (control instanceof FormArray)
|
|
33338
|
+
return control.controls.some(child => this.hasAnyError(child));
|
|
33103
33339
|
return false;
|
|
33104
33340
|
}
|
|
33105
33341
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33106
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageTabComponent, isStandalone: true, selector: "qd-page-tab", inputs: { config: "config", tabControl: "tabControl" }, queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }],
|
|
33342
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageTabComponent, isStandalone: true, selector: "qd-page-tab", inputs: { config: "config", tabControl: "tabControl" }, queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: "<ng-template>\n <div class=\"page-info-banners\">\n <ng-content select=\"qd-page-info-banner\"></ng-content>\n </div>\n\n <ng-content></ng-content>\n</ng-template>\n", styles: [".page-info-banners:has(>qd-page-info-banner:not(.qd-page-info-banner-empty)){padding:1rem 1.25rem .5rem;border-bottom:rgb(213,213,213) solid .0625rem;background-color:#fff}.page-info-banners>qd-page-info-banner:last-child{margin-bottom:0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
33107
33343
|
}
|
|
33108
33344
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageTabComponent, decorators: [{
|
|
33109
33345
|
type: Component,
|