From b58821e55030fff9aff3144468c88670980d7064 Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Wed, 14 Jun 2023 14:15:37 +0530 Subject: [PATCH 1/9] feat: new Toggle for converstaion properties --- .../form-builder/components/field-editor.scss | 22 +++++++ .../form-builder/components/field-editor.tsx | 65 ++++++++++++++++++- packages/crayons-i18n/i18n/en-US.json | 1 + 3 files changed, 87 insertions(+), 1 deletion(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss index 448f0a9fa..160e7da8a 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss @@ -262,6 +262,28 @@ height: auto; box-sizing: border-box; } + + .fw-field-editor-status-toggle { + border: 1px solid #cfd7df; + + .fw-field-editor-status-toggle-item { + display: grid; + font-size: 14px; + font-weight: 600; + grid-template-columns: 1fr 1fr; + padding-inline-start: 20px; + padding-block-end: 8px; + padding-inline-end: 0; + padding-block-start: 8px; + + &.header { + background: #ebeff3; + border: 1px solid #cfd7df; + border-width: 0 1px 1px 1px; + font-size: 12px; + } + } + } } } diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 1d4dfc7a4..872a9cb65 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -571,6 +571,10 @@ export class FieldEditor { } } + if (this.dataProvider.name === 'status') { + objValues['choices'] = this.dataProvider.choices; + } + if (boolValidForm) { if (!this.isNewField) { objValues[this.KEY_INTERNAL_NAME] = this.dataProvider.name; @@ -680,6 +684,14 @@ export class FieldEditor { } }; + private statusToggleHandler = (event: CustomEvent) => { + this.isValuesChanged = true; + const objPayload = this.dataProvider; + const id = (event.target as HTMLInputElement).id; + const choice = objPayload.choices.find((item) => item.id === id); + choice.choice_options.resolution_timer = event.detail.checked; + }; + private lookupChangeHandler = (event: CustomEvent) => { event.stopImmediatePropagation(); event.stopPropagation(); @@ -952,6 +964,49 @@ export class FieldEditor { ); } + private renderStatusToggle(objFormValue) { + const strBaseClassName = 'fw-field-editor'; + const choices = objFormValue.choices; + return ( +
+
+ {i18nText('fieldLabel')} + {i18nText('ertText')} +
+ {choices.map((dataItem) => { + let toggle = null; + if ( + dataItem?.choice_options && + Object.keys(dataItem?.choice_options).length + ) { + toggle = ( + + ); + } + return ( +
+ +
+ +
+
+ {toggle} +
+ ); + })} +
+ ); + } + private renderLookup(boolDisableLookup) { const objFormValue = this.dataProvider; @@ -1058,6 +1113,9 @@ export class FieldEditor { const boolSupportInternalName = objProductConfig.editInternalName; const strBaseClassName = 'fw-field-editor'; const objFieldBuilder = this.fieldBuilderOptions; + + /** Adding extra check for status type */ + const isStatusType = objFormValue.name === 'status'; const strInputLabel = hasCustomProperty(objFieldBuilder, 'label') ? objFieldBuilder.label : ''; @@ -1095,8 +1153,12 @@ export class FieldEditor { } } + const elementStatusToggle = isStatusType + ? this.renderStatusToggle(objFormValue) + : null; + const elementDropdown = - isDropdownType && !boolIgnoreDropdownChoices + isDropdownType && !boolIgnoreDropdownChoices && !isStatusType ? this.renderDropdown(boolDisableDropdowns) : null; @@ -1166,6 +1228,7 @@ export class FieldEditor { isDefaultNonCustomField, boolEditAllowed )} + {elementStatusToggle} {isDropdownType && (
{elementDropdown} diff --git a/packages/crayons-i18n/i18n/en-US.json b/packages/crayons-i18n/i18n/en-US.json index df9ca5582..3228abbc2 100644 --- a/packages/crayons-i18n/i18n/en-US.json +++ b/packages/crayons-i18n/i18n/en-US.json @@ -158,6 +158,7 @@ "freePlanFieldAddDisabledButton": "Explore plans", "noCreatePermissionFieldAddDisabledHeader": "You do not have permission to create new properties", "noCreatePermissionFieldAddDisabledMessage": "Please reach out to your admin for more details.", + "ertText": "Effective resolution timer", "errors": { "emptyFieldName": "Field label is required.", "emptyRelationshipType": "Relationship type is required.", From 7eb5aa4f464d3fa7a5e136b6a2a117a717bde166 Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Wed, 14 Jun 2023 23:39:29 +0530 Subject: [PATCH 2/9] fix: extra check --- .../components/form-builder/components/field-editor.tsx | 2 +- .../src/components/form-builder/form-builder.e2e.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 872a9cb65..1776c0628 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -1158,7 +1158,7 @@ export class FieldEditor { : null; const elementDropdown = - isDropdownType && !boolIgnoreDropdownChoices && !isStatusType + isDropdownType && !boolIgnoreDropdownChoices ? this.renderDropdown(boolDisableDropdowns) : null; diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.e2e.ts b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.e2e.ts index 064b79564..d335ada39 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.e2e.ts +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.e2e.ts @@ -341,6 +341,7 @@ describe('fw-form-builder', () => { account_id: '0', internal_name: 'open', value: 'Open', + choice_options: {}, field_id: 'e189019d-ac50-4852-a17f-97acf2b05582', position: 1, }, @@ -349,6 +350,9 @@ describe('fw-form-builder', () => { account_id: '0', internal_name: 'waiting_on_customer', value: 'Waiting on customer', + choice_options: { + resolution_timer: true, + }, field_id: 'e189019d-ac50-4852-a17f-97acf2b05582', position: 2, }, @@ -357,6 +361,9 @@ describe('fw-form-builder', () => { account_id: '0', internal_name: 'waiting_on_internal_teams', value: 'Waiting on internal teams', + choice_options: { + resolution_timer: true, + }, field_id: 'e189019d-ac50-4852-a17f-97acf2b05582', position: 3, }, @@ -365,6 +372,7 @@ describe('fw-form-builder', () => { account_id: '0', internal_name: 'resolved', value: 'Resolved', + choice_options: {}, field_id: 'e189019d-ac50-4852-a17f-97acf2b05582', position: 4, }, From 6e1c8cde3d863e3d89b45dc7c9768afbf1a972bf Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Mon, 19 Jun 2023 12:37:36 +0530 Subject: [PATCH 3/9] style: bug fixes --- .../form-builder/components/field-editor.scss | 14 +++++++------- .../form-builder/components/field-editor.tsx | 16 +++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss index 160e7da8a..af24e0899 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.scss @@ -264,23 +264,23 @@ } .fw-field-editor-status-toggle { - border: 1px solid #cfd7df; + border: 1px solid $color-smoke-100; .fw-field-editor-status-toggle-item { display: grid; - font-size: 14px; - font-weight: 600; + font-size: $font-size-14; + font-weight: $font-weight-600; grid-template-columns: 1fr 1fr; - padding-inline-start: 20px; + padding-inline-start: $font-size-20; padding-block-end: 8px; padding-inline-end: 0; padding-block-start: 8px; &.header { - background: #ebeff3; - border: 1px solid #cfd7df; + background: $color-smoke-50; + border: 1px solid $color-smoke-100; border-width: 0 1px 1px 1px; - font-size: 12px; + font-size: $font-size-12; } } } diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 1776c0628..0f8d4c4b1 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -980,12 +980,14 @@ export class FieldEditor { Object.keys(dataItem?.choice_options).length ) { toggle = ( - + + + ); } return ( @@ -999,7 +1001,7 @@ export class FieldEditor { >
- {toggle} + {toggle} ); })} From 0f782c3c38716305ccc8b153cd84a25f5a080cb9 Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Fri, 23 Jun 2023 03:55:17 +0530 Subject: [PATCH 4/9] fix: review comments --- .../form-builder/assets/form-builder-preset.json | 5 +++++ .../src/components/form-builder/assets/form-mapper.json | 6 ++++-- .../components/form-builder/components/field-editor.tsx | 9 +++++---- .../src/components/form-builder/form-builder.tsx | 1 + 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json index 0df557151..013bf5f8d 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json @@ -41,6 +41,11 @@ "type": "MULTI_SELECT", "icon": { "name": "multiselect", "bg_color": "#E5F2FE" }, "choices": [{ "value": "" }, { "value": "" }] + }, + "CUSTOM_TOGGLE": { + "type": "CUSTOM_TOGGLE", + "icon": { "name": "dropdown", "bg_color": "#E5F2FE" }, + "choices": [{ "value": "" }, { "value": "" }] } }, "relationshipTypes": [ diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json index 726d1a79c..51e1be054 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json @@ -290,7 +290,8 @@ "DROPDOWN": 2, "CHECKBOX": 5, "MULTI_SELECT": 18, - "RELATIONSHIP": 16 + "RELATIONSHIP": 16, + "CUSTOM_TOGGLE": 99 }, "reverseMappedFieldTypes": { "1": "TEXT", @@ -301,7 +302,8 @@ "2": "DROPDOWN", "5": "CHECKBOX", "18": "MULTI_SELECT", - "16": "RELATIONSHIP" + "16": "RELATIONSHIP", + "99": "CUSTOM_TOGGLE" }, "fieldOrder": [ "TEXT", diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 308ff82ac..5de9140d2 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -571,8 +571,8 @@ export class FieldEditor { } } - if (this.dataProvider.name === 'status') { - objValues['choices'] = this.dataProvider.choices; + if (this.dataProvider.type === 'CUSTOM_TOGGLE') { + objValues['choices'] = [...this.dataProvider.choices]; } if (boolValidForm) { @@ -1117,8 +1117,6 @@ export class FieldEditor { const strBaseClassName = 'fw-field-editor'; const objFieldBuilder = this.fieldBuilderOptions; - /** Adding extra check for status type */ - const isStatusType = objFormValue.name === 'status'; const strInputLabel = hasCustomProperty(objFieldBuilder, 'label') ? objFieldBuilder.label : ''; @@ -1137,6 +1135,9 @@ export class FieldEditor { ? objFieldBuilder.type : ''; + /** Adding extra check for status type */ + const isStatusType = strFieldType === 'CUSTOM_TOGGLE'; + const isDropdownType = strFieldType === 'DROPDOWN' || strFieldType === 'MULTI_SELECT' ? true diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx index 4a1010728..b027a0fbb 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx @@ -226,6 +226,7 @@ export class FormBuilder { 'DROPDOWN', 'RELATIONSHIP', 'MULTI_SELECT', + 'CUSTOM_TOGGLE', ]; } From c4602cc9552c38801285a7aa4137d773b52aa57e Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Fri, 23 Jun 2023 12:48:58 +0530 Subject: [PATCH 5/9] Revert "fix: review comments" This reverts commit 0f782c3c38716305ccc8b153cd84a25f5a080cb9. --- .../form-builder/assets/form-builder-preset.json | 5 ----- .../src/components/form-builder/assets/form-mapper.json | 6 ++---- .../components/form-builder/components/field-editor.tsx | 9 ++++----- .../src/components/form-builder/form-builder.tsx | 1 - 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json index 013bf5f8d..0df557151 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-builder-preset.json @@ -41,11 +41,6 @@ "type": "MULTI_SELECT", "icon": { "name": "multiselect", "bg_color": "#E5F2FE" }, "choices": [{ "value": "" }, { "value": "" }] - }, - "CUSTOM_TOGGLE": { - "type": "CUSTOM_TOGGLE", - "icon": { "name": "dropdown", "bg_color": "#E5F2FE" }, - "choices": [{ "value": "" }, { "value": "" }] } }, "relationshipTypes": [ diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json index 51e1be054..726d1a79c 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json @@ -290,8 +290,7 @@ "DROPDOWN": 2, "CHECKBOX": 5, "MULTI_SELECT": 18, - "RELATIONSHIP": 16, - "CUSTOM_TOGGLE": 99 + "RELATIONSHIP": 16 }, "reverseMappedFieldTypes": { "1": "TEXT", @@ -302,8 +301,7 @@ "2": "DROPDOWN", "5": "CHECKBOX", "18": "MULTI_SELECT", - "16": "RELATIONSHIP", - "99": "CUSTOM_TOGGLE" + "16": "RELATIONSHIP" }, "fieldOrder": [ "TEXT", diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 5de9140d2..308ff82ac 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -571,8 +571,8 @@ export class FieldEditor { } } - if (this.dataProvider.type === 'CUSTOM_TOGGLE') { - objValues['choices'] = [...this.dataProvider.choices]; + if (this.dataProvider.name === 'status') { + objValues['choices'] = this.dataProvider.choices; } if (boolValidForm) { @@ -1117,6 +1117,8 @@ export class FieldEditor { const strBaseClassName = 'fw-field-editor'; const objFieldBuilder = this.fieldBuilderOptions; + /** Adding extra check for status type */ + const isStatusType = objFormValue.name === 'status'; const strInputLabel = hasCustomProperty(objFieldBuilder, 'label') ? objFieldBuilder.label : ''; @@ -1135,9 +1137,6 @@ export class FieldEditor { ? objFieldBuilder.type : ''; - /** Adding extra check for status type */ - const isStatusType = strFieldType === 'CUSTOM_TOGGLE'; - const isDropdownType = strFieldType === 'DROPDOWN' || strFieldType === 'MULTI_SELECT' ? true diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx index b027a0fbb..4a1010728 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/form-builder.tsx @@ -226,7 +226,6 @@ export class FormBuilder { 'DROPDOWN', 'RELATIONSHIP', 'MULTI_SELECT', - 'CUSTOM_TOGGLE', ]; } From 44a1317ea377523b1f78f0040eb22a9f20b597a4 Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Mon, 26 Jun 2023 01:31:42 +0530 Subject: [PATCH 6/9] fix: form mapper changes --- .../components/form-builder/assets/form-mapper.json | 8 ++++++-- .../form-builder/components/field-editor.tsx | 10 +++++++--- .../form-builder/utils/form-builder-utils.ts | 8 ++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json index 726d1a79c..9f911f369 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/assets/form-mapper.json @@ -241,7 +241,9 @@ "freePlanFieldAddDisabledButton": "", "noCreatePermissionFieldAddDisabledHeader": "", "noCreatePermissionFieldAddDisabledMessage": "", - "boolShowRelationshipTypeSelect": true + "boolShowRelationshipTypeSelect": true, + "boolShowCustomToggle": false, + "showCustomToggleField": "" }, "labels": { "headerProduct": "", @@ -442,7 +444,9 @@ "freePlanFieldAddDisabledButton": "freePlanFieldAddDisabledButton", "noCreatePermissionFieldAddDisabledHeader": "noCreatePermissionFieldAddDisabledHeader", "noCreatePermissionFieldAddDisabledMessage": "noCreatePermissionFieldAddDisabledMessage", - "boolShowRelationshipTypeSelect": false + "boolShowRelationshipTypeSelect": false, + "boolShowCustomToggle": true, + "showCustomToggleField": "status" }, "labels": { "headerProduct": "headerProductConvProps", diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 308ff82ac..7323714de 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -22,6 +22,7 @@ import { getMaximumLimitsConfig, deriveInternalNameFromLabel, hasPermission, + checkIfCustomField, } from '../utils/form-builder-utils'; import formMapper from '../assets/form-mapper.json'; import presetSchema from '../assets/form-builder-preset.json'; @@ -571,7 +572,7 @@ export class FieldEditor { } } - if (this.dataProvider.name === 'status') { + if (checkIfCustomField(this.productName, this.dataProvider.name)) { objValues['choices'] = this.dataProvider.choices; } @@ -1118,7 +1119,10 @@ export class FieldEditor { const objFieldBuilder = this.fieldBuilderOptions; /** Adding extra check for status type */ - const isStatusType = objFormValue.name === 'status'; + const isStatusType = checkIfCustomField( + this.productName, + objFormValue.name + ); const strInputLabel = hasCustomProperty(objFieldBuilder, 'label') ? objFieldBuilder.label : ''; @@ -1161,7 +1165,7 @@ export class FieldEditor { : null; const elementDropdown = - isDropdownType && !boolIgnoreDropdownChoices + isDropdownType && !boolIgnoreDropdownChoices && !isStatusType ? this.renderDropdown(boolDisableDropdowns) : null; diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts b/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts index ebfc1155d..b89b37fd1 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts @@ -264,3 +264,11 @@ export function createUUID() { ); return uuid; } + +export function checkIfCustomField(productName = 'CUSTOM_OBJECTS', fieldName) { + const dbConfig = formMapper[productName]; + return ( + dbConfig?.config?.boolShowCustomToggle && + fieldName === dbConfig?.config?.showCustomToggleField + ); +} From 15969d898ec88b69a5c8fc21c840ba1a002b952e Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Mon, 26 Jun 2023 01:36:31 +0530 Subject: [PATCH 7/9] fix: spread --- .../src/components/form-builder/components/field-editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 7323714de..3abe8226f 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -573,7 +573,7 @@ export class FieldEditor { } if (checkIfCustomField(this.productName, this.dataProvider.name)) { - objValues['choices'] = this.dataProvider.choices; + objValues['choices'] = [...this.dataProvider.choices]; } if (boolValidForm) { From 06190f3e8c74461f9799bd2fc334ebf79b11909d Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Mon, 26 Jun 2023 01:39:13 +0530 Subject: [PATCH 8/9] fix: semantics --- .../src/components/form-builder/components/field-editor.tsx | 6 +++--- .../src/components/form-builder/utils/form-builder-utils.ts | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index 3abe8226f..f6be77d24 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -22,7 +22,7 @@ import { getMaximumLimitsConfig, deriveInternalNameFromLabel, hasPermission, - checkIfCustomField, + checkIfCustomToggleField, } from '../utils/form-builder-utils'; import formMapper from '../assets/form-mapper.json'; import presetSchema from '../assets/form-builder-preset.json'; @@ -572,7 +572,7 @@ export class FieldEditor { } } - if (checkIfCustomField(this.productName, this.dataProvider.name)) { + if (checkIfCustomToggleField(this.productName, this.dataProvider.name)) { objValues['choices'] = [...this.dataProvider.choices]; } @@ -1119,7 +1119,7 @@ export class FieldEditor { const objFieldBuilder = this.fieldBuilderOptions; /** Adding extra check for status type */ - const isStatusType = checkIfCustomField( + const isStatusType = checkIfCustomToggleField( this.productName, objFormValue.name ); diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts b/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts index b89b37fd1..69ea41ebc 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/utils/form-builder-utils.ts @@ -265,7 +265,10 @@ export function createUUID() { return uuid; } -export function checkIfCustomField(productName = 'CUSTOM_OBJECTS', fieldName) { +export function checkIfCustomToggleField( + productName = 'CUSTOM_OBJECTS', + fieldName +) { const dbConfig = formMapper[productName]; return ( dbConfig?.config?.boolShowCustomToggle && From 47eb36a8ac2e3c91756352e56a02a5412ee84fc0 Mon Sep 17 00:00:00 2001 From: aishik-biswas Date: Mon, 26 Jun 2023 11:57:44 +0530 Subject: [PATCH 9/9] fix: exztra check removal --- .../src/components/form-builder/components/field-editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx index f6be77d24..9b1fbaf59 100644 --- a/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx +++ b/packages/crayons-extended/custom-objects/src/components/form-builder/components/field-editor.tsx @@ -1165,7 +1165,7 @@ export class FieldEditor { : null; const elementDropdown = - isDropdownType && !boolIgnoreDropdownChoices && !isStatusType + isDropdownType && !boolIgnoreDropdownChoices ? this.renderDropdown(boolDisableDropdowns) : null;