From 06f63ce66ade93519db8a1c0b7208da0685d171d Mon Sep 17 00:00:00 2001 From: cmoinier Date: Fri, 30 Aug 2024 16:57:44 +0200 Subject: [PATCH 01/27] change name of resource update field, now used for two date fields --- .../form-field-date-updated.component.css} | 0 .../form-field-date-updated.component.html} | 0 .../form-field-date-updated.component.spec.ts} | 11 +++++------ .../form-field-date-updated.component.ts} | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) rename libs/feature/editor/src/lib/components/record-form/form-field/{form-field-resource-updated/form-field-resource-updated.component.css => form-field-date-updated/form-field-date-updated.component.css} (100%) rename libs/feature/editor/src/lib/components/record-form/form-field/{form-field-resource-updated/form-field-resource-updated.component.html => form-field-date-updated/form-field-date-updated.component.html} (100%) rename libs/feature/editor/src/lib/components/record-form/form-field/{form-field-resource-updated/form-field-resource-updated.component.spec.ts => form-field-date-updated/form-field-date-updated.component.spec.ts} (56%) rename libs/feature/editor/src/lib/components/record-form/form-field/{form-field-resource-updated/form-field-resource-updated.component.ts => form-field-date-updated/form-field-date-updated.component.ts} (63%) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.css b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.css similarity index 100% rename from libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.css rename to libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.css diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.html similarity index 100% rename from libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.html rename to libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.html diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.spec.ts similarity index 56% rename from libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts rename to libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.spec.ts index 5765cc29d2..0f61d940d0 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.spec.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.spec.ts @@ -1,21 +1,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { FormControl } from '@angular/forms' -import { FormFieldResourceUpdatedComponent } from './form-field-resource-updated.component' +import { FormFieldDateUpdatedComponent } from './form-field-date-updated.component' describe('FormFieldResourceUpdatedComponent', () => { - let component: FormFieldResourceUpdatedComponent - let fixture: ComponentFixture + let component: FormFieldDateUpdatedComponent + let fixture: ComponentFixture beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [FormFieldResourceUpdatedComponent], + imports: [FormFieldDateUpdatedComponent], }).compileComponents() - fixture = TestBed.createComponent(FormFieldResourceUpdatedComponent) + fixture = TestBed.createComponent(FormFieldDateUpdatedComponent) component = fixture.componentInstance const control = new FormControl() control.setValue(new Date()) - component.control = control fixture.detectChanges() }) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.ts similarity index 63% rename from libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts rename to libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.ts index 31c377ca71..9ad67ad7d7 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-resource-updated/form-field-resource-updated.component.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-date-updated/form-field-date-updated.component.ts @@ -8,14 +8,14 @@ import { import { DatePickerComponent } from '@geonetwork-ui/ui/inputs' @Component({ - selector: 'gn-ui-form-field-resource-updated', - templateUrl: './form-field-resource-updated.component.html', - styleUrls: ['./form-field-resource-updated.component.css'], + selector: 'gn-ui-form-field-date-updated', + templateUrl: './form-field-date-updated.component.html', + styleUrls: ['./form-field-date-updated.component.css'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [DatePickerComponent], }) -export class FormFieldResourceUpdatedComponent { +export class FormFieldDateUpdatedComponent { @Input() value: Date @Output() valueChange: EventEmitter = new EventEmitter() } From 7a0db1e7fa27add8a39f2ba290404034160892e3 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Sat, 31 Aug 2024 20:59:18 +0200 Subject: [PATCH 02/27] add sidebar to edit page --- .../src/app/edit/edit-page.component.html | 63 ++++++++++--------- .../src/app/edit/edit-page.component.ts | 2 + 2 files changed, 36 insertions(+), 29 deletions(-) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index ca2cae43aa..78cc273543 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -1,33 +1,38 @@ -
-
- - -
-
-
- +
+ +
+
+ +
- -
-
- - {{ - (currentPage$ | async) === 0 - ? ('editor.record.form.bottomButtons.comeBackLater' | translate) - : ('editor.record.form.bottomButtons.previous' | translate) - }} - - editor.record.form.bottomButtons.next +
+ +
+ +
+
+ + {{ + (currentPage$ | async) === 0 + ? ('editor.record.form.bottomButtons.comeBackLater' | translate) + : ('editor.record.form.bottomButtons.previous' | translate) + }} + + editor.record.form.bottomButtons.next +
diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.ts b/apps/metadata-editor/src/app/edit/edit-page.component.ts index 02514391db..76e5fb02a9 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.ts +++ b/apps/metadata-editor/src/app/edit/edit-page.component.ts @@ -18,6 +18,7 @@ import { filter, firstValueFrom, Subscription, take } from 'rxjs' import { PageSelectorComponent } from './components/page-selector/page-selector.component' import { marker } from '@biesbjerg/ngx-translate-extract-marker' import { map } from 'rxjs/operators' +import { SidebarComponent } from '../dashboard/sidebar/sidebar.component' marker('editor.record.form.bottomButtons.comeBackLater') marker('editor.record.form.bottomButtons.previous') @@ -38,6 +39,7 @@ marker('editor.record.form.bottomButtons.next') NotificationsContainerComponent, PageSelectorComponent, TranslateModule, + SidebarComponent, ], }) export class EditPageComponent implements OnInit, OnDestroy { From 72e325ee342b9920982904d26517ce0897f3c512 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Sat, 31 Aug 2024 21:00:52 +0200 Subject: [PATCH 03/27] polish autocomplete component --- .../autocomplete/autocomplete.component.css | 2 + .../autocomplete/autocomplete.component.html | 52 ++++++++++++------- .../autocomplete/autocomplete.component.ts | 3 +- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css index cc2ca1991e..8e578e9afa 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.css @@ -9,6 +9,7 @@ width: var(--input-height); height: 100%; border-left-width: 0.1em; + background-color: white; } mat-icon { width: 100%; @@ -20,6 +21,7 @@ input { height: var(--input-height); padding: 1.05em; padding-right: calc(2 * var(--input-height)); + width: calc(100% - var(--input-height)); } input:placeholder-shown { text-overflow: ellipsis; diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html index 4e9e994bd0..c42d662e5a 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html @@ -1,23 +1,5 @@ -
- -
- + +
+
+ +
+ + + +
+ + + + + +
() @Output() inputSubmitted = new EventEmitter() @Output() inputCleared = new EventEmitter() From 41eb4cd8cc74c0e6d9b9a31bf2df78f30bdb9d9e Mon Sep 17 00:00:00 2001 From: cmoinier Date: Sat, 31 Aug 2024 21:03:51 +0200 Subject: [PATCH 04/27] improve styling and translation of keywords input --- .../generic-keywords/generic-keywords.component.html | 3 ++- .../components/generic-keywords/generic-keywords.component.ts | 2 ++ .../form-field-keywords/form-field-keywords.component.html | 3 ++- .../form-field-keywords/form-field-keywords.component.ts | 1 - translations/de.json | 1 + translations/en.json | 1 + translations/es.json | 1 + translations/fr.json | 1 + translations/it.json | 1 + translations/nl.json | 1 + translations/pt.json | 1 + translations/sk.json | 1 + 12 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html b/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html index 71081a9a53..41d82a4b6c 100644 --- a/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html +++ b/libs/feature/editor/src/lib/components/generic-keywords/generic-keywords.component.html @@ -6,7 +6,8 @@ (itemSelected)="handleItemSelection($event)" [preventCompleteOnSelection]="true" [minCharacterCount]="0" - [allowSubmit]="false" + [allowSubmit]="allowSubmit" + [searchFirst]="searchFirst" >
= new EventEmitter() @Output() addedKeyword: EventEmitter = new EventEmitter() @Output() deletedKeyword: EventEmitter = new EventEmitter() diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html index 7db0e989f0..34ffc39663 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.html @@ -2,8 +2,9 @@
diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts index 381146ebb1..ae6bbabdc5 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-keywords/form-field-keywords.component.ts @@ -42,7 +42,6 @@ export class FormFieldKeywordsComponent { @Output() valueChange: EventEmitter = new EventEmitter() keywordTypes = ['temporal', 'theme', 'other'] as KeywordType[] - placeholder = 'editor.form.keywords.placeholder' get filteredKeywords(): Keyword[] { return ( diff --git a/translations/de.json b/translations/de.json index 4787c1cbca..0ae7eccdb4 100644 --- a/translations/de.json +++ b/translations/de.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "unbekannt", "downloads.wfs.featuretype.not.found": "Der Layer wurde nicht gefunden", "dropFile": "Datei ablegen", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "Stornieren", "editor.record.delete.confirmation.confirmText": "Löschen", diff --git a/translations/en.json b/translations/en.json index 5ce2162159..9fc876c63f 100644 --- a/translations/en.json +++ b/translations/en.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "unknown", "downloads.wfs.featuretype.not.found": "The layer was not found", "dropFile": "drop file", + "editor.form.keywords.placeholder": "Select a keyword", "editor.form.placeKeywordWithoutExtent": "This keyword is not associated with a geographical extent", "editor.record.delete.confirmation.cancelText": "Cancel", "editor.record.delete.confirmation.confirmText": "Delete", diff --git a/translations/es.json b/translations/es.json index cb9c7a2ef0..6f06be151f 100644 --- a/translations/es.json +++ b/translations/es.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "", "downloads.wfs.featuretype.not.found": "", "dropFile": "", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "", "editor.record.delete.confirmation.confirmText": "", diff --git a/translations/fr.json b/translations/fr.json index 80868136e8..5c35461f81 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "inconnu", "downloads.wfs.featuretype.not.found": "La couche n'a pas été retrouvée", "dropFile": "Faites glisser votre fichier", + "editor.form.keywords.placeholder": "Sélectionner un mot-clé", "editor.form.placeKeywordWithoutExtent": "Ce mot-clé n'a pas de localisation géographique associée", "editor.record.delete.confirmation.cancelText": "Annuler", "editor.record.delete.confirmation.confirmText": "Supprimer", diff --git a/translations/it.json b/translations/it.json index 7d048701dd..ab4b661dfa 100644 --- a/translations/it.json +++ b/translations/it.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "sconosciuto", "downloads.wfs.featuretype.not.found": "Il layer non è stato trovato", "dropFile": "Trascina il suo file", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "", "editor.record.delete.confirmation.confirmText": "", diff --git a/translations/nl.json b/translations/nl.json index a0db9c7932..8a3fd691e6 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "", "downloads.wfs.featuretype.not.found": "", "dropFile": "", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "", "editor.record.delete.confirmation.confirmText": "", diff --git a/translations/pt.json b/translations/pt.json index 28f3337e93..ecf18380ba 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "", "downloads.wfs.featuretype.not.found": "", "dropFile": "", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "", "editor.record.delete.confirmation.confirmText": "", diff --git a/translations/sk.json b/translations/sk.json index 7de804bd25..d1ce1d9d8c 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -186,6 +186,7 @@ "downloads.format.unknown": "neznámy", "downloads.wfs.featuretype.not.found": "Vrstva nebola nájdená", "dropFile": "nahrať súbor", + "editor.form.keywords.placeholder": "", "editor.form.placeKeywordWithoutExtent": "", "editor.record.delete.confirmation.cancelText": "", "editor.record.delete.confirmation.confirmText": "", From 8ea45b7f47e2f694e08317829993fa114ba999d1 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Sat, 31 Aug 2024 21:07:38 +0200 Subject: [PATCH 05/27] polish textarea --- .../form-field-rich/form-field-rich.component.html | 9 ++++++--- .../form-field-rich/form-field-rich.component.ts | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html index f642cf6ae5..2036504f59 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-rich/form-field-rich.component.html @@ -2,15 +2,18 @@ - {{ - preview ? 'visibility' : 'visibility_off' - }} + {{ preview ? 'visibility' : 'visibility_off' }} {{ preview ? 'WYSIWYG' : 'Markdown' }} Date: Sat, 31 Aug 2024 21:08:16 +0200 Subject: [PATCH 06/27] new classes for gn-ui-btn --- .../inputs/src/lib/button/button.component.ts | 19 +++++++++++++- .../image-input/image-input.component.html | 25 +++++++++++-------- tailwind.base.css | 25 +++++++++++++++++++ 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/libs/ui/inputs/src/lib/button/button.component.ts b/libs/ui/inputs/src/lib/button/button.component.ts index a2339085dc..8a1c6e24ff 100644 --- a/libs/ui/inputs/src/lib/button/button.component.ts +++ b/libs/ui/inputs/src/lib/button/button.component.ts @@ -18,7 +18,15 @@ export class ButtonComponent { private btnClass = 'gn-ui-btn-default' @Input() set type( - value: 'primary' | 'secondary' | 'default' | 'outline' | 'light' + value: + | 'primary' + | 'secondary' + | 'default' + | 'outline' + | 'light' + | 'big-gray' + | 'md-gray' + | 'sm-gray' ) { // btn-classes are written in full to be picked up by tailwind switch (value) { @@ -34,6 +42,15 @@ export class ButtonComponent { case 'light': this.btnClass = 'gn-ui-btn-light' break + case 'big-gray': + this.btnClass = 'gn-ui-btn-big-gray' + break + case 'md-gray': + this.btnClass = 'gn-ui-btn-md-gray' + break + case 'sm-gray': + this.btnClass = 'gn-ui-btn-sm-gray' + break default: this.btnClass = 'gn-ui-btn-default' break diff --git a/libs/ui/inputs/src/lib/image-input/image-input.component.html b/libs/ui/inputs/src/lib/image-input/image-input.component.html index c21875a5ba..2231b3c779 100644 --- a/libs/ui/inputs/src/lib/image-input/image-input.component.html +++ b/libs/ui/inputs/src/lib/image-input/image-input.component.html @@ -24,21 +24,23 @@ [placeholder]="'input.image.altTextPlaceholder' | translate" [value]="altText ?? ''" (valueChange)="handleAltTextChange($event)" + extraClass="gn-ui-editor-textarea" > -
- - delete +
+ + delete {{ 'input.image.delete' | translate }} - add + add {{ 'input.image.displayAltTextInput' | translate }}
@@ -125,12 +127,15 @@ /> -
+
- link + link {{ 'input.image.displayUrlInput' | translate }}
diff --git a/tailwind.base.css b/tailwind.base.css index 799bdfdcd4..d302856399 100644 --- a/tailwind.base.css +++ b/tailwind.base.css @@ -14,6 +14,7 @@ font-size: 16px; width: 16px; height: 16px; + color: text-primary; } .gn-ui-icon-medium { font-size: 20px; @@ -93,6 +94,22 @@ border border-secondary focus:ring-4 focus:ring-secondary-lightest; } + .gn-ui-btn-big-gray { + @apply gn-ui-btn text-black + bg-gray-200 hover:bg-gray-400 focus:bg-gray-400 active:bg-gray-400 + border border-gray-400 focus:ring-4 focus:ring-gray-100; + } + + .gn-ui-btn-md-gray { + @apply gn-ui-btn text-black font-bold + bg-gray-200 rounded-lg h-[32px] hover:bg-gray-400 focus:bg-gray-400 active:bg-gray-400; + } + + .gn-ui-btn-sm-gray { + @apply gn-ui-btn text-black font-bold + rounded-[1.25rem] p-[0.375rem] text-xs font-medium w-24; + } + .gn-ui-btn-outline { @apply gn-ui-btn text-main hover:text-primary-darker focus:text-primary-darker active:text-primary-black @@ -156,6 +173,14 @@ mat-progress-spinner circle { stroke: currentColor !important; } + + .gn-ui-autocomplete { + @apply relative border-2 border-gray-300 rounded-md transition-colors duration-75 focus:outline-none focus:border-main hover:border-main; + } + + .gn-ui-editor-textarea { + @apply gn-ui-text-input rounded-lg; + } } html { From 088e0c01b7313a6cef892714a6a6fdfd4d130e69 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Sat, 31 Aug 2024 21:10:42 +0200 Subject: [PATCH 07/27] diverse spacing and positionning --- .../form-field-spatial-extent.component.html | 4 +- ...form-field-update-frequency.component.html | 30 ++++++------ .../form-field/form-field.component.html | 40 ++++++++-------- .../form-field/form-field.component.spec.ts | 2 +- .../form-field/form-field.component.ts | 4 +- .../record-form/form-field/index.ts | 2 +- .../record-form/record-form.component.html | 46 ++++++++++++------- .../record-form/record-form.component.ts | 5 ++ .../markdown-editor.component.html | 1 + .../markdown-editor.component.ts | 1 + .../form-field-wrapper.component.html | 2 +- 11 files changed, 81 insertions(+), 56 deletions(-) diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html index ac34b1fab6..11fd955925 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-spatial-extent/form-field-spatial-extent.component.html @@ -10,10 +10,12 @@ [keywordTypes]="['place']" (deletedKeyword)="handleKeywordDelete($event)" (addedKeyword)="handleKeywordAdd($event)" + [allowSubmit]="true" + [searchFirst]="true" >
-
+
diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.html index bea8e2d5aa..9d784ff973 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-update-frequency/form-field-update-frequency.component.html @@ -1,14 +1,16 @@ - - - +
+ + + +
diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html index 61a0444d9d..7a190b724f 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html @@ -5,7 +5,7 @@ (openDataChange)="isHidden = $event" > -
+
@@ -22,25 +22,27 @@ -
+
- edit - - help - +
+ edit + + help + +
@@ -68,18 +70,16 @@ > - + > - + >
- - - + + + + - +
diff --git a/libs/feature/editor/src/lib/components/record-form/record-form.component.ts b/libs/feature/editor/src/lib/components/record-form/record-form.component.ts index 9700da13fe..149e9851d8 100644 --- a/libs/feature/editor/src/lib/components/record-form/record-form.component.ts +++ b/libs/feature/editor/src/lib/components/record-form/record-form.component.ts @@ -40,4 +40,9 @@ export class RecordFormComponent { sectionTracker(index: number, section: EditorSectionWithValues) { return section.labelKey } + + isAboutSection(section) { + console.log(section) + return section.labelKey === 'editor.record.form.section.about.label' + } } diff --git a/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html b/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html index 8ca9711c10..e7a3b9f863 100644 --- a/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html +++ b/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html @@ -7,6 +7,7 @@

= new EventEmitter() diff --git a/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html b/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html index b15f54ee58..0705f5d8c4 100644 --- a/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html +++ b/libs/ui/layout/src/lib/form-field-wrapper/form-field-wrapper.component.html @@ -12,7 +12,7 @@
-
+
From c362c619bc989fc1a9704701433cc6b1e961a0d3 Mon Sep 17 00:00:00 2001 From: cmoinier Date: Mon, 2 Sep 2024 14:08:48 +0200 Subject: [PATCH 08/27] improve about section positionning --- .../record-form/record-form.component.html | 14 ++++---------- .../record-form/record-form.component.ts | 9 ++++++++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/libs/feature/editor/src/lib/components/record-form/record-form.component.html b/libs/feature/editor/src/lib/components/record-form/record-form.component.html index 63ad9bb01a..b5bf169d61 100644 --- a/libs/feature/editor/src/lib/components/record-form/record-form.component.html +++ b/libs/feature/editor/src/lib/components/record-form/record-form.component.html @@ -28,9 +28,9 @@
Date: Mon, 2 Sep 2024 15:12:31 +0200 Subject: [PATCH 09/27] move additionnal classes to tailwind base --- .../src/app/edit/edit-page.component.html | 2 +- .../lib/autocomplete/autocomplete.component.html | 8 ++++---- libs/ui/inputs/src/lib/button/button.component.ts | 6 +++--- tailwind.base.css | 14 +++++++++++++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index 78cc273543..c7b25f99d2 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -18,7 +18,7 @@ class="p-8 mt-auto flex flex-row justify-between" > diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html index c42d662e5a..a4e289b864 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.html @@ -1,8 +1,8 @@ -
+
+ +
+ search
- + + + close + + + search + -
- - - -
- - - - - -
search.autocomplete.error {{ error }} -
+
+ { fixture.detectChanges() }) it('is not visible', () => { - expect(fixture.debugElement.query(By.css('.clear-btn'))).toBeNull() + expect( + fixture.debugElement.query(By.css('[data-test=clear-btn] button')) + ).toBeNull() }) }) describe('when input is not empty', () => { @@ -143,7 +145,9 @@ describe('AutocompleteComponent', () => { component.inputSubmitted.subscribe(() => (anyEmitted = true)) component.inputCleared.subscribe(() => (clearEmitted = true)) fixture.detectChanges() - button = fixture.debugElement.query(By.css('.clear-btn')) + button = fixture.debugElement.query( + By.css('[data-test=clear-btn] button') + ) button.nativeElement.click() }) it('is visible', () => { @@ -179,7 +183,9 @@ describe('AutocompleteComponent', () => { component.triggerRef.closePanel = jest.fn() component.inputSubmitted.subscribe((event) => anyEmitted.push(event)) component.inputRef.nativeElement.value = 'bla' - const button = fixture.debugElement.query(By.css('.search-btn')) + const button = fixture.debugElement.query( + By.css('[data-test=autocomplete-submit-btn] button') + ) button.nativeElement.click() }) it('sends a submitted value', () => { @@ -191,7 +197,9 @@ describe('AutocompleteComponent', () => { fixture.detectChanges() component.inputSubmitted.subscribe((event) => anyEmitted.push(event)) component.inputRef.nativeElement.value = '' - const button = fixture.debugElement.query(By.css('.search-btn')) + const button = fixture.debugElement.query( + By.css('[data-test=autocomplete-submit-btn] button') + ) button.nativeElement.click() }) it('sends an empty value', () => { @@ -216,7 +224,7 @@ describe('AutocompleteComponent', () => { }) it('does not show a submit button', () => { const button = fixture.debugElement.query( - By.css('[data-test=autocomplete-submit-btn]') + By.css('[data-test=autocomplete-submit-btn] button') ) expect(button).toBeFalsy() }) diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.stories.ts b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.stories.ts index 0b45f7ce25..5fe3bab3a0 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.stories.ts +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.stories.ts @@ -39,14 +39,13 @@ function filterResults(value: string) { }) } -export const Primary: StoryObj = { +export const SubmitAllowed: StoryObj = { args: { placeholder: 'Full text search', minCharacterCount: 3, actionThrowsError: false, clearOnSelection: false, allowSubmit: true, - searchFirst: false, }, argTypes: { itemSelected: { @@ -70,6 +69,47 @@ export const Primary: StoryObj = { }), } +export const NoSubmit: StoryObj = { + args: { + placeholder: 'This will only show suggestions, there is no submit button', + minCharacterCount: 3, + actionThrowsError: false, + clearOnSelection: false, + allowSubmit: false, + }, + argTypes: { + itemSelected: { + action: 'itemSelected', + }, + inputSubmitted: { + action: 'inputSubmitted', + }, + actionThrowsError: { + type: 'boolean', + }, + }, + render: (args) => ({ + props: { + ...args, + action: (value: string) => + args.actionThrowsError + ? throwError(() => new Error('Something went terribly wrong!')) + : of(filterResults(value)), + }, + }), +} + +export const WithCustomStyle: StoryObj = + { + ...NoSubmit, + render: (args) => ({ + props: args, + styles: [ + ':host { --gn-ui-text-input-rounded: 10px; --gn-ui-text-input-padding: 20px; --gn-ui-text-input-font-size: 18px }', + ], + }), + } + export const NoMinimumCharacterCount: StoryObj = { args: { diff --git a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts index e69157c911..34dd978087 100644 --- a/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts +++ b/libs/ui/inputs/src/lib/autocomplete/autocomplete.component.ts @@ -36,6 +36,7 @@ import { MatIconModule } from '@angular/material/icon' import { PopupAlertComponent } from '@geonetwork-ui/ui/widgets' import { CommonModule } from '@angular/common' import { TranslateModule } from '@ngx-translate/core' +import { ButtonComponent } from '../button/button.component' export type AutocompleteItem = unknown @@ -52,6 +53,7 @@ export type AutocompleteItem = unknown CommonModule, TranslateModule, ReactiveFormsModule, + ButtonComponent, ], }) export class AutocompleteComponent @@ -64,8 +66,8 @@ export class AutocompleteComponent @Input() preventCompleteOnSelection = false @Input() autoFocus = false @Input() minCharacterCount? = 3 + // this will show a submit button next to the input; if false, a search icon will appear on the left @Input() allowSubmit = false - @Input() searchFirst = false @Output() itemSelected = new EventEmitter() @Output() inputSubmitted = new EventEmitter() @Output() inputCleared = new EventEmitter() diff --git a/tailwind.base.css b/tailwind.base.css index f06067810f..322aabb188 100644 --- a/tailwind.base.css +++ b/tailwind.base.css @@ -159,8 +159,10 @@ .gn-ui-text-input { --rounded: var(--gn-ui-text-input-rounded, 0.25em); --padding: var(--gn-ui-text-input-padding, 0.6em); - @apply appearance-none border-2 p-[--padding] rounded-[--rounded] w-full transition-colors duration-75 - text-[14px] leading-none border-gray-300 text-main placeholder-gray-800 + --font-size: var(--gn-ui-text-input-font-size, 1em); + --border-size: var(--gn-ui-text-input-border-size, 2px); + @apply appearance-none border-[length:--border-size] p-[--padding] rounded-[--rounded] w-full transition-colors duration-75 + text-[length:--font-size] leading-none border-gray-300 text-main placeholder-gray-800 focus:outline-none focus:border-main hover:border-main disabled:cursor-not-allowed disabled:border-gray-100 disabled:placeholder-gray-300 disabled:text-gray-700 disabled:bg-white; } @@ -180,22 +182,6 @@ mat-progress-spinner circle { stroke: currentColor !important; } - - .gn-ui-autocomplete { - @apply relative border-2 border-gray-300 rounded-md transition-colors duration-75 focus:outline-none focus:border-main hover:border-main; - } - - .gn-ui-autocomplete-input { - @apply appearance-none focus:outline-white focus:outline-2 focus:outline-dotted focus:outline-offset-2 leading-tight rounded text-black; - } - - .gn-ui-autocomplete-clear { - @apply absolute text-primary-lightest hover:text-primary hover:bg-gray-50 transition-all duration-100; - } - - .gn-ui-autocomplete-search { - @apply text-primary bg-white hover:text-primary-darkest hover:bg-gray-100 border-gray-300 hover:border-gray-500 transition-all duration-100 rounded-r; - } } html { From 4bd1761015acce6d9786d742866d07a0b2e3a853 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Wed, 11 Sep 2024 19:23:08 +0200 Subject: [PATCH 25/27] chore: misc fixes post review * spacing in attached resources * font for toggle buttons * scroll to top when switching page * url input icon alignment * made the dropdowns in the editor only 50% in width (a little bit hacky) Also added marker to not lose a translation that was done. --- .../src/app/edit/edit-page.component.html | 14 ++++++----- .../src/app/edit/edit-page.component.spec.ts | 21 +++++++++++++++- .../src/app/edit/edit-page.component.ts | 24 +++++++++++++++++-- .../form-field-license.component.css | 8 +++++++ ...field-online-link-resources.component.html | 1 + .../form-field-update-frequency.component.css | 4 ++++ libs/feature/editor/src/lib/fields.config.ts | 2 ++ .../switch-toggle/switch-toggle.component.css | 1 + .../lib/url-input/url-input.component.html | 2 +- 9 files changed, 67 insertions(+), 10 deletions(-) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index 99def98248..8e4e2f16b1 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -9,8 +9,8 @@
-
-
+
+
- editor.record.form.bottomButtons.next + editor.record.form.bottomButtons.next +
diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.spec.ts b/apps/metadata-editor/src/app/edit/edit-page.component.spec.ts index cef1db3cbc..39015be36c 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.spec.ts +++ b/apps/metadata-editor/src/app/edit/edit-page.component.spec.ts @@ -5,7 +5,7 @@ import { datasetRecordsFixture, editorConfigFixture, } from '@geonetwork-ui/common/fixtures' -import { BehaviorSubject, Subject } from 'rxjs' +import { BehaviorSubject, firstValueFrom, Subject } from 'rxjs' import { NotificationsService } from '@geonetwork-ui/feature/notifications' import { EditorFacade } from '@geonetwork-ui/feature/editor' import { MockBuilder } from 'ng-mocks' @@ -36,6 +36,8 @@ class EditorFacadeMock { saveSuccess$ = new Subject() draftSaveSuccess$ = new Subject() editorConfig$ = new BehaviorSubject(editorConfigFixture()) + currentPage$ = new BehaviorSubject(0) + pagesCount$ = new BehaviorSubject(2) } class NotificationsServiceMock { showNotification = jest.fn() @@ -172,4 +174,21 @@ describe('EditPageComponent', () => { expect(navigateSpy).toHaveBeenCalledWith(['edit', 'new-uuid']) }) }) + + describe('isLastPage$', () => { + let editorFacade: EditorFacadeMock + beforeEach(() => { + editorFacade = TestBed.inject(EditorFacade) as unknown as EditorFacadeMock + }) + it('returns true if last page', async () => { + editorFacade.currentPage$.next(3) + editorFacade.pagesCount$.next(4) + expect(await firstValueFrom(component.isLastPage$)).toBe(true) + }) + it('returns false if not', async () => { + editorFacade.currentPage$.next(1) + editorFacade.pagesCount$.next(3) + expect(await firstValueFrom(component.isLastPage$)).toBe(false) + }) + }) }) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.ts b/apps/metadata-editor/src/app/edit/edit-page.component.ts index 76e5fb02a9..c6d76d4c6f 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.ts +++ b/apps/metadata-editor/src/app/edit/edit-page.component.ts @@ -1,5 +1,11 @@ import { CommonModule } from '@angular/common' -import { Component, OnDestroy, OnInit } from '@angular/core' +import { + Component, + ElementRef, + OnDestroy, + OnInit, + ViewChild, +} from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { EditorFacade, @@ -14,7 +20,7 @@ import { NotificationsService, } from '@geonetwork-ui/feature/notifications' import { TranslateModule, TranslateService } from '@ngx-translate/core' -import { filter, firstValueFrom, Subscription, take } from 'rxjs' +import { combineLatest, filter, firstValueFrom, Subscription, take } from 'rxjs' import { PageSelectorComponent } from './components/page-selector/page-selector.component' import { marker } from '@biesbjerg/ngx-translate-extract-marker' import { map } from 'rxjs/operators' @@ -49,6 +55,11 @@ export class EditPageComponent implements OnInit, OnDestroy { pagesLength$ = this.facade.editorConfig$.pipe( map((config) => config.pages.length) ) + isLastPage$ = combineLatest([this.currentPage$, this.pagesLength$]).pipe( + map(([currentPage, pagesCount]) => currentPage >= pagesCount - 1) + ) + + @ViewChild('scrollContainer') scrollContainer: ElementRef constructor( private route: ActivatedRoute, @@ -135,6 +146,7 @@ export class EditPageComponent implements OnInit, OnDestroy { this.router.navigate(['catalog', 'search']) } else { this.facade.setCurrentPage(currentPage - 1) + this.scrollToTop() } } @@ -143,6 +155,14 @@ export class EditPageComponent implements OnInit, OnDestroy { const pagesCount = await firstValueFrom(this.pagesLength$) if (currentPage < pagesCount - 1) { this.facade.setCurrentPage(currentPage + 1) + this.scrollToTop() } } + + private scrollToTop() { + this.scrollContainer.nativeElement.scroll({ + behavior: 'instant', + top: 0, + }) + } } diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.css b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.css index e69de29bb2..4b6b0d48e7 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.css +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.css @@ -0,0 +1,8 @@ +:host { + display: grid; /* this is required to be able to size the dropdown */ +} + +gn-ui-dropdown-selector { + /* FIXME: this includes the grid gap from the editor form, but there should be no dependency */ + max-width: calc(50% - 16px); +} diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html index 9700a37633..d8df0ccf3c 100644 --- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html @@ -5,6 +5,7 @@ [uploadProgress]="uploadProgress" (urlChange)="handleUrlChange($event)" > +
- + arrow_upward From d70ea3c52ec5f07390793d1b5314904cf2b2c2e0 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Wed, 11 Sep 2024 21:02:32 +0200 Subject: [PATCH 26/27] chore: fix e2e --- apps/metadata-editor-e2e/src/e2e/edit.cy.ts | 59 ++++++++++++++----- .../date-picker/date-picker.component.html | 1 + .../date-range-picker.component.html | 1 + 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/apps/metadata-editor-e2e/src/e2e/edit.cy.ts b/apps/metadata-editor-e2e/src/e2e/edit.cy.ts index 74c1ef588a..88c07cb458 100644 --- a/apps/metadata-editor-e2e/src/e2e/edit.cy.ts +++ b/apps/metadata-editor-e2e/src/e2e/edit.cy.ts @@ -124,7 +124,7 @@ describe('editor form', () => { cy.get('[data-test=displayedRoles]') .children() - .get('[data-test=removeContactButton]') + .get('[data-cy=remove-item]') .click() cy.get('[data-test=displayedRoles]') @@ -240,32 +240,56 @@ describe('editor form', () => { describe('Spatial coverage', () => { it('toggle between national and regional spatial coverage', () => { - cy.get('gn-ui-switch-toggle').should('exist') + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-switch-toggle') + .should('exist') - cy.get('gn-ui-switch-toggle').find('mat-button-toggle').eq(0).click() - cy.get('mat-button-toggle') + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-switch-toggle') + .find('mat-button-toggle') + .eq(0) + .click() + cy.get('gn-ui-form-field-spatial-extent') + .find('mat-button-toggle') .eq(0) .should('have.class', 'mat-button-toggle-checked') - cy.get('mat-button-toggle') + cy.get('gn-ui-form-field-spatial-extent') + .find('mat-button-toggle') .eq(1) .should('not.have.class', 'mat-button-toggle-checked') - cy.get('gn-ui-switch-toggle').find('mat-button-toggle').eq(1).click() - cy.get('mat-button-toggle') + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-switch-toggle') + .find('mat-button-toggle') + .eq(1) + .click() + cy.get('gn-ui-form-field-spatial-extent') + .find('mat-button-toggle') .eq(1) .should('have.class', 'mat-button-toggle-checked') - cy.get('mat-button-toggle') + cy.get('gn-ui-form-field-spatial-extent') + .find('mat-button-toggle') .eq(0) .should('not.have.class', 'mat-button-toggle-checked') }) it('should display place keywords', () => { - cy.get('gn-ui-autocomplete').should('have.length', 1) - cy.get('gn-ui-autocomplete').type('afr') + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-autocomplete') + .should('have.length', 1) + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-autocomplete') + .type('afr') cy.get('mat-option').should('have.length', 10) cy.get('mat-option').eq(0).click() - cy.get('gn-ui-badge').should('have.length', 4) - cy.get('gn-ui-badge').eq(0).find('span').should('have.text', 'Africa ') + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-badge') + .should('have.length', 4) + cy.get('gn-ui-form-field-spatial-extent') + .find('gn-ui-badge') + .eq(0) + .find('span') + .should('have.text', 'Africa ') }) }) }) @@ -294,8 +318,11 @@ describe('editor form', () => { cy.get('gn-ui-form-field-keywords').find('gn-ui-autocomplete').click() cy.get('mat-option').should('have.length', 10) cy.get('mat-option').eq(0).click() - cy.get('gn-ui-badge').should('have.length', 20) - cy.get('gn-ui-badge') + cy.get('gn-ui-form-field-keywords') + .find('gn-ui-badge') + .should('have.length', 20) + cy.get('gn-ui-form-field-keywords') + .find('gn-ui-badge') .eq(19) .find('span') .should('have.text', 'Addresses ') @@ -321,7 +348,9 @@ describe('editor form', () => { // add a date range cy.get('gn-ui-form-field-temporal-extents gn-ui-button').eq(1).click() // open the date picker - cy.get('gn-ui-form-field-temporal-extents mat-datepicker-toggle').click() + cy.get( + 'gn-ui-form-field-temporal-extents [data-cy=date-picker-button] button' + ).click() // select a date cy.get('mat-calendar').contains('1').click() // the date picker should still be open diff --git a/libs/ui/inputs/src/lib/date-picker/date-picker.component.html b/libs/ui/inputs/src/lib/date-picker/date-picker.component.html index 3d1fdc2760..0071b8fc75 100644 --- a/libs/ui/inputs/src/lib/date-picker/date-picker.component.html +++ b/libs/ui/inputs/src/lib/date-picker/date-picker.component.html @@ -9,6 +9,7 @@ type="light" (buttonClick)="picker.open()" extraClass="absolute inset-y-[var(--side-padding)] right-[var(--side-padding)]" + data-cy="date-picker-button" > calendar_today date_range Date: Thu, 12 Sep 2024 11:39:37 +0200 Subject: [PATCH 27/27] chore(me): move back to container-lg for radability --- apps/metadata-editor/src/app/edit/edit-page.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/metadata-editor/src/app/edit/edit-page.component.html b/apps/metadata-editor/src/app/edit/edit-page.component.html index 8e4e2f16b1..3b08626cd7 100644 --- a/apps/metadata-editor/src/app/edit/edit-page.component.html +++ b/apps/metadata-editor/src/app/edit/edit-page.component.html @@ -10,7 +10,7 @@
-
+