Fix remaining field issues for find record action (#12628)
- Handle currency code and country multiselect fields Before / After <img width="252" alt="Capture d’écran 2025-06-16 à 15 24 35" src="https://github.com/user-attachments/assets/3e921ffa-33cb-41dd-82d7-ef3a1aef3510" /> <img width="252" alt="Capture d’écran 2025-06-16 à 15 24 47" src="https://github.com/user-attachments/assets/115d18b8-7a15-46b1-8786-bd63b7bb1989" /> - Use action button rather than light icon button to match figma. Asked @Bonapara, we want it for both workflow and index page Before <img width="252" alt="Capture d’écran 2025-06-16 à 15 25 02" src="https://github.com/user-attachments/assets/ec376c70-d2df-417b-aefc-625e965dded1" /> After <img width="252" alt="Capture d’écran 2025-06-16 à 15 23 50" src="https://github.com/user-attachments/assets/1824ff86-b5f1-47ad-8b5c-7ea84e0e3ac6" /> <img width="400" alt="Capture d’écran 2025-06-16 à 15 25 40" src="https://github.com/user-attachments/assets/f2daba64-0982-40ee-9662-a23f86385a8f" /> - Remove `isRelative` from date field option for workflows
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { AdvancedFilterFieldSelectDropdownButton } from '@/object-record/advanced-filter/components/AdvancedFilterFieldSelectDropdownButton';
|
||||
import { AdvancedFilterRecordFilterOperandSelect } from '@/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelect';
|
||||
import { AdvancedFilterRecordFilterOptionsDropdown } from '@/object-record/advanced-filter/components/AdvancedFilterRecordFilterOptionsDropdown';
|
||||
import { getAdvancedFilterObjectFilterDropdownComponentInstanceId } from '@/object-record/advanced-filter/utils/getAdvancedFilterObjectFilterDropdownComponentInstanceId';
|
||||
import { ObjectFilterDropdownComponentInstanceContext } from '@/object-record/object-filter-dropdown/states/contexts/ObjectFilterDropdownComponentInstanceContext';
|
||||
@ -8,6 +7,7 @@ import { RecordFilter } from '@/object-record/record-filter/types/RecordFilter';
|
||||
import { WorkflowAdvancedFilterDropdownColumn } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowAdvancedFilterDropdownColumn';
|
||||
import { WorkflowAdvancedFilterValueFormInput } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowAdvancedFilterFormInput';
|
||||
import { WorkflowAdvancedFilterLogicalOperatorCell } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowAdvancedFilterLogicalOperatorCell';
|
||||
import { WorkflowAdvancedFilterRecordFilterOperandSelect } from '@/workflow/workflow-steps/workflow-actions/find-records-action/components/WorkflowAdvancedFilterRecordFilterOperandSelect';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
@ -47,9 +47,8 @@ export const WorkflowAdvancedFilterRecordFilterColumn = ({
|
||||
<AdvancedFilterFieldSelectDropdownButton
|
||||
recordFilterId={recordFilter.id}
|
||||
/>
|
||||
<AdvancedFilterRecordFilterOperandSelect
|
||||
<WorkflowAdvancedFilterRecordFilterOperandSelect
|
||||
recordFilterId={recordFilter.id}
|
||||
widthFromProps="auto"
|
||||
/>
|
||||
<WorkflowAdvancedFilterValueFormInput
|
||||
recordFilterId={recordFilter.id}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
import { AdvancedFilterRecordFilterOperandSelectContent } from '@/object-record/advanced-filter/components/AdvancedFilterRecordFilterOperandSelectContent';
|
||||
import { getOperandLabel } from '@/object-record/object-filter-dropdown/utils/getOperandLabel';
|
||||
import { currentRecordFiltersComponentState } from '@/object-record/record-filter/states/currentRecordFiltersComponentState';
|
||||
import { RecordFilterOperand } from '@/object-record/record-filter/types/RecordFilterOperand';
|
||||
import { getRecordFilterOperands } from '@/object-record/record-filter/utils/getRecordFilterOperands';
|
||||
import { SelectControl } from '@/ui/input/components/SelectControl';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
type WorkflowAdvancedFilterRecordFilterOperandSelectProps = {
|
||||
recordFilterId: string;
|
||||
};
|
||||
|
||||
export const WorkflowAdvancedFilterRecordFilterOperandSelect = ({
|
||||
recordFilterId,
|
||||
}: WorkflowAdvancedFilterRecordFilterOperandSelectProps) => {
|
||||
const currentRecordFilters = useRecoilComponentValueV2(
|
||||
currentRecordFiltersComponentState,
|
||||
);
|
||||
|
||||
const filter = currentRecordFilters.find(
|
||||
(recordFilter) => recordFilter.id === recordFilterId,
|
||||
);
|
||||
|
||||
const isDisabled = !filter?.fieldMetadataId;
|
||||
|
||||
const filterType = filter?.type;
|
||||
|
||||
const operandsForFilterType = isDefined(filterType)
|
||||
? getRecordFilterOperands({
|
||||
filterType,
|
||||
subFieldName: filter?.subFieldName,
|
||||
}).filter((operand) => operand !== RecordFilterOperand.IsRelative)
|
||||
: [];
|
||||
|
||||
if (isDisabled) {
|
||||
return (
|
||||
<SelectControl
|
||||
selectedOption={{
|
||||
label: filter?.operand
|
||||
? getOperandLabel(filter.operand)
|
||||
: 'Select operand',
|
||||
value: null,
|
||||
}}
|
||||
isDisabled
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<AdvancedFilterRecordFilterOperandSelectContent
|
||||
recordFilterId={recordFilterId}
|
||||
filter={filter}
|
||||
operandsForFilterType={operandsForFilterType}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -1,9 +1,10 @@
|
||||
import { subFieldNameUsedInDropdownComponentState } from '@/object-record/object-filter-dropdown/states/subFieldNameUsedInDropdownComponentState';
|
||||
import { FormCountryCodeSelectInput } from '@/object-record/record-field/form-types/components/FormCountryCodeSelectInput';
|
||||
import { FormCountrySelectInput } from '@/object-record/record-field/form-types/components/FormCountrySelectInput';
|
||||
import { FormCountryMultiSelectInput } from '@/object-record/record-field/form-types/components/FormCountryMultiSelectInput';
|
||||
import { FormMultiSelectFieldInput } from '@/object-record/record-field/form-types/components/FormMultiSelectFieldInput';
|
||||
import { FormNumberFieldInput } from '@/object-record/record-field/form-types/components/FormNumberFieldInput';
|
||||
import { FormTextFieldInput } from '@/object-record/record-field/form-types/components/FormTextFieldInput';
|
||||
import { RecordFilter } from '@/object-record/record-filter/types/RecordFilter';
|
||||
import { CURRENCIES } from '@/settings/data-model/constants/Currencies';
|
||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||
import { WorkflowVariablePicker } from '@/workflow/workflow-variables/components/WorkflowVariablePicker';
|
||||
import { JsonValue } from 'type-fest';
|
||||
@ -25,8 +26,8 @@ export const WorkflowAdvancedFilterValueFormCompositeFieldInput = ({
|
||||
<>
|
||||
{filterType === 'ADDRESS' ? (
|
||||
subFieldNameUsedInDropdown === 'addressCountry' ? (
|
||||
<FormCountrySelectInput
|
||||
selectedCountryName={recordFilter.value}
|
||||
<FormCountryMultiSelectInput
|
||||
defaultValue={recordFilter.value}
|
||||
onChange={onChange}
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
/>
|
||||
@ -39,10 +40,11 @@ export const WorkflowAdvancedFilterValueFormCompositeFieldInput = ({
|
||||
)
|
||||
) : filterType === 'CURRENCY' ? (
|
||||
recordFilter.subFieldName === 'currencyCode' ? (
|
||||
<FormCountryCodeSelectInput
|
||||
selectedCountryCode={recordFilter.value}
|
||||
<FormMultiSelectFieldInput
|
||||
defaultValue={recordFilter.value}
|
||||
onChange={onChange}
|
||||
VariablePicker={WorkflowVariablePicker}
|
||||
options={CURRENCIES}
|
||||
/>
|
||||
) : recordFilter.subFieldName === 'amountMicros' ? (
|
||||
<FormNumberFieldInput
|
||||
|
||||
Reference in New Issue
Block a user