Skip to content

Commit

Permalink
Merge pull request #939 from freshworks/showRelationshipTypeSelect-props
Browse files Browse the repository at this point in the history
refactor(component): showRelationshipTypeSelect based on config provided by the products
  • Loading branch information
prasanna-vijayan authored Sep 30, 2024
2 parents e1a977a + 4aab1e4 commit 86cb013
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 9 deletions.
32 changes: 32 additions & 0 deletions packages/crayons-extended/custom-objects/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ export namespace Components {
* flag to show dependentField resolve checkbox
*/
"showDependentFieldResolveProp": boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect": boolean;
}
interface FbSectionCreate {
/**
Expand Down Expand Up @@ -279,6 +283,10 @@ export namespace Components {
* property to show the errors on click of the save/add button from the parent
*/
"showErrors": boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect": boolean;
/**
* source object value
*/
Expand Down Expand Up @@ -392,6 +400,10 @@ export namespace Components {
* flag to show dependentField resolve checkbox
*/
"showDependentFieldResolveProp": boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect": boolean;
"showSections": boolean;
}
interface FwFieldTypeMenuItem {
Expand Down Expand Up @@ -565,6 +577,10 @@ export namespace Components {
* flag to show lookupField for CONVERSATION_PROPERTIES or not
*/
"showLookupField": boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect": boolean;
/**
* Show explore plans and disable features for user having free-plan
*/
Expand Down Expand Up @@ -1049,6 +1065,10 @@ declare namespace LocalJSX {
* flag to show dependentField resolve checkbox
*/
"showDependentFieldResolveProp"?: boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect"?: boolean;
}
interface FbSectionCreate {
/**
Expand Down Expand Up @@ -1260,6 +1280,10 @@ declare namespace LocalJSX {
* property to show the errors on click of the save/add button from the parent
*/
"showErrors"?: boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect"?: boolean;
/**
* source object value
*/
Expand Down Expand Up @@ -1389,6 +1413,10 @@ declare namespace LocalJSX {
* flag to show dependentField resolve checkbox
*/
"showDependentFieldResolveProp"?: boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect"?: boolean;
"showSections"?: boolean;
}
interface FwFieldTypeMenuItem {
Expand Down Expand Up @@ -1598,6 +1626,10 @@ declare namespace LocalJSX {
* flag to show lookupField for CONVERSATION_PROPERTIES or not
*/
"showLookupField"?: boolean;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
"showRelationshipTypeSelect"?: boolean;
/**
* Show explore plans and disable features for user having free-plan
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
"freePlanFieldAddDisabledButton": "",
"noCreatePermissionFieldAddDisabledHeader": "",
"noCreatePermissionFieldAddDisabledMessage": "",
"boolShowRelationshipTypeSelect": true,
"boolShowCustomToggle": false,
"showCustomToggleField": ""
},
Expand Down Expand Up @@ -463,7 +462,6 @@
"freePlanFieldAddDisabledButton": "freePlanFieldAddDisabledButton",
"noCreatePermissionFieldAddDisabledHeader": "noCreatePermissionFieldAddDisabledHeader",
"noCreatePermissionFieldAddDisabledMessage": "noCreatePermissionFieldAddDisabledMessage",
"boolShowRelationshipTypeSelect": false,
"boolShowCustomToggle": true,
"showCustomToggleField": "status"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export class FormBuilderFieldDragDropItem {
* variable to store form values
*/
@Prop({ mutable: true }) formValues = null;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
@Prop({ mutable: true }) showRelationshipTypeSelect = true;
/**
* object to store the lookup target entities
*/
Expand Down Expand Up @@ -191,6 +195,7 @@ export class FormBuilderFieldDragDropItem {
index={this.index}
key={this.keyProp}
productName={this.productName}
showRelationshipTypeSelect={this.showRelationshipTypeSelect}
dataProvider={this.dataProvider}
entityName={this.entityName}
expanded={this.expanded}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
isUniqueField,
} from '../utils/form-builder-utils';
import presetSchema from '../assets/form-builder-preset.json';
import formMapper from '../assets/form-mapper.json';

@Component({
tag: 'fw-fb-field-lookup',
Expand All @@ -41,6 +40,10 @@ export class FbFieldDropdown {
* source object value
*/
@Prop({ mutable: true }) sourceObjectName = '';
/**
* flag to show relationshipTypeSelect dropdown or not
*/
@Prop({ mutable: true }) showRelationshipTypeSelect = true;
/**
* array for target objects
*/
Expand Down Expand Up @@ -206,11 +209,6 @@ export class FbFieldDropdown {
const boolShowDescription =
strDescription && strDescription !== '' ? true : false;

const objProductPreset = formMapper[this.productName];
const objProductPresetConfig = objProductPreset?.config;
const boolShowRelationshipTypeSelect =
objProductPresetConfig?.boolShowRelationshipTypeSelect;

return (
<Host tabIndex='-1'>
<div class={`${strBaseClassName}-root`}>
Expand All @@ -224,7 +222,7 @@ export class FbFieldDropdown {
value={this.sourceObjectName}
disabled
></fw-input>
{boolShowRelationshipTypeSelect ? (
{this.showRelationshipTypeSelect ? (
<div class={`${strBaseClassName}-relationship-select-container`}>
<fw-select
readonly={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ export class FieldEditor {
* variable to store form values
*/
@Prop({ mutable: true }) formValues = null;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
@Prop({ mutable: true }) showRelationshipTypeSelect = true;
/**
* object to store the lookup target entities
*/
Expand Down Expand Up @@ -1468,6 +1472,7 @@ export class FieldEditor {
onFwChange={this.lookupChangeHandler}
formValues={objFormValue}
productName={this.productName}
showRelationshipTypeSelect={this.showRelationshipTypeSelect}
></fw-fb-field-lookup>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export class FormBuilder {
* flag to show lookupField for CONVERSATION_PROPERTIES or not
*/
@Prop({ mutable: true }) showLookupField = true;
/**
* flag to show relationshipTypeSelect dropdown or not
*/
@Prop({ mutable: true }) showRelationshipTypeSelect = true;
/**
* flag to show dependentField for CONVERSATION_PROPERTIES or not
*/
Expand Down Expand Up @@ -1355,6 +1359,7 @@ export class FormBuilder {
index={intIndex}
keyProp={strKey}
productName={this.productName}
showRelationshipTypeSelect={this.showRelationshipTypeSelect}
dataProvider={dataItem}
entityName={strEntityName}
expanded={boolItemExpanded}
Expand Down

0 comments on commit 86cb013

Please sign in to comment.