Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libs/shared/src/lib/survey/creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Question } from './types';
export const initCreatorSettings = (): void => {
const serializer: JsonMetadata = Serializer;

serializer.findProperty('question', 'name').readOnly = true;
serializer.findProperty('question', 'name').onGetValue = (obj: Question) =>
obj.valueName ? obj.valueName : obj.name;
serializer.findProperty('question', 'valueName').isRequired = true;
Expand Down
18 changes: 18 additions & 0 deletions libs/shared/src/lib/survey/global-properties/others.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ export const init = (environment: any): void => {
}
return newValue;
};
// When updating the question name, we need to inform that's a new name
Serializer.addProperty('question', {
name: 'oldName',
visible: false,
});
// When updating the question name, sets the question valueName as well
serializer.getProperty('question', 'name').onSettingValue = (
question: Question,
newValue: string
) => {
if (newValue && question.name && newValue !== question.name) {
question.setPropertyValue('oldName', question.name);
} else {
question.setPropertyValue('oldName', undefined);
}
question.setPropertyValue('valueName', newValue);
return newValue;
};
// Adds valueExpression to questions, that when set pretty much transforms it into an expression question
// whilst still keeping normal question behaviors
Serializer.addProperty('question', {
Expand Down