Skip to content

Commit

Permalink
doc: A case widget can now be duplicated (#1317)
Browse files Browse the repository at this point in the history
doc: A case widget can now be duplicated
  • Loading branch information
Klaas-Ritense authored Jan 10, 2025
1 parent b4fcac5 commit cb9e6f9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class KeyGeneratorService {
.toLowerCase()
.replace(/[^a-z0-9-_]+|-[^a-z0-9]+/g, '-')
.replace(/_[-_]+/g, '_')
.replace(/^[^a-z]+/g, '');
.replace(/^[^a-z]+|[^a-z0-9]+$/g, '');

if (!usedKeys.includes(dashCaseKey)) {
return dashCaseKey;
Expand Down
1 change: 1 addition & 0 deletions projects/valtimo/config/assets/core/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,7 @@
"collapse": "Kollaps",
"expand": "Expandieren",
"download": "Herunterladen",
"duplicate": "Duplikat",
"openInNewTab": "In neuem Tab öffnen",
"create": "Erstellen",
"save": "Speichern",
Expand Down
1 change: 1 addition & 0 deletions projects/valtimo/config/assets/core/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,7 @@
"collapse": "Collapse",
"expand": "Expand",
"download": "Download",
"duplicate": "Duplicate",
"openInNewTab": "Open in new tab",
"create": "Create",
"save": "Save",
Expand Down
1 change: 1 addition & 0 deletions projects/valtimo/config/assets/core/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@
"collapse": "Inklappen",
"expand": "Uitklappen",
"download": "Download",
"duplicate": "Dupliceren",
"openInNewTab": "In nieuw tabblad openen",
"create": "Aanmaken",
"save": "Opslaan",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {BehaviorSubject, combineLatest, map, Observable, Subject, take} from 'rx
import {AVAILABLE_WIDGETS, WidgetStyle, WidgetTypeTags} from '../../../models';
import {WidgetTabManagementService, WidgetWizardService} from '../../../services';
import {DossierManagementWidgetWizardComponent} from '../../dossier-management-widget-wizard/dossier-management-widget-wizard.component';
import {cloneDeep} from 'lodash';

@Component({
selector: 'valtimo-dossier-management-widgets-editor',
Expand Down Expand Up @@ -107,6 +108,10 @@ export class DossierManagementWidgetsEditorComponent {
label: 'interface.edit',
callback: this.editWidget.bind(this),
},
{
label: 'interface.duplicate',
callback: this.duplicateWidget.bind(this),
},
{
label: 'interface.delete',
callback: this.deleteWidget.bind(this),
Expand Down Expand Up @@ -164,6 +169,12 @@ export class DossierManagementWidgetsEditorComponent {
this.isWizardOpen$.next(true);
}

public duplicateWidget(tabWidget: CaseWidget): void {
const tabWidgetClone = cloneDeep(tabWidget);
tabWidgetClone.key = null;
this.editWidget(tabWidgetClone);
}

public openAddModal(): void {
this.isWizardOpen$.next(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class DossierManagementWidgetWizardComponent {
this._editMode = value;
if (!value) return;

this.currentStep.set(WidgetWizardStep.WIDTH);
this.currentStep.set(WidgetWizardStep.CONTENT);
}
public get editMode(): boolean {
return this._editMode;
Expand Down

0 comments on commit cb9e6f9

Please sign in to comment.