geonetwork-ui 2.4.0-dev.ac57b75b → 2.4.0-dev.c5f4c491
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/esm2022/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.mjs +17 -24
- package/esm2022/libs/feature/editor/src/lib/components/record-form/record-form.component.mjs +1 -2
- package/esm2022/libs/ui/inputs/src/lib/image-input/image-input.component.mjs +5 -11
- package/fesm2022/geonetwork-ui.mjs +20 -33
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts +1 -1
- package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts.map +1 -1
- package/libs/feature/editor/src/lib/components/record-form/record-form.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts +2 -4
- package/libs/ui/inputs/src/lib/image-input/image-input.component.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +0 -1
- package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +18 -23
- package/src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +0 -1
- package/src/libs/ui/inputs/src/lib/image-input/image-input.component.html +1 -1
- package/src/libs/ui/inputs/src/lib/image-input/image-input.component.ts +2 -7
package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
12
12
|
altTextChange: EventEmitter<string>;
|
|
13
13
|
resourceAltText: string;
|
|
14
14
|
resourceFileName: string;
|
|
15
|
-
resourceUrl:
|
|
15
|
+
resourceUrl: string;
|
|
16
16
|
constructor(recordsApiService: RecordsApiService, cd: ChangeDetectorRef);
|
|
17
17
|
ngOnInit(): void;
|
|
18
18
|
handleFileChange(file: File): void;
|
package/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview-upload.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAEZ,SAAS,EACT,MAAM,EAEN,aAAa,EACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;;
|
|
1
|
+
{"version":3,"file":"overview-upload.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAEZ,SAAS,EACT,MAAM,EAEN,aAAa,EACd,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;;AAE9F,qBAQa,uBAAwB,YAAW,MAAM,EAAE,SAAS;IAW7D,OAAO,CAAC,iBAAiB;IACzB,OAAO,CAAC,EAAE;IAXH,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAG,WAAW,CAAA;IACxB,cAAc,gCAA6C;IAC3D,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,CAAqB;IAElE,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;gBAGT,iBAAiB,EAAE,iBAAiB,EACpC,EAAE,EAAE,iBAAiB;IAG/B,QAAQ,IAAI,IAAI;IAqBhB,gBAAgB,CAAC,IAAI,EAAE,IAAI;IAmB3B,eAAe,CAAC,GAAG,EAAE,MAAM;IAmB3B,mBAAmB,CAAC,UAAU,EAAE,MAAM;IAWtC,YAAY;IAiBZ,OAAO,CAAC,WAAW,CAUlB;IAED,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;yCAlH9B,uBAAuB;2CAAvB,uBAAuB;CAuInC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record-form.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,4BAA4B,CAAA;;AAEnC,qBAQa,mBAAmB;IACX,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;IAEvC,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;
|
|
1
|
+
{"version":3,"file":"record-form.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/record-form/record-form.component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAG/C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,4BAA4B,CAAA;;AAEnC,qBAQa,mBAAmB;IACX,MAAM,EAAE,YAAY;gBAApB,MAAM,EAAE,YAAY;IAEvC,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;IAOhE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,GAAG;IAI7D,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,GAAG;yCAdzD,mBAAmB;2CAAnB,mBAAmB;CAiB/B"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { HttpClient } from '@angular/common/http';
|
|
2
2
|
import { ChangeDetectorRef, EventEmitter } from '@angular/core';
|
|
3
|
-
import { FormControl } from '@angular/forms';
|
|
4
3
|
import * as i0 from "@angular/core";
|
|
5
4
|
export declare class ImageInputComponent {
|
|
6
5
|
private http;
|
|
7
6
|
private cd;
|
|
8
|
-
formControl: FormControl;
|
|
9
7
|
maxSizeMB: number;
|
|
10
|
-
previewUrl?:
|
|
8
|
+
previewUrl?: string;
|
|
11
9
|
altText?: string;
|
|
12
10
|
uploadProgress?: number;
|
|
13
11
|
uploadError?: boolean;
|
|
@@ -41,6 +39,6 @@ export declare class ImageInputComponent {
|
|
|
41
39
|
private filterTypeImage;
|
|
42
40
|
private resizeAndEmit;
|
|
43
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<ImageInputComponent, never>;
|
|
44
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ImageInputComponent, "gn-ui-image-input", never, { "
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ImageInputComponent, "gn-ui-image-input", never, { "maxSizeMB": { "alias": "maxSizeMB"; "required": false; }; "previewUrl": { "alias": "previewUrl"; "required": false; }; "altText": { "alias": "altText"; "required": false; }; "uploadProgress": { "alias": "uploadProgress"; "required": false; }; "uploadError": { "alias": "uploadError"; "required": false; }; }, { "fileChange": "fileChange"; "urlChange": "urlChange"; "uploadCancel": "uploadCancel"; "delete": "delete"; "altTextChange": "altTextChange"; }, never, never, true, never>;
|
|
45
43
|
}
|
|
46
44
|
//# sourceMappingURL=image-input.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image-input.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/inputs/src/lib/image-input/image-input.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAGb,MAAM,eAAe,CAAA
|
|
1
|
+
{"version":3,"file":"image-input.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/inputs/src/lib/image-input/image-input.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EAEL,iBAAiB,EAEjB,YAAY,EAGb,MAAM,eAAe,CAAA;;AAUtB,qBAea,mBAAmB;IAqBlB,OAAO,CAAC,IAAI;IAAc,OAAO,CAAC,EAAE;IApBvC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,CAAqB;IACnD,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAqB;IACpD,YAAY,EAAE,YAAY,CAAC,IAAI,CAAC,CAAqB;IACrD,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,CAAqB;IAC/C,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,CAAqB;IAElE,aAAa,UAAQ;IACrB,YAAY,UAAQ;IACpB,aAAa,UAAQ;IACrB,gBAAgB,UAAQ;IAExB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAA;IAC/B,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;gBAEb,IAAI,EAAE,UAAU,EAAU,EAAE,EAAE,iBAAiB;IAEnE,cAAc;IAUd,gBAAgB;IAUhB,mBAAmB,CAAC,aAAa,EAAE,OAAO;IAO1C,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE;IAS7B,eAAe,CAAC,KAAK,EAAE,KAAK;IAQ5B,eAAe;IAKf,eAAe,CAAC,KAAK,EAAE,KAAK;IAKtB,WAAW;IAgCjB,wBAAwB;IAQxB,YAAY;IAIZ,WAAW;IAWX,YAAY;IAIZ,kBAAkB;IAIlB,mBAAmB,CAAC,KAAK,EAAE,KAAK;IAKhC,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,aAAa;yCAvJV,mBAAmB;2CAAnB,mBAAmB;CA8J/B"}
|
package/package.json
CHANGED
package/src/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts
CHANGED
|
@@ -15,12 +15,6 @@ import { UiInputsModule } from '../../../../../../../libs/ui/inputs/src'
|
|
|
15
15
|
import { FormControl } from '@angular/forms'
|
|
16
16
|
import { GraphicOverview } from '../../../../../../../libs/common/domain/src/lib/model/record'
|
|
17
17
|
|
|
18
|
-
const extractFileNameFromUrl = (url: string): string => {
|
|
19
|
-
const pattern = new RegExp(`attachments/([^/?#]+)(?:[/?#]|$)`, 'i')
|
|
20
|
-
const match = url.match(pattern)
|
|
21
|
-
return match ? match[1] : ''
|
|
22
|
-
}
|
|
23
|
-
|
|
24
18
|
@Component({
|
|
25
19
|
selector: 'gn-ui-overview-upload',
|
|
26
20
|
standalone: true,
|
|
@@ -35,9 +29,9 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
35
29
|
@Output() overviewChange = new EventEmitter<GraphicOverview | null>()
|
|
36
30
|
@Output() altTextChange: EventEmitter<string> = new EventEmitter()
|
|
37
31
|
|
|
38
|
-
resourceAltText
|
|
39
|
-
resourceFileName
|
|
40
|
-
resourceUrl:
|
|
32
|
+
resourceAltText: string
|
|
33
|
+
resourceFileName: string
|
|
34
|
+
resourceUrl: string
|
|
41
35
|
|
|
42
36
|
constructor(
|
|
43
37
|
private recordsApiService: RecordsApiService,
|
|
@@ -48,14 +42,13 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
48
42
|
this.recordsApiService.getAllResources(this.metadataUuid).subscribe({
|
|
49
43
|
next: (resources) => {
|
|
50
44
|
if (resources && resources.length > 0) {
|
|
51
|
-
this.resourceUrl =
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.resourceFileName = extractFileNameFromUrl(resources[0]?.url)
|
|
45
|
+
this.resourceUrl = resources[0].url
|
|
46
|
+
this.resourceFileName = resources[0].filename
|
|
47
|
+
if (!this.resourceAltText) {
|
|
48
|
+
this.resourceAltText = this.resourceFileName
|
|
49
|
+
}
|
|
57
50
|
} else {
|
|
58
|
-
this.resourceUrl =
|
|
51
|
+
this.resourceUrl = ''
|
|
59
52
|
this.resourceAltText = ''
|
|
60
53
|
this.resourceFileName = ''
|
|
61
54
|
}
|
|
@@ -71,7 +64,7 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
71
64
|
.putResource(this.metadataUuid, file, 'public')
|
|
72
65
|
.subscribe({
|
|
73
66
|
next: (resource) => {
|
|
74
|
-
this.resourceUrl =
|
|
67
|
+
this.resourceUrl = resource.url
|
|
75
68
|
this.resourceAltText = resource.filename
|
|
76
69
|
|
|
77
70
|
this.overviewChange.emit({
|
|
@@ -90,7 +83,7 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
90
83
|
.putResourceFromURL(this.metadataUuid, url, 'public')
|
|
91
84
|
.subscribe({
|
|
92
85
|
next: (resource) => {
|
|
93
|
-
this.resourceUrl =
|
|
86
|
+
this.resourceUrl = resource.url
|
|
94
87
|
this.resourceAltText = resource.filename
|
|
95
88
|
|
|
96
89
|
this.overviewChange.emit({
|
|
@@ -108,19 +101,21 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
108
101
|
this.resourceAltText = newAltText
|
|
109
102
|
|
|
110
103
|
this.overviewChange.emit({
|
|
111
|
-
url: this.resourceUrl,
|
|
104
|
+
url: new URL(this.resourceUrl),
|
|
112
105
|
description: this.resourceAltText,
|
|
113
106
|
})
|
|
107
|
+
|
|
114
108
|
this.cd.markForCheck()
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
handleDelete() {
|
|
112
|
+
//this.formControl.markAsDirty()
|
|
118
113
|
this.recordsApiService
|
|
119
114
|
.delResource(this.metadataUuid, this.resourceFileName)
|
|
120
115
|
.subscribe({
|
|
121
116
|
next: () => {
|
|
122
|
-
this.resourceAltText =
|
|
123
|
-
this.resourceUrl =
|
|
117
|
+
this.resourceAltText = ''
|
|
118
|
+
this.resourceUrl = ''
|
|
124
119
|
|
|
125
120
|
this.overviewChange.emit(null)
|
|
126
121
|
|
|
@@ -133,7 +128,7 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
133
128
|
private errorHandle = (error: never) => {
|
|
134
129
|
console.error(error)
|
|
135
130
|
|
|
136
|
-
this.resourceUrl =
|
|
131
|
+
this.resourceUrl = ''
|
|
137
132
|
this.resourceAltText = ''
|
|
138
133
|
this.resourceFileName = ''
|
|
139
134
|
|
|
@@ -157,7 +152,7 @@ export class OverviewUploadComponent implements OnInit, OnChanges {
|
|
|
157
152
|
} else {
|
|
158
153
|
return
|
|
159
154
|
}
|
|
160
|
-
if (overview.description
|
|
155
|
+
if (overview.description) {
|
|
161
156
|
this.resourceAltText = overview.description
|
|
162
157
|
this.cd.markForCheck()
|
|
163
158
|
}
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
<div class="w-full h-full flex flex-col gap-2">
|
|
52
52
|
<label
|
|
53
53
|
gnUiFilesDrop
|
|
54
|
-
class="block flex-1 border-2 border-dashed border-gray-300 rounded-lg p-6 flex flex-col items-center justify-center gap-4
|
|
54
|
+
class="block flex-1 border-2 border-dashed border-gray-300 rounded-lg p-6 flex flex-col items-center justify-center gap-4"
|
|
55
55
|
(dragFilesOver)="handleDragFilesOver($event)"
|
|
56
56
|
(dropFiles)="handleDropFiles($event)"
|
|
57
57
|
>
|
|
@@ -16,7 +16,6 @@ import { ButtonComponent } from '../button/button.component'
|
|
|
16
16
|
import { FilesDropDirective } from '../files-drop/files-drop.directive'
|
|
17
17
|
import { TranslateModule } from '@ngx-translate/core'
|
|
18
18
|
import { marker } from '@biesbjerg/ngx-translate-extract-marker'
|
|
19
|
-
import { FormControl, ReactiveFormsModule } from '@angular/forms'
|
|
20
19
|
|
|
21
20
|
@Component({
|
|
22
21
|
selector: 'gn-ui-image-input',
|
|
@@ -31,13 +30,11 @@ import { FormControl, ReactiveFormsModule } from '@angular/forms'
|
|
|
31
30
|
FilesDropDirective,
|
|
32
31
|
MatProgressSpinnerModule,
|
|
33
32
|
TranslateModule,
|
|
34
|
-
ReactiveFormsModule,
|
|
35
33
|
],
|
|
36
34
|
})
|
|
37
35
|
export class ImageInputComponent {
|
|
38
|
-
@Input() formControl!: FormControl
|
|
39
36
|
@Input() maxSizeMB: number
|
|
40
|
-
@Input() previewUrl?:
|
|
37
|
+
@Input() previewUrl?: string
|
|
41
38
|
@Input() altText?: string
|
|
42
39
|
@Input() uploadProgress?: number
|
|
43
40
|
@Input() uploadError?: boolean
|
|
@@ -130,8 +127,7 @@ export class ImageInputComponent {
|
|
|
130
127
|
const file = new File([blob], name)
|
|
131
128
|
this.fileChange.emit(file)
|
|
132
129
|
},
|
|
133
|
-
error: (
|
|
134
|
-
console.error(error)
|
|
130
|
+
error: () => {
|
|
135
131
|
this.downloadError = true
|
|
136
132
|
this.cd.markForCheck()
|
|
137
133
|
this.urlChange.emit(this.urlInputValue)
|
|
@@ -169,7 +165,6 @@ export class ImageInputComponent {
|
|
|
169
165
|
}
|
|
170
166
|
|
|
171
167
|
handleDelete() {
|
|
172
|
-
this.formControl.markAsDirty()
|
|
173
168
|
this.delete.emit()
|
|
174
169
|
}
|
|
175
170
|
|