Refactor recoil v4 (#3266)

* Refactor recoil v4

* Fix ci
This commit is contained in:
Charles Bochet
2024-01-05 19:18:22 +01:00
committed by GitHub
parent 8455e15443
commit 96264e264c
140 changed files with 467 additions and 482 deletions

View File

@ -1,7 +1,7 @@
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
type ObjectFilterDropdownScopeInternalContextProps = ScopedStateKey;
type ObjectFilterDropdownScopeInternalContextProps = StateScopeMapKey;
export const ObjectFilterDropdownScopeInternalContext =
createScopeInternalContext<ObjectFilterDropdownScopeInternalContextProps>();

View File

@ -1,7 +1,7 @@
import { FilterDefinition } from '@/object-record/object-filter-dropdown/types/FilterDefinition';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const availableFilterDefinitionsScopedState = createScopedState<
export const availableFilterDefinitionsScopedState = createStateScopeMap<
FilterDefinition[]
>({
key: 'availableFilterDefinitionsScopedState',

View File

@ -1,9 +1,9 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { FilterDefinition } from '../types/FilterDefinition';
export const filterDefinitionUsedInDropdownScopedState =
createScopedState<FilterDefinition | null>({
createStateScopeMap<FilterDefinition | null>({
key: 'filterDefinitionUsedInDropdownScopedState',
defaultValue: null,
});

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isObjectFilterDropdownOperandSelectUnfoldedScopedState =
createScopedState<boolean>({
createStateScopeMap<boolean>({
key: 'isObjectFilterDropdownOperandSelectUnfoldedScopedState',
defaultValue: false,
});

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isObjectFilterDropdownUnfoldedScopedState =
createScopedState<boolean>({
createStateScopeMap<boolean>({
key: 'isObjectFilterDropdownUnfoldedScopedState',
defaultValue: false,
});

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSearchInputScopedState =
createScopedState<string>({
createStateScopeMap<string>({
key: 'objectFilterDropdownSearchInputScopedState',
defaultValue: '',
});

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSelectedEntityIdScopedState =
createScopedState<string | null>({
createStateScopeMap<string | null>({
key: 'objectFilterDropdownSelectedEntityIdScopedState',
defaultValue: null,
});

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectFilterDropdownSelectedRecordIdsScopedState =
createScopedState<string[]>({
createStateScopeMap<string[]>({
key: 'objectFilterDropdownSelectedRecordIdsScopedState',
defaultValue: [],
});

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../types/Filter';
export const onFilterSelectScopedState = createScopedState<
export const onFilterSelectScopedState = createStateScopeMap<
((filter: Filter) => void) | undefined
>({
key: 'onFilterSelectScopedState',

View File

@ -1,8 +1,10 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../types/Filter';
export const selectedFilterScopedState = createScopedState<Filter | undefined>({
export const selectedFilterScopedState = createStateScopeMap<
Filter | undefined
>({
key: 'selectedFilterScopedState',
defaultValue: undefined,
});

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
export const selectedOperandInDropdownScopedState =
createScopedState<ViewFilterOperand | null>({
createStateScopeMap<ViewFilterOperand | null>({
key: 'selectedOperandInDropdownScopedState',
defaultValue: null,
});

View File

@ -1,9 +1,9 @@
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { Sort } from '../../types/Sort';
type ObjectSortDropdownScopeInternalContextProps = ScopedStateKey & {
type ObjectSortDropdownScopeInternalContextProps = StateScopeMapKey & {
onSortSelect?: (sort: Sort) => void;
};

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { SortDefinition } from '../types/SortDefinition';
export const availableSortDefinitionsScopedState = createScopedState<
export const availableSortDefinitionsScopedState = createStateScopeMap<
SortDefinition[]
>({
key: 'availableSortDefinitionsScopedState',

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isSortSelectedScopedState = createScopedState<boolean>({
export const isSortSelectedScopedState = createStateScopeMap<boolean>({
key: 'isSortSelectedScopedState',
defaultValue: false,
});

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../types/Sort';
export const onSortSelectScopedState = createScopedState<
export const onSortSelectScopedState = createStateScopeMap<
((sort: Sort) => void) | undefined
>({
key: 'onSortSelectScopedState',

View File

@ -1,7 +1,7 @@
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
type RecordBoardScopeInternalContextProps = ScopedStateKey;
type RecordBoardScopeInternalContextProps = StateScopeMapKey;
export const RecordBoardScopeInternalContext =
createScopeInternalContext<RecordBoardScopeInternalContextProps>();

View File

@ -1,6 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const activeRecordBoardCardIdsScopedState = createScopedState<string[]>({
export const activeRecordBoardCardIdsScopedState = createStateScopeMap<
string[]
>({
key: 'activeRecordBoardCardIdsScopedState',
defaultValue: [],
});

View File

@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
export const availableRecordBoardCardFieldsScopedState = createScopedState<
export const availableRecordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'availableRecordBoardCardFieldsScopedState',

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isCompactViewEnabledScopedState = createScopedState<boolean>({
export const isCompactViewEnabledScopedState = createStateScopeMap<boolean>({
key: 'isCompactViewEnabledScopedState',
defaultValue: false,
});

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isRecordBoardLoadedScopedState = createScopedState<boolean>({
export const isRecordBoardLoadedScopedState = createStateScopeMap<boolean>({
key: 'isRecordBoardLoadedScopedState',
defaultValue: false,
});

View File

@ -1,8 +1,8 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { BoardFieldDefinition } from '@/object-record/record-board/types/BoardFieldDefinition';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const onFieldsChangeScopedState = createScopedState<
export const onFieldsChangeScopedState = createStateScopeMap<
(fields: BoardFieldDefinition<FieldMetadata>[]) => void
>({
key: 'onFieldsChangeScopedState',

View File

@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
export const recordBoardCardFieldsScopedState = createScopedState<
export const recordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'recordBoardCardFieldsScopedState',

View File

@ -1,7 +1,7 @@
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const recordBoardColumnsScopedState = createScopedState<
export const recordBoardColumnsScopedState = createStateScopeMap<
BoardColumnDefinition[]
>({
key: 'recordBoardColumnsScopedState',

View File

@ -1,7 +1,7 @@
import { Filter } from '@/object-record/object-filter-dropdown/types/Filter';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const recordBoardFiltersScopedState = createScopedState<Filter[]>({
export const recordBoardFiltersScopedState = createStateScopeMap<Filter[]>({
key: 'recordBoardFiltersScopedState',
defaultValue: [],
});

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../../object-sort-dropdown/types/Sort';
export const recordBoardSortsScopedState = createScopedState<Sort[]>({
export const recordBoardSortsScopedState = createStateScopeMap<Sort[]>({
key: 'recordBoardSortsScopedState',
defaultValue: [],
});

View File

@ -1,7 +1,9 @@
import { Opportunity } from '@/pipeline/types/Opportunity';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const savedOpportunitiesScopedState = createScopedState<Opportunity[]>({
key: 'savedOpportunitiesScopedState',
defaultValue: [],
});
export const savedOpportunitiesScopedState = createStateScopeMap<Opportunity[]>(
{
key: 'savedOpportunitiesScopedState',
defaultValue: [],
},
);

View File

@ -1,7 +1,9 @@
import { PipelineStep } from '@/pipeline/types/PipelineStep';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const savedPipelineStepsScopedState = createScopedState<PipelineStep[]>({
export const savedPipelineStepsScopedState = createStateScopeMap<
PipelineStep[]
>({
key: 'savedPipelineStepsScopedState',
defaultValue: [],
});

View File

@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
export const savedRecordBoardCardFieldsScopedState = createScopedState<
export const savedRecordBoardCardFieldsScopedState = createStateScopeMap<
BoardFieldDefinition<FieldMetadata>[]
>({
key: 'savedRecordBoardCardFieldsScopedState',

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { BoardColumnDefinition } from '../types/BoardColumnDefinition';
export const savedRecordBoardColumnsScopedState = createScopedState<
export const savedRecordBoardColumnsScopedState = createStateScopeMap<
BoardColumnDefinition[]
>({
key: 'savedRecordBoardColumnsScopedState',

View File

@ -1,7 +1,7 @@
import { Company } from '@/companies/types/Company';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const savedRecordsScopedState = createScopedState<Company[]>({
export const savedRecordsScopedState = createStateScopeMap<Company[]>({
key: 'savedRecordsScopedState',
defaultValue: [],
});

View File

@ -1,22 +1,24 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableRecordBoardCardFieldsScopedState } from '../availableRecordBoardCardFieldsScopedState';
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
export const hiddenRecordBoardCardFieldsScopedSelector = createScopedSelector({
key: 'hiddenRecordBoardCardFieldsScopedSelector',
get:
({ scopeId }) =>
({ get }) => {
const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
const otherAvailableKeys = get(
availableRecordBoardCardFieldsScopedState({ scopeId }),
).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
export const hiddenRecordBoardCardFieldsScopedSelector = createSelectorScopeMap(
{
key: 'hiddenRecordBoardCardFieldsScopedSelector',
get:
({ scopeId }) =>
({ get }) => {
const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
const otherAvailableKeys = get(
availableRecordBoardCardFieldsScopedState({ scopeId }),
).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
return [
...fields.filter((field) => !field.isVisible),
...otherAvailableKeys,
];
},
});
return [
...fields.filter((field) => !field.isVisible),
...otherAvailableKeys,
];
},
},
);

View File

@ -1,10 +1,10 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { isRecordBoardCardSelectedFamilyState } from '../isRecordBoardCardSelectedFamilyState';
import { recordBoardCardIdsByColumnIdFamilyState } from '../recordBoardCardIdsByColumnIdFamilyState';
import { recordBoardColumnsScopedState } from '../recordBoardColumnsScopedState';
export const selectedRecordBoardCardIdsScopedSelector = createScopedSelector<
export const selectedRecordBoardCardIdsScopedSelector = createSelectorScopeMap<
string[]
>({
key: 'selectedRecordBoardCardIdsScopedSelector',

View File

@ -1,13 +1,14 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
export const visibleRecordBoardCardFieldsScopedSelector = createScopedSelector({
key: 'visibleRecordBoardCardFieldsScopedSelector',
get:
({ scopeId }) =>
({ get }) =>
get(recordBoardCardFieldsScopedState({ scopeId }))
.filter((field) => field.isVisible)
.sort((a, b) => a.position - b.position),
});
export const visibleRecordBoardCardFieldsScopedSelector =
createSelectorScopeMap({
key: 'visibleRecordBoardCardFieldsScopedSelector',
get:
({ scopeId }) =>
({ get }) =>
get(recordBoardCardFieldsScopedState({ scopeId }))
.filter((field) => field.isVisible)
.sort((a, b) => a.position - b.position),
});

View File

@ -1,6 +1,6 @@
import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
export const isRowSelectedScopedFamilyState = createScopedFamilyState<
export const isRowSelectedScopedFamilyState = createFamilyStateScopeMap<
boolean,
string
>({

View File

@ -1,10 +1,10 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
import { ColumnDefinition } from '../../types/ColumnDefinition';
type RecordTableScopeInternalContextProps = ScopedStateKey & {
type RecordTableScopeInternalContextProps = StateScopeMapKey & {
onColumnsChange: (columns: ColumnDefinition<FieldMetadata>[]) => void;
};

View File

@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ColumnDefinition } from '../types/ColumnDefinition';
export const availableTableColumnsScopedState = createScopedState<
export const availableTableColumnsScopedState = createStateScopeMap<
ColumnDefinition<FieldMetadata>[]
>({
key: 'availableTableColumnsScopedState',

View File

@ -1,9 +1,9 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const currentTableCellInEditModePositionScopedState =
createScopedState<TableCellPosition>({
createStateScopeMap<TableCellPosition>({
key: 'currentTableCellInEditModePositionScopedState',
defaultValue: {
row: 0,

View File

@ -1,7 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isRecordTableInitialLoadingScopedState =
createScopedState<boolean>({
createStateScopeMap<boolean>({
key: 'isRecordTableInitialLoadingScopedState',
defaultValue: true,
});

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const isSoftFocusActiveScopedState = createScopedState<boolean>({
export const isSoftFocusActiveScopedState = createStateScopeMap<boolean>({
key: 'isSoftFocusActiveScopedState',
defaultValue: false,
});

View File

@ -1,11 +1,9 @@
import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const isSoftFocusOnTableCellScopedFamilyState = createScopedFamilyState<
boolean,
TableCellPosition
>({
key: 'isSoftFocusOnTableCellScopedFamilyState',
defaultValue: false,
});
export const isSoftFocusOnTableCellScopedFamilyState =
createFamilyStateScopeMap<boolean, TableCellPosition>({
key: 'isSoftFocusOnTableCellScopedFamilyState',
defaultValue: false,
});

View File

@ -1,8 +1,8 @@
import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const isTableCellInEditModeScopedFamilyState = createScopedFamilyState<
export const isTableCellInEditModeScopedFamilyState = createFamilyStateScopeMap<
boolean,
TableCellPosition
>({

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const numberOfTableRowsScopedState = createScopedState<number>({
export const numberOfTableRowsScopedState = createStateScopeMap<number>({
key: 'numberOfTableRowsScopedState',
defaultValue: 0,
});

View File

@ -1,8 +1,8 @@
import { ObjectMetadataConfig } from '@/object-record/record-table/types/ObjectMetadataConfig';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const objectMetadataConfigScopedState =
createScopedState<ObjectMetadataConfig | null>({
createStateScopeMap<ObjectMetadataConfig | null>({
key: 'objectMetadataConfigScopedState',
defaultValue: null,
});

View File

@ -1,9 +1,9 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { FieldMetadata } from '../../field/types/FieldMetadata';
import { ColumnDefinition } from '../types/ColumnDefinition';
export const onColumnsChangeScopedState = createScopedState<
export const onColumnsChangeScopedState = createStateScopeMap<
((columns: ColumnDefinition<FieldMetadata>[]) => void) | undefined
>({
key: 'onColumnsChangeScopedState',

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const onEntityCountChangeScopedState = createScopedState<
export const onEntityCountChangeScopedState = createStateScopeMap<
((entityCount: number) => void) | undefined
>({
key: 'onEntityCountChangeScopedState',

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const resizeFieldOffsetScopedState = createScopedState<number>({
export const resizeFieldOffsetScopedState = createStateScopeMap<number>({
key: 'resizeFieldOffsetScopedState',
defaultValue: 0,
});

View File

@ -1,4 +1,4 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { AllRowsSelectedStatus } from '../../types/AllRowSelectedStatus';
import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
@ -6,7 +6,7 @@ import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
import { selectedRowIdsScopedSelector } from './selectedRowIdsScopedSelector';
export const allRowsSelectedStatusScopedSelector =
createScopedSelector<AllRowsSelectedStatus>({
createSelectorScopeMap<AllRowsSelectedStatus>({
key: 'allRowsSelectedStatusScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,9 +1,9 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
export const hiddenTableColumnsScopedSelector = createScopedSelector({
export const hiddenTableColumnsScopedSelector = createSelectorScopeMap({
key: 'hiddenTableColumnsScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,8 +1,8 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
export const numberOfTableColumnsScopedSelector = createScopedSelector({
export const numberOfTableColumnsScopedSelector = createSelectorScopeMap({
key: 'numberOfTableColumnsScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,9 +1,9 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { isRowSelectedScopedFamilyState } from '../../record-table-row/states/isRowSelectedScopedFamilyState';
import { tableRowIdsScopedState } from '../tableRowIdsScopedState';
export const selectedRowIdsScopedSelector = createScopedSelector<string[]>({
export const selectedRowIdsScopedSelector = createSelectorScopeMap<string[]>({
key: 'selectedRowIdsScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,10 +1,10 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { ColumnDefinition } from '../../types/ColumnDefinition';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
export const tableColumnsByKeyScopedSelector = createScopedSelector({
export const tableColumnsByKeyScopedSelector = createSelectorScopeMap({
key: 'tableColumnsByKeyScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,9 +1,9 @@
import { createScopedSelector } from '@/ui/utilities/recoil-scope/utils/createScopedSelector';
import { createSelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createSelectorScopeMap';
import { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
import { tableColumnsScopedState } from '../tableColumnsScopedState';
export const visibleTableColumnsScopedSelector = createScopedSelector({
export const visibleTableColumnsScopedSelector = createSelectorScopeMap({
key: 'visibleTableColumnsScopedSelector',
get:
({ scopeId }) =>

View File

@ -1,9 +1,9 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { TableCellPosition } from '../types/TableCellPosition';
export const softFocusPositionScopedState =
createScopedState<TableCellPosition>({
createStateScopeMap<TableCellPosition>({
key: 'softFocusPositionScopedState',
defaultValue: {
row: 0,

View File

@ -1,9 +1,9 @@
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { ColumnDefinition } from '../types/ColumnDefinition';
export const tableColumnsScopedState = createScopedState<
export const tableColumnsScopedState = createStateScopeMap<
ColumnDefinition<FieldMetadata>[]
>({
key: 'tableColumnsScopedState',

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Filter } from '../../object-filter-dropdown/types/Filter';
export const tableFiltersScopedState = createScopedState<Filter[]>({
export const tableFiltersScopedState = createStateScopeMap<Filter[]>({
key: 'tableFiltersScopedState',
defaultValue: [],
});

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const tableLastRowVisibleScopedState = createScopedState<boolean>({
export const tableLastRowVisibleScopedState = createStateScopeMap<boolean>({
key: 'tableLastRowVisibleScopedState',
defaultValue: false,
});

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const tableRowIdsScopedState = createScopedState<string[]>({
export const tableRowIdsScopedState = createStateScopeMap<string[]>({
key: 'tableRowIdsScopedState',
defaultValue: [],
});

View File

@ -1,8 +1,8 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
import { Sort } from '../../object-sort-dropdown/types/Sort';
export const tableSortsScopedState = createScopedState<Sort[]>({
export const tableSortsScopedState = createStateScopeMap<Sort[]>({
key: 'tableSortsScopedState',
defaultValue: [],
});

View File

@ -22,13 +22,11 @@ export const SelectableMenuItemSelect = ({
onEntitySelected,
selectedEntity,
}: SelectableMenuItemSelectProps) => {
const { isSelectedItemIdFamilyState } = useSelectableList(
const { isSelectedItemIdSelector } = useSelectableList(
'single-entity-select-base-list',
);
const isSelectedItemId = useRecoilValue(
isSelectedItemIdFamilyState(entity.id),
);
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(entity.id));
return (
<StyledSelectableItem itemId={entity.id} key={entity.id}>

View File

@ -1,7 +1,7 @@
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
import { StateScopeMapKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/StateScopeMapKey';
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
type RelationPickerScopeInternalContextProps = ScopedStateKey;
type RelationPickerScopeInternalContextProps = StateScopeMapKey;
export const RelationPickerScopeInternalContext =
createScopeInternalContext<RelationPickerScopeInternalContextProps>();

View File

@ -1,8 +1,8 @@
import { IdentifiersMapper } from '@/object-record/relation-picker/types/IdentifiersMapper';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const identifiersMapperScopedState =
createScopedState<IdentifiersMapper | null>({
createStateScopeMap<IdentifiersMapper | null>({
key: 'identifiersMapperScopedState',
defaultValue: null,
});

View File

@ -1,6 +1,6 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const relationPickerPreselectedIdScopedState = createScopedState<
export const relationPickerPreselectedIdScopedState = createStateScopeMap<
string | undefined
>({
key: 'relationPickerPreselectedIdScopedState',

View File

@ -1,6 +1,7 @@
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const relationPickerSearchFilterScopedState = createScopedState<string>({
key: 'relationPickerSearchFilterScopedState',
defaultValue: '',
});
export const relationPickerSearchFilterScopedState =
createStateScopeMap<string>({
key: 'relationPickerSearchFilterScopedState',
defaultValue: '',
});

View File

@ -1,7 +1,7 @@
import { SearchQuery } from '@/object-record/relation-picker/types/SearchQuery';
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
export const searchQueryScopedState = createScopedState<SearchQuery | null>({
export const searchQueryScopedState = createStateScopeMap<SearchQuery | null>({
key: 'searchQueryScopedState',
defaultValue: null,
});