RED-3235
This commit is contained in:
parent
0572cbcdce
commit
e1f18d6c2d
@ -6,7 +6,7 @@ import { BaseDialogComponent, shareDistinctLast, Toaster } from '@iqser/common-u
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { AppStateService } from '@state/app-state.service';
|
||||
import { toKebabCase } from '@utils/functions';
|
||||
import { toSnakeCase } from '@utils/functions';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { Dictionary, IDictionary } from '@red/domain';
|
||||
import { UserService } from '@services/user.service';
|
||||
@ -126,7 +126,7 @@ export class AddEditDictionaryDialogComponent extends BaseDialogComponent {
|
||||
|
||||
private _toTechnicalName(value: string) {
|
||||
const existingTechnicalNames = Object.keys(this._appStateService.dictionaryData[this._dossierTemplateId]);
|
||||
const baseTechnicalName = toKebabCase(value.trim());
|
||||
const baseTechnicalName = toSnakeCase(value.trim());
|
||||
let technicalName = baseTechnicalName;
|
||||
let suffix = 1;
|
||||
while (existingTechnicalNames.includes(technicalName)) {
|
||||
|
||||
@ -41,7 +41,6 @@ export class AnnotationsListComponent implements OnChanges {
|
||||
if (this.canMultiSelect && ($event.ctrlKey || $event.metaKey) && this.selectedAnnotations.length > 0) {
|
||||
this.multiSelectService.activate();
|
||||
}
|
||||
console.log('emit', annotation);
|
||||
this.selectAnnotations.emit([annotation]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,9 +98,9 @@ export function removeBraces(str: any): string {
|
||||
return str.replace(/[{}]/g, '');
|
||||
}
|
||||
|
||||
export function toKebabCase(str: string): string {
|
||||
export function toSnakeCase(str: string): string {
|
||||
return str
|
||||
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
||||
.replace(/[\s_]+/g, '-')
|
||||
.replace(/[\s_]+/g, '_')
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user