@quadrel-enterprise-ui/framework 21.7.0 → 21.8.0

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.
@@ -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
- * return this.http.post('/api/files', file).pipe(
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: true,
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,
@@ -36927,7 +37163,12 @@ class QdPageStepComponent extends CdkStep {
36927
37163
  * * @note The use of CDK attributes is not permitted. Please configure this component here.
36928
37164
  */
36929
37165
  config;
36930
- control;
37166
+ /**
37167
+ * The form of the step, for example a QdFormGroup.
37168
+ *
37169
+ * The stepper only moves on to the next step when this form is valid. Optional steps skip this check.
37170
+ */
37171
+ stepControl;
36931
37172
  infoBanners;
36932
37173
  _destroyed$ = new Subject();
36933
37174
  constructor() {
@@ -36957,7 +37198,7 @@ class QdPageStepComponent extends CdkStep {
36957
37198
  console.error('Quadrel Framework | QdPageStep - Please provide a label for the step.');
36958
37199
  }
36959
37200
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdPageStepComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36960
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageStepComponent, isStandalone: true, selector: "qd-page-step", inputs: { config: "config", control: "control" }, host: { classAttribute: "qd-stepper" }, providers: [
37201
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: QdPageStepComponent, isStandalone: true, selector: "qd-page-step", inputs: { config: "config", stepControl: "stepControl" }, host: { classAttribute: "qd-stepper" }, providers: [
36961
37202
  { provide: CdkStep, useExisting: QdPageStepComponent },
36962
37203
  { provide: STEPPER_GLOBAL_OPTIONS, useValue: { showError: true } }
36963
37204
  ], queries: [{ propertyName: "infoBanners", predicate: QdPageInfoBannerComponent }], usesInheritance: true, usesOnChanges: 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 });
@@ -36970,7 +37211,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
36970
37211
  ], host: { class: 'qd-stepper' }, standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, 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"] }]
36971
37212
  }], ctorParameters: () => [], propDecorators: { config: [{
36972
37213
  type: Input
36973
- }], control: [{
37214
+ }], stepControl: [{
36974
37215
  type: Input
36975
37216
  }], infoBanners: [{
36976
37217
  type: ContentChildren,
@@ -37179,25 +37420,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37179
37420
  * #### Configuration
37180
37421
  *
37181
37422
  * ```ts
37182
- * type ColumnDefinition = 'rubrik' | 'data' | 'status';
37423
+ * type ColumnDefinition = 'category' | 'amount' | 'status';
37183
37424
  * const config: QdQuickEditConfig<ColumnDefinition> = {
37184
37425
  * columns: [
37185
37426
  * {
37186
- * name: 'rubrik',
37427
+ * name: 'category',
37187
37428
  * type: 'text',
37188
- * i18n: 'translation.key.rubrik',
37429
+ * i18n: 'translation.key.category',
37189
37430
  * isEditable: () => false
37190
37431
  * },
37191
37432
  * {
37192
- * name: 'data',
37433
+ * name: 'amount',
37193
37434
  * type: 'integer',
37194
- * i18n: 'translation.key.data',
37195
- * isEditable: (row, column) => !!row['rubrik'],
37435
+ * i18n: 'translation.key.amount',
37436
+ * isEditable: row => !!row['category'],
37196
37437
  * validators: [Validators.required] // only relevant in template data mode
37438
+ * },
37439
+ * {
37440
+ * name: 'status',
37441
+ * type: 'enum',
37442
+ * i18n: 'translation.key.status',
37443
+ * isEditable: () => true,
37444
+ * options: [
37445
+ * { value: '1', i18n: 'translation.key.status.active' },
37446
+ * { value: '0', i18n: 'translation.key.status.inactive' }
37447
+ * ]
37197
37448
  * }
37198
37449
  * ],
37199
- * canAdd: true,
37200
- * secondaryActions: [...]
37450
+ * canAdd: true
37201
37451
  * }
37202
37452
  * ```
37203
37453
  *
@@ -37207,39 +37457,64 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37207
37457
  *
37208
37458
  * ```ts
37209
37459
  * form = new FormGroup({
37210
- * data: new FormArray([
37460
+ * rows: new FormArray([
37211
37461
  * new FormGroup({
37212
- * rubrik: new QdFormControl('Text'),
37213
- * data: new QdFormControl(123)
37462
+ * category: new QdFormControl('Text'),
37463
+ * amount: new QdFormControl(123),
37464
+ * status: new QdFormControl('1')
37214
37465
  * })
37215
37466
  * ])
37216
37467
  * })
37217
37468
  * ```
37218
37469
  *
37219
- * Then bind the `formArrayName` directive in the template:
37470
+ * Then bind the `formArrayName` directive in the template. The name is the key of your FormArray,
37471
+ * it has nothing to do with the `data` input:
37220
37472
  *
37221
37473
  * ```html
37222
37474
  * <form [formGroup]="form">
37223
- * <qd-quick-edit [config]="config" formArrayName="data"></qd-quick-edit>
37475
+ * <qd-quick-edit [config]="config" formArrayName="rows"></qd-quick-edit>
37224
37476
  * </form>
37225
37477
  * ```
37226
37478
  *
37227
- * You can add new rows by reacting to `(addNewClicked)`:
37479
+ * In this mode the FormArray is the single source of truth for the rows. QuickEdit keeps no copy of its own.
37480
+ * What the FormArray holds is what the table shows.
37481
+ *
37482
+ * **Adding rows:** QuickEdit does not create the row for you. It emits `(addNewClicked)` and you insert a new FormGroup:
37483
+ *
37484
+ * ```ts
37485
+ * addRow(): void {
37486
+ * this.form.controls.rows.insert(0, new FormGroup({ ... }));
37487
+ * }
37488
+ * ```
37489
+ *
37490
+ * **Removing rows:** QuickEdit removes the row for you. It calls `removeAt(index)` on your FormArray.
37491
+ * There is no separate output event, because the FormArray already tells you: `valueChanges` fires, `length` and `controls` are updated.
37492
+ * The remove action only appears when `canAdd` is set — that one flag switches adding and removing on together.
37493
+ * With `hasRemoveConfirmation` or `removeConfirmationMessage` in the config, a confirmation dialog is shown first.
37494
+ * The row is only removed after the user confirms.
37495
+ *
37496
+ * **Reacting to a changed set of rows:** subscribe to the FormArray, not to QuickEdit. This covers both directions,
37497
+ * rows you insert and rows QuickEdit removes:
37228
37498
  *
37229
37499
  * ```ts
37230
- * addControl(): void {
37231
- * this.form.get('data')?.insert(0, new FormGroup({ ... }));
37500
+ * ngOnInit(): void {
37501
+ * this.form.controls.rows.valueChanges
37502
+ * .pipe(takeUntilDestroyed(this.destroyRef))
37503
+ * .subscribe(rows => (this.rowCount = rows.length));
37232
37504
  * }
37233
37505
  * ```
37234
37506
  *
37507
+ * **Row actions:** an entry of `config.secondaryActions` receives the value of its row, never its position.
37508
+ * Carry your own key in the row when the handler has to find that row again in your FormArray.
37509
+ *
37235
37510
  * #### Template Data (optional)
37236
37511
  *
37237
37512
  * Alternatively, you can provide a static `data` array. This is useful for read-only scenarios without reactive forms.
37238
37513
  *
37239
37514
  * ```ts
37240
- * const data: QdQuickEditData<MyColumns> = [
37241
- * { rubrik: 'Foo', data: 42 },
37242
- * { rubrik: 'Bar', data: 77 }
37515
+ * const data: QdQuickEditData<ColumnDefinition> = [
37516
+ * { category: 'Foo', amount: 42, status: '1' },
37517
+ * { category: 'Bar', amount: 77, status: '0' }
37243
37518
  * ];
37244
37519
  * ```
37245
37520
  *
@@ -37247,6 +37522,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37247
37522
  * <qd-quick-edit [config]="config" [data]="data"></qd-quick-edit>
37248
37523
  * ```
37249
37524
  *
37525
+ * **How this mode differs:** QuickEdit builds its own FormGroup with a `rows` FormArray from the `data` input.
37526
+ * Here QuickEdit is the source of truth, not your array.
37527
+ *
37528
+ * - Adding a row: QuickEdit inserts an empty row at the top itself. `(addNewClicked)` is not emitted.
37529
+ * - Removing a row: QuickEdit removes the row from its own FormArray and also from the `data` array you passed in (in place, via `splice`).
37530
+ * - Reacting to a changed set of rows: `(formGroupChange)` emits QuickEdit's FormGroup on every change. Read the rows from `formGroup.get('rows')`.
37531
+ * - Passing a new `data` array reference rebuilds all rows from that array.
37532
+ *
37250
37533
  * #### Validation
37251
37534
  *
37252
37535
  * - In **FormArray mode**, validators must be set directly on your FormControls. Validators in `config.columns` are ignored.
@@ -37270,39 +37553,46 @@ class QdQuickEditComponent {
37270
37553
  controlContainer = inject(ControlContainer, { optional: true, self: true });
37271
37554
  confirmationDialogService = inject(QdConfirmationDialogOpenerService);
37272
37555
  /**
37273
- * Configuration of the QuickEdit. The generic type specifies the column definition. <br />
37556
+ * Configuration of the QuickEdit. The generic type names the columns.
37274
37557
  *
37275
- * **Usage:**
37558
+ * Every column name must be a member of that type, and `name`, `type`, `i18n` and `isEditable`
37559
+ * are required on each column. The only column types are `text`, `integer` and `enum`.
37276
37560
  *
37277
37561
  * @example
37278
- * type ColumnDefinition = 'article' | 'mass' | 'documents';
37562
+ * type ColumnDefinition = 'article' | 'mass' | 'unit';
37279
37563
  * const config: QdQuickEditConfig<ColumnDefinition> = {
37280
37564
  * columns: [
37281
37565
  * {
37282
- * name: 'rubrik',
37566
+ * name: 'article',
37283
37567
  * type: 'text',
37284
- * i18n: 'translation.key.rubrik',
37568
+ * i18n: 'translation.key.article',
37285
37569
  * isEditable: () => false
37286
37570
  * },
37287
37571
  * {
37288
- * name: 'data',
37572
+ * name: 'mass',
37289
37573
  * type: 'integer',
37290
- * i18n: 'translation.key.data',
37291
- * isEditable: (row, column) => row['active'] == 1,
37292
- * validators: [Validators.required]
37574
+ * i18n: 'translation.key.mass',
37575
+ * isEditable: row => row['article'] != null,
37576
+ * validators: [Validators.required] // only applied in template data mode
37293
37577
  * },
37294
37578
  * {
37295
- * name: 'size',
37296
- * type: 'boolean',
37297
- * i18n: 'translation.key.size',
37298
- * validators: [customValidatorFunction()]
37579
+ * name: 'unit',
37580
+ * type: 'enum',
37581
+ * i18n: 'translation.key.unit',
37582
+ * isEditable: () => true,
37583
+ * options: [
37584
+ * { value: 'kg', i18n: 'translation.key.unit.kg' },
37585
+ * { value: 't', i18n: 'translation.key.unit.t' }
37586
+ * ]
37299
37587
  * }
37300
- * ]
37588
+ * ],
37589
+ * canAdd: true
37301
37590
  * }
37302
37591
  */
37303
37592
  config;
37304
37593
  /**
37305
- * Data provider for QuickEdit.
37594
+ * Data provider for QuickEdit. Only used in template data mode.
37595
+ * QuickEdit removes rows from this array in place. Ignored when `formArrayName` is bound.
37306
37596
  */
37307
37597
  data;
37308
37598
  get templateData() {
@@ -37319,8 +37609,13 @@ class QdQuickEditComponent {
37319
37609
  /**
37320
37610
  * The form group instance of QdQuickEdit.
37321
37611
  * Use this form group to bind it to step-control of QdStepper or other custom logics.
37612
+ * Only emits in template data mode. In FormArray mode your own FormArray is the source of truth.
37322
37613
  */
37323
37614
  formGroupChange = new EventEmitter();
37615
+ /**
37616
+ * Emitted in FormArray mode when the user clicks the add button.
37617
+ * Insert a new FormGroup into your FormArray. Not emitted in template data mode.
37618
+ */
37324
37619
  addNewClicked = new EventEmitter();
37325
37620
  focusables;
37326
37621
  customForDirective;
@@ -37344,6 +37639,9 @@ class QdQuickEditComponent {
37344
37639
  get visibleColumns() {
37345
37640
  return this.config.columns.filter(column => !column.isHidden);
37346
37641
  }
37642
+ /**
37643
+ * Track function for the column loop. Keeps a column's cells alive while the rows change.
37644
+ */
37347
37645
  trackByColumnName(_, column) {
37348
37646
  return column.name;
37349
37647
  }
@@ -37376,20 +37674,38 @@ class QdQuickEditComponent {
37376
37674
  this._destroyed$.next();
37377
37675
  this._destroyed$.complete();
37378
37676
  }
37677
+ /**
37678
+ * Whether a secondary action is disabled for one row.
37679
+ * Resolves the `isDisabled` of the action, which may be a flag or a function of the row.
37680
+ */
37379
37681
  isActionDisabled(action, row) {
37380
37682
  if (typeof action.isDisabled === 'function')
37381
37683
  return action.isDisabled(row);
37382
37684
  return !!action.isDisabled;
37383
37685
  }
37686
+ /**
37687
+ * Runs the handler of a secondary action for one row.
37688
+ * The handler receives the row value only, never its position.
37689
+ */
37384
37690
  handleSecondaryAction(action, rowIndex) {
37385
37691
  if (!action)
37386
37692
  return;
37387
37693
  const selectedRowData = this.controlContainer?.control?.controls[rowIndex].value ?? this.rows.value[rowIndex];
37388
37694
  action.handler(selectedRowData);
37389
37695
  }
37696
+ /**
37697
+ * Maps a column type onto a facet component.
37698
+ *
37699
+ * @deprecated Nothing calls this any more, the template renders the cells directly. Planned for v22.
37700
+ */
37390
37701
  getComponentType(column) {
37391
37702
  return COMPONENT_MAP[column.type] || null;
37392
37703
  }
37704
+ /**
37705
+ * Builds the inputs of the facet component for one cell.
37706
+ *
37707
+ * @deprecated Nothing calls this any more, the template renders the cells directly. Planned for v22.
37708
+ */
37393
37709
  getComponentInputs(column, row) {
37394
37710
  const testId = this.testId && this.testId + '-cell-' + column.name;
37395
37711
  if (column.type === 'enum')
@@ -37399,6 +37715,10 @@ class QdQuickEditComponent {
37399
37715
  };
37400
37716
  return { data: row[column.name], testId };
37401
37717
  }
37718
+ /**
37719
+ * Adds a row and focuses its first field.
37720
+ * FormArray mode: emits `addNewClicked` and leaves the insert to you. Template data mode: inserts an empty row at the top.
37721
+ */
37402
37722
  createRow() {
37403
37723
  this.redrawOnNextChange();
37404
37724
  if (this.controlContainer) {
@@ -37416,6 +37736,10 @@ class QdQuickEditComponent {
37416
37736
  this.changeDetectorRef.detectChanges();
37417
37737
  window.setTimeout(() => this.focusFirstControl());
37418
37738
  }
37739
+ /**
37740
+ * Removes the row at `index`, after the confirmation dialog when one is configured.
37741
+ * FormArray mode: calls `removeAt(index)` on your FormArray, no extra event. Template data mode: removes from the internal FormArray and from `data`.
37742
+ */
37419
37743
  removeRow(index) {
37420
37744
  const { hasRemoveConfirmation, removeConfirmationMessage } = this.config;
37421
37745
  if (hasRemoveConfirmation || removeConfirmationMessage) {
@@ -37522,6 +37846,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
37522
37846
  args: [QdCustomForDirective]
37523
37847
  }] } });
37524
37848
 
37849
+ /**
37850
+ * Provides {@link QdQuickEditComponent} for editing rows inline.
37851
+ *
37852
+ * Import it where the table is used. It brings the form controls the cells need.
37853
+ */
37525
37854
  class QdQuickEditModule {
37526
37855
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: QdQuickEditModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
37527
37856
  static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.17", ngImport: i0, type: QdQuickEditModule, declarations: [QdQuickEditComponent, QdCustomForDirective], imports: [QdCoreModule,