Skip to content

Commit 277a49f

Browse files
authored
fix: added the error message for section inside section (#959)
1 parent 46be9e2 commit 277a49f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

packages/crayons-core/src/utils/draggable.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { debounce, cloneNodeWithEvents } from './index';
2+
import { parseBoolean } from './list-utils';
23

34
//Global Variables
45
let dragElement;
@@ -126,8 +127,7 @@ export class Draggable {
126127
const hasSectionsInFieldOptions =
127128
dragElement.dataProvider?.type === 'DROPDOWN' &&
128129
dragElement.dataProvider?.field_options &&
129-
dragElement.dataProvider?.field_options.has_sections;
130-
130+
parseBoolean(dragElement.dataProvider?.field_options?.has_sections);
131131
// Check if the section already has the maximum number of fields
132132
const isSectionFieldLimitExceeded =
133133
this.dragContainer?.children?.length > 15;

packages/crayons-core/src/utils/list-utils.ts

+7
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,10 @@ export function doKeyDownOperations(
189189
selected: false,
190190
};
191191
}
192+
193+
export const parseBoolean = (value: any) => {
194+
if (typeof value === 'string') {
195+
return value === 'true';
196+
}
197+
return !!value;
198+
};

packages/crayons-i18n/i18n/en-US.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"deleteSection": "Delete Section",
215215
"disableChoiceOption": "This option is used to create a section and cannot be edited",
216216
"errorMessages" : {
217-
"DROPDOWN" : "Dropdown fields cannot be added into sections",
217+
"DROPDOWN" : "This field cannot be moved into sections",
218218
"MULTI_SELECT" : "Multi Select Dropdown fields cannot be added into sections",
219219
"DEPENDENT_FIELD" : "Dependent fields cannot be added into sections",
220220
"RELATIONSHIP" : "Lookup fields cannot be added into sections",

0 commit comments

Comments
 (0)