Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added the error message for section inside section #959

Merged
merged 1 commit into from
Dec 5, 2024
Merged
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
4 changes: 2 additions & 2 deletions packages/crayons-core/src/utils/draggable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { debounce, cloneNodeWithEvents } from './index';
import { parseBoolean } from './list-utils';

//Global Variables
let dragElement;
Expand Down Expand Up @@ -126,8 +127,7 @@ export class Draggable {
const hasSectionsInFieldOptions =
dragElement.dataProvider?.type === 'DROPDOWN' &&
dragElement.dataProvider?.field_options &&
dragElement.dataProvider?.field_options.has_sections;

parseBoolean(dragElement.dataProvider?.field_options?.has_sections);
// Check if the section already has the maximum number of fields
const isSectionFieldLimitExceeded =
this.dragContainer?.children?.length > 15;
Expand Down
7 changes: 7 additions & 0 deletions packages/crayons-core/src/utils/list-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,10 @@ export function doKeyDownOperations(
selected: false,
};
}

export const parseBoolean = (value: any) => {
if (typeof value === 'string') {
return value === 'true';
}
return !!value;
};
2 changes: 1 addition & 1 deletion packages/crayons-i18n/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
"deleteSection": "Delete Section",
"disableChoiceOption": "This option is used to create a section and cannot be edited",
"errorMessages" : {
"DROPDOWN" : "Dropdown fields cannot be added into sections",
"DROPDOWN" : "This field cannot be moved into sections",
"MULTI_SELECT" : "Multi Select Dropdown fields cannot be added into sections",
"DEPENDENT_FIELD" : "Dependent fields cannot be added into sections",
"RELATIONSHIP" : "Lookup fields cannot be added into sections",
Expand Down
Loading