@ -9,8 +9,8 @@
|
|||||||
"start:clean": "yarn start --force",
|
"start:clean": "yarn start --force",
|
||||||
"build": "tsc && vite build && yarn build:inject-runtime-env",
|
"build": "tsc && vite build && yarn build:inject-runtime-env",
|
||||||
"build:inject-runtime-env": "sh ./scripts/inject-runtime-env.sh",
|
"build:inject-runtime-env": "sh ./scripts/inject-runtime-env.sh",
|
||||||
"tsc": "tsc --watch",
|
"tsc": "tsc --project tsconfig.app.json --watch",
|
||||||
"tsc:ci": "tsc",
|
"tsc:ci": "tsc --project tsconfig.app.json",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"lint": "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
|
"lint": "eslint . --report-unused-disable-directives --max-warnings 0 --config .eslintrc.cjs",
|
||||||
"lint:ci": "yarn lint --config .eslintrc-ci.cjs",
|
"lint:ci": "yarn lint --config .eslintrc-ci.cjs",
|
||||||
|
|||||||
@ -42,7 +42,7 @@ export const getSlashMenu = (imagesActivated: boolean) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (!imagesActivated) {
|
if (!imagesActivated) {
|
||||||
items = items.filter((x) => x.name != 'Image');
|
items = items.filter((x) => x.name !== 'Image');
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|||||||
@ -32,8 +32,8 @@ export const CommandMenuItem = ({
|
|||||||
Icon = IconArrowUpRight;
|
Icon = IconArrowUpRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isSelectedItemIdFamilyState } = useSelectableList();
|
const { isSelectedItemIdSelector } = useSelectableList();
|
||||||
const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(id));
|
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(id));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuItemCommand
|
<MenuItemCommand
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type ObjectFilterDropdownScopeInternalContextProps = ScopedStateKey;
|
type ObjectFilterDropdownScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const ObjectFilterDropdownScopeInternalContext =
|
export const ObjectFilterDropdownScopeInternalContext =
|
||||||
createScopeInternalContext<ObjectFilterDropdownScopeInternalContextProps>();
|
createScopeInternalContext<ObjectFilterDropdownScopeInternalContextProps>();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { FilterDefinition } from '@/object-record/object-filter-dropdown/types/FilterDefinition';
|
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[]
|
FilterDefinition[]
|
||||||
>({
|
>({
|
||||||
key: 'availableFilterDefinitionsScopedState',
|
key: 'availableFilterDefinitionsScopedState',
|
||||||
|
|||||||
@ -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';
|
import { FilterDefinition } from '../types/FilterDefinition';
|
||||||
|
|
||||||
export const filterDefinitionUsedInDropdownScopedState =
|
export const filterDefinitionUsedInDropdownScopedState =
|
||||||
createScopedState<FilterDefinition | null>({
|
createStateScopeMap<FilterDefinition | null>({
|
||||||
key: 'filterDefinitionUsedInDropdownScopedState',
|
key: 'filterDefinitionUsedInDropdownScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 =
|
export const isObjectFilterDropdownOperandSelectUnfoldedScopedState =
|
||||||
createScopedState<boolean>({
|
createStateScopeMap<boolean>({
|
||||||
key: 'isObjectFilterDropdownOperandSelectUnfoldedScopedState',
|
key: 'isObjectFilterDropdownOperandSelectUnfoldedScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 =
|
export const isObjectFilterDropdownUnfoldedScopedState =
|
||||||
createScopedState<boolean>({
|
createStateScopeMap<boolean>({
|
||||||
key: 'isObjectFilterDropdownUnfoldedScopedState',
|
key: 'isObjectFilterDropdownUnfoldedScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 =
|
export const objectFilterDropdownSearchInputScopedState =
|
||||||
createScopedState<string>({
|
createStateScopeMap<string>({
|
||||||
key: 'objectFilterDropdownSearchInputScopedState',
|
key: 'objectFilterDropdownSearchInputScopedState',
|
||||||
defaultValue: '',
|
defaultValue: '',
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 =
|
export const objectFilterDropdownSelectedEntityIdScopedState =
|
||||||
createScopedState<string | null>({
|
createStateScopeMap<string | null>({
|
||||||
key: 'objectFilterDropdownSelectedEntityIdScopedState',
|
key: 'objectFilterDropdownSelectedEntityIdScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 =
|
export const objectFilterDropdownSelectedRecordIdsScopedState =
|
||||||
createScopedState<string[]>({
|
createStateScopeMap<string[]>({
|
||||||
key: 'objectFilterDropdownSelectedRecordIdsScopedState',
|
key: 'objectFilterDropdownSelectedRecordIdsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { Filter } from '../types/Filter';
|
||||||
|
|
||||||
export const onFilterSelectScopedState = createScopedState<
|
export const onFilterSelectScopedState = createStateScopeMap<
|
||||||
((filter: Filter) => void) | undefined
|
((filter: Filter) => void) | undefined
|
||||||
>({
|
>({
|
||||||
key: 'onFilterSelectScopedState',
|
key: 'onFilterSelectScopedState',
|
||||||
|
|||||||
@ -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';
|
import { Filter } from '../types/Filter';
|
||||||
|
|
||||||
export const selectedFilterScopedState = createScopedState<Filter | undefined>({
|
export const selectedFilterScopedState = createStateScopeMap<
|
||||||
|
Filter | undefined
|
||||||
|
>({
|
||||||
key: 'selectedFilterScopedState',
|
key: 'selectedFilterScopedState',
|
||||||
defaultValue: undefined,
|
defaultValue: undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||||
|
|
||||||
export const selectedOperandInDropdownScopedState =
|
export const selectedOperandInDropdownScopedState =
|
||||||
createScopedState<ViewFilterOperand | null>({
|
createStateScopeMap<ViewFilterOperand | null>({
|
||||||
key: 'selectedOperandInDropdownScopedState',
|
key: 'selectedOperandInDropdownScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
import { Sort } from '../../types/Sort';
|
import { Sort } from '../../types/Sort';
|
||||||
|
|
||||||
type ObjectSortDropdownScopeInternalContextProps = ScopedStateKey & {
|
type ObjectSortDropdownScopeInternalContextProps = StateScopeMapKey & {
|
||||||
onSortSelect?: (sort: Sort) => void;
|
onSortSelect?: (sort: Sort) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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';
|
import { SortDefinition } from '../types/SortDefinition';
|
||||||
|
|
||||||
export const availableSortDefinitionsScopedState = createScopedState<
|
export const availableSortDefinitionsScopedState = createStateScopeMap<
|
||||||
SortDefinition[]
|
SortDefinition[]
|
||||||
>({
|
>({
|
||||||
key: 'availableSortDefinitionsScopedState',
|
key: 'availableSortDefinitionsScopedState',
|
||||||
|
|||||||
@ -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',
|
key: 'isSortSelectedScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { Sort } from '../types/Sort';
|
||||||
|
|
||||||
export const onSortSelectScopedState = createScopedState<
|
export const onSortSelectScopedState = createStateScopeMap<
|
||||||
((sort: Sort) => void) | undefined
|
((sort: Sort) => void) | undefined
|
||||||
>({
|
>({
|
||||||
key: 'onSortSelectScopedState',
|
key: 'onSortSelectScopedState',
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type RecordBoardScopeInternalContextProps = ScopedStateKey;
|
type RecordBoardScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const RecordBoardScopeInternalContext =
|
export const RecordBoardScopeInternalContext =
|
||||||
createScopeInternalContext<RecordBoardScopeInternalContextProps>();
|
createScopeInternalContext<RecordBoardScopeInternalContextProps>();
|
||||||
|
|||||||
@ -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',
|
key: 'activeRecordBoardCardIdsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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';
|
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
|
||||||
|
|
||||||
export const availableRecordBoardCardFieldsScopedState = createScopedState<
|
export const availableRecordBoardCardFieldsScopedState = createStateScopeMap<
|
||||||
BoardFieldDefinition<FieldMetadata>[]
|
BoardFieldDefinition<FieldMetadata>[]
|
||||||
>({
|
>({
|
||||||
key: 'availableRecordBoardCardFieldsScopedState',
|
key: 'availableRecordBoardCardFieldsScopedState',
|
||||||
|
|||||||
@ -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',
|
key: 'isCompactViewEnabledScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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',
|
key: 'isRecordBoardLoadedScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
||||||
import { BoardFieldDefinition } from '@/object-record/record-board/types/BoardFieldDefinition';
|
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
|
(fields: BoardFieldDefinition<FieldMetadata>[]) => void
|
||||||
>({
|
>({
|
||||||
key: 'onFieldsChangeScopedState',
|
key: 'onFieldsChangeScopedState',
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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';
|
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
|
||||||
|
|
||||||
export const recordBoardCardFieldsScopedState = createScopedState<
|
export const recordBoardCardFieldsScopedState = createStateScopeMap<
|
||||||
BoardFieldDefinition<FieldMetadata>[]
|
BoardFieldDefinition<FieldMetadata>[]
|
||||||
>({
|
>({
|
||||||
key: 'recordBoardCardFieldsScopedState',
|
key: 'recordBoardCardFieldsScopedState',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { BoardColumnDefinition } from '@/object-record/record-board/types/BoardColumnDefinition';
|
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[]
|
BoardColumnDefinition[]
|
||||||
>({
|
>({
|
||||||
key: 'recordBoardColumnsScopedState',
|
key: 'recordBoardColumnsScopedState',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Filter } from '@/object-record/object-filter-dropdown/types/Filter';
|
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',
|
key: 'recordBoardFiltersScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { Sort } from '../../object-sort-dropdown/types/Sort';
|
||||||
|
|
||||||
export const recordBoardSortsScopedState = createScopedState<Sort[]>({
|
export const recordBoardSortsScopedState = createStateScopeMap<Sort[]>({
|
||||||
key: 'recordBoardSortsScopedState',
|
key: 'recordBoardSortsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { Opportunity } from '@/pipeline/types/Opportunity';
|
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[]>({
|
export const savedOpportunitiesScopedState = createStateScopeMap<Opportunity[]>(
|
||||||
key: 'savedOpportunitiesScopedState',
|
{
|
||||||
defaultValue: [],
|
key: 'savedOpportunitiesScopedState',
|
||||||
});
|
defaultValue: [],
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
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',
|
key: 'savedPipelineStepsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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';
|
import { BoardFieldDefinition } from '../types/BoardFieldDefinition';
|
||||||
|
|
||||||
export const savedRecordBoardCardFieldsScopedState = createScopedState<
|
export const savedRecordBoardCardFieldsScopedState = createStateScopeMap<
|
||||||
BoardFieldDefinition<FieldMetadata>[]
|
BoardFieldDefinition<FieldMetadata>[]
|
||||||
>({
|
>({
|
||||||
key: 'savedRecordBoardCardFieldsScopedState',
|
key: 'savedRecordBoardCardFieldsScopedState',
|
||||||
|
|||||||
@ -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';
|
import { BoardColumnDefinition } from '../types/BoardColumnDefinition';
|
||||||
|
|
||||||
export const savedRecordBoardColumnsScopedState = createScopedState<
|
export const savedRecordBoardColumnsScopedState = createStateScopeMap<
|
||||||
BoardColumnDefinition[]
|
BoardColumnDefinition[]
|
||||||
>({
|
>({
|
||||||
key: 'savedRecordBoardColumnsScopedState',
|
key: 'savedRecordBoardColumnsScopedState',
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { Company } from '@/companies/types/Company';
|
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',
|
key: 'savedRecordsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 { availableRecordBoardCardFieldsScopedState } from '../availableRecordBoardCardFieldsScopedState';
|
||||||
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
|
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
|
||||||
|
|
||||||
export const hiddenRecordBoardCardFieldsScopedSelector = createScopedSelector({
|
export const hiddenRecordBoardCardFieldsScopedSelector = createSelectorScopeMap(
|
||||||
key: 'hiddenRecordBoardCardFieldsScopedSelector',
|
{
|
||||||
get:
|
key: 'hiddenRecordBoardCardFieldsScopedSelector',
|
||||||
({ scopeId }) =>
|
get:
|
||||||
({ get }) => {
|
({ scopeId }) =>
|
||||||
const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
|
({ get }) => {
|
||||||
const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
|
const fields = get(recordBoardCardFieldsScopedState({ scopeId }));
|
||||||
const otherAvailableKeys = get(
|
const fieldKeys = fields.map(({ fieldMetadataId }) => fieldMetadataId);
|
||||||
availableRecordBoardCardFieldsScopedState({ scopeId }),
|
const otherAvailableKeys = get(
|
||||||
).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
|
availableRecordBoardCardFieldsScopedState({ scopeId }),
|
||||||
|
).filter(({ fieldMetadataId }) => !fieldKeys.includes(fieldMetadataId));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...fields.filter((field) => !field.isVisible),
|
...fields.filter((field) => !field.isVisible),
|
||||||
...otherAvailableKeys,
|
...otherAvailableKeys,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|||||||
@ -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 { isRecordBoardCardSelectedFamilyState } from '../isRecordBoardCardSelectedFamilyState';
|
||||||
import { recordBoardCardIdsByColumnIdFamilyState } from '../recordBoardCardIdsByColumnIdFamilyState';
|
import { recordBoardCardIdsByColumnIdFamilyState } from '../recordBoardCardIdsByColumnIdFamilyState';
|
||||||
import { recordBoardColumnsScopedState } from '../recordBoardColumnsScopedState';
|
import { recordBoardColumnsScopedState } from '../recordBoardColumnsScopedState';
|
||||||
|
|
||||||
export const selectedRecordBoardCardIdsScopedSelector = createScopedSelector<
|
export const selectedRecordBoardCardIdsScopedSelector = createSelectorScopeMap<
|
||||||
string[]
|
string[]
|
||||||
>({
|
>({
|
||||||
key: 'selectedRecordBoardCardIdsScopedSelector',
|
key: 'selectedRecordBoardCardIdsScopedSelector',
|
||||||
|
|||||||
@ -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';
|
import { recordBoardCardFieldsScopedState } from '../recordBoardCardFieldsScopedState';
|
||||||
|
|
||||||
export const visibleRecordBoardCardFieldsScopedSelector = createScopedSelector({
|
export const visibleRecordBoardCardFieldsScopedSelector =
|
||||||
key: 'visibleRecordBoardCardFieldsScopedSelector',
|
createSelectorScopeMap({
|
||||||
get:
|
key: 'visibleRecordBoardCardFieldsScopedSelector',
|
||||||
({ scopeId }) =>
|
get:
|
||||||
({ get }) =>
|
({ scopeId }) =>
|
||||||
get(recordBoardCardFieldsScopedState({ scopeId }))
|
({ get }) =>
|
||||||
.filter((field) => field.isVisible)
|
get(recordBoardCardFieldsScopedState({ scopeId }))
|
||||||
.sort((a, b) => a.position - b.position),
|
.filter((field) => field.isVisible)
|
||||||
});
|
.sort((a, b) => a.position - b.position),
|
||||||
|
});
|
||||||
|
|||||||
@ -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,
|
boolean,
|
||||||
string
|
string
|
||||||
>({
|
>({
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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 { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
import { ColumnDefinition } from '../../types/ColumnDefinition';
|
import { ColumnDefinition } from '../../types/ColumnDefinition';
|
||||||
|
|
||||||
type RecordTableScopeInternalContextProps = ScopedStateKey & {
|
type RecordTableScopeInternalContextProps = StateScopeMapKey & {
|
||||||
onColumnsChange: (columns: ColumnDefinition<FieldMetadata>[]) => void;
|
onColumnsChange: (columns: ColumnDefinition<FieldMetadata>[]) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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';
|
import { ColumnDefinition } from '../types/ColumnDefinition';
|
||||||
|
|
||||||
export const availableTableColumnsScopedState = createScopedState<
|
export const availableTableColumnsScopedState = createStateScopeMap<
|
||||||
ColumnDefinition<FieldMetadata>[]
|
ColumnDefinition<FieldMetadata>[]
|
||||||
>({
|
>({
|
||||||
key: 'availableTableColumnsScopedState',
|
key: 'availableTableColumnsScopedState',
|
||||||
|
|||||||
@ -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';
|
import { TableCellPosition } from '../types/TableCellPosition';
|
||||||
|
|
||||||
export const currentTableCellInEditModePositionScopedState =
|
export const currentTableCellInEditModePositionScopedState =
|
||||||
createScopedState<TableCellPosition>({
|
createStateScopeMap<TableCellPosition>({
|
||||||
key: 'currentTableCellInEditModePositionScopedState',
|
key: 'currentTableCellInEditModePositionScopedState',
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
row: 0,
|
row: 0,
|
||||||
|
|||||||
@ -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 =
|
export const isRecordTableInitialLoadingScopedState =
|
||||||
createScopedState<boolean>({
|
createStateScopeMap<boolean>({
|
||||||
key: 'isRecordTableInitialLoadingScopedState',
|
key: 'isRecordTableInitialLoadingScopedState',
|
||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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',
|
key: 'isSoftFocusActiveScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { TableCellPosition } from '../types/TableCellPosition';
|
||||||
|
|
||||||
export const isSoftFocusOnTableCellScopedFamilyState = createScopedFamilyState<
|
export const isSoftFocusOnTableCellScopedFamilyState =
|
||||||
boolean,
|
createFamilyStateScopeMap<boolean, TableCellPosition>({
|
||||||
TableCellPosition
|
key: 'isSoftFocusOnTableCellScopedFamilyState',
|
||||||
>({
|
defaultValue: false,
|
||||||
key: 'isSoftFocusOnTableCellScopedFamilyState',
|
});
|
||||||
defaultValue: false,
|
|
||||||
});
|
|
||||||
|
|||||||
@ -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';
|
import { TableCellPosition } from '../types/TableCellPosition';
|
||||||
|
|
||||||
export const isTableCellInEditModeScopedFamilyState = createScopedFamilyState<
|
export const isTableCellInEditModeScopedFamilyState = createFamilyStateScopeMap<
|
||||||
boolean,
|
boolean,
|
||||||
TableCellPosition
|
TableCellPosition
|
||||||
>({
|
>({
|
||||||
|
|||||||
@ -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',
|
key: 'numberOfTableRowsScopedState',
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { ObjectMetadataConfig } from '@/object-record/record-table/types/ObjectMetadataConfig';
|
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 =
|
export const objectMetadataConfigScopedState =
|
||||||
createScopedState<ObjectMetadataConfig | null>({
|
createStateScopeMap<ObjectMetadataConfig | null>({
|
||||||
key: 'objectMetadataConfigScopedState',
|
key: 'objectMetadataConfigScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 { FieldMetadata } from '../../field/types/FieldMetadata';
|
||||||
import { ColumnDefinition } from '../types/ColumnDefinition';
|
import { ColumnDefinition } from '../types/ColumnDefinition';
|
||||||
|
|
||||||
export const onColumnsChangeScopedState = createScopedState<
|
export const onColumnsChangeScopedState = createStateScopeMap<
|
||||||
((columns: ColumnDefinition<FieldMetadata>[]) => void) | undefined
|
((columns: ColumnDefinition<FieldMetadata>[]) => void) | undefined
|
||||||
>({
|
>({
|
||||||
key: 'onColumnsChangeScopedState',
|
key: 'onColumnsChangeScopedState',
|
||||||
|
|||||||
@ -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
|
((entityCount: number) => void) | undefined
|
||||||
>({
|
>({
|
||||||
key: 'onEntityCountChangeScopedState',
|
key: 'onEntityCountChangeScopedState',
|
||||||
|
|||||||
@ -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',
|
key: 'resizeFieldOffsetScopedState',
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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 { AllRowsSelectedStatus } from '../../types/AllRowSelectedStatus';
|
||||||
import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
|
import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
|
||||||
@ -6,7 +6,7 @@ import { numberOfTableRowsScopedState } from '../numberOfTableRowsScopedState';
|
|||||||
import { selectedRowIdsScopedSelector } from './selectedRowIdsScopedSelector';
|
import { selectedRowIdsScopedSelector } from './selectedRowIdsScopedSelector';
|
||||||
|
|
||||||
export const allRowsSelectedStatusScopedSelector =
|
export const allRowsSelectedStatusScopedSelector =
|
||||||
createScopedSelector<AllRowsSelectedStatus>({
|
createSelectorScopeMap<AllRowsSelectedStatus>({
|
||||||
key: 'allRowsSelectedStatusScopedSelector',
|
key: 'allRowsSelectedStatusScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -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 { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
|
||||||
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
||||||
|
|
||||||
export const hiddenTableColumnsScopedSelector = createScopedSelector({
|
export const hiddenTableColumnsScopedSelector = createSelectorScopeMap({
|
||||||
key: 'hiddenTableColumnsScopedSelector',
|
key: 'hiddenTableColumnsScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -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';
|
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
||||||
|
|
||||||
export const numberOfTableColumnsScopedSelector = createScopedSelector({
|
export const numberOfTableColumnsScopedSelector = createSelectorScopeMap({
|
||||||
key: 'numberOfTableColumnsScopedSelector',
|
key: 'numberOfTableColumnsScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -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 { isRowSelectedScopedFamilyState } from '../../record-table-row/states/isRowSelectedScopedFamilyState';
|
||||||
import { tableRowIdsScopedState } from '../tableRowIdsScopedState';
|
import { tableRowIdsScopedState } from '../tableRowIdsScopedState';
|
||||||
|
|
||||||
export const selectedRowIdsScopedSelector = createScopedSelector<string[]>({
|
export const selectedRowIdsScopedSelector = createSelectorScopeMap<string[]>({
|
||||||
key: 'selectedRowIdsScopedSelector',
|
key: 'selectedRowIdsScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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 { ColumnDefinition } from '../../types/ColumnDefinition';
|
||||||
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
||||||
|
|
||||||
export const tableColumnsByKeyScopedSelector = createScopedSelector({
|
export const tableColumnsByKeyScopedSelector = createSelectorScopeMap({
|
||||||
key: 'tableColumnsByKeyScopedSelector',
|
key: 'tableColumnsByKeyScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -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 { availableTableColumnsScopedState } from '../availableTableColumnsScopedState';
|
||||||
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
import { tableColumnsScopedState } from '../tableColumnsScopedState';
|
||||||
|
|
||||||
export const visibleTableColumnsScopedSelector = createScopedSelector({
|
export const visibleTableColumnsScopedSelector = createSelectorScopeMap({
|
||||||
key: 'visibleTableColumnsScopedSelector',
|
key: 'visibleTableColumnsScopedSelector',
|
||||||
get:
|
get:
|
||||||
({ scopeId }) =>
|
({ scopeId }) =>
|
||||||
|
|||||||
@ -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';
|
import { TableCellPosition } from '../types/TableCellPosition';
|
||||||
|
|
||||||
export const softFocusPositionScopedState =
|
export const softFocusPositionScopedState =
|
||||||
createScopedState<TableCellPosition>({
|
createStateScopeMap<TableCellPosition>({
|
||||||
key: 'softFocusPositionScopedState',
|
key: 'softFocusPositionScopedState',
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
row: 0,
|
row: 0,
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { FieldMetadata } from '@/object-record/field/types/FieldMetadata';
|
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';
|
import { ColumnDefinition } from '../types/ColumnDefinition';
|
||||||
|
|
||||||
export const tableColumnsScopedState = createScopedState<
|
export const tableColumnsScopedState = createStateScopeMap<
|
||||||
ColumnDefinition<FieldMetadata>[]
|
ColumnDefinition<FieldMetadata>[]
|
||||||
>({
|
>({
|
||||||
key: 'tableColumnsScopedState',
|
key: 'tableColumnsScopedState',
|
||||||
|
|||||||
@ -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';
|
import { Filter } from '../../object-filter-dropdown/types/Filter';
|
||||||
|
|
||||||
export const tableFiltersScopedState = createScopedState<Filter[]>({
|
export const tableFiltersScopedState = createStateScopeMap<Filter[]>({
|
||||||
key: 'tableFiltersScopedState',
|
key: 'tableFiltersScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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',
|
key: 'tableLastRowVisibleScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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',
|
key: 'tableRowIdsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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';
|
import { Sort } from '../../object-sort-dropdown/types/Sort';
|
||||||
|
|
||||||
export const tableSortsScopedState = createScopedState<Sort[]>({
|
export const tableSortsScopedState = createStateScopeMap<Sort[]>({
|
||||||
key: 'tableSortsScopedState',
|
key: 'tableSortsScopedState',
|
||||||
defaultValue: [],
|
defaultValue: [],
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,13 +22,11 @@ export const SelectableMenuItemSelect = ({
|
|||||||
onEntitySelected,
|
onEntitySelected,
|
||||||
selectedEntity,
|
selectedEntity,
|
||||||
}: SelectableMenuItemSelectProps) => {
|
}: SelectableMenuItemSelectProps) => {
|
||||||
const { isSelectedItemIdFamilyState } = useSelectableList(
|
const { isSelectedItemIdSelector } = useSelectableList(
|
||||||
'single-entity-select-base-list',
|
'single-entity-select-base-list',
|
||||||
);
|
);
|
||||||
|
|
||||||
const isSelectedItemId = useRecoilValue(
|
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(entity.id));
|
||||||
isSelectedItemIdFamilyState(entity.id),
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledSelectableItem itemId={entity.id} key={entity.id}>
|
<StyledSelectableItem itemId={entity.id} key={entity.id}>
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type RelationPickerScopeInternalContextProps = ScopedStateKey;
|
type RelationPickerScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const RelationPickerScopeInternalContext =
|
export const RelationPickerScopeInternalContext =
|
||||||
createScopeInternalContext<RelationPickerScopeInternalContextProps>();
|
createScopeInternalContext<RelationPickerScopeInternalContextProps>();
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
import { IdentifiersMapper } from '@/object-record/relation-picker/types/IdentifiersMapper';
|
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 =
|
export const identifiersMapperScopedState =
|
||||||
createScopedState<IdentifiersMapper | null>({
|
createStateScopeMap<IdentifiersMapper | null>({
|
||||||
key: 'identifiersMapperScopedState',
|
key: 'identifiersMapperScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -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
|
string | undefined
|
||||||
>({
|
>({
|
||||||
key: 'relationPickerPreselectedIdScopedState',
|
key: 'relationPickerPreselectedIdScopedState',
|
||||||
|
|||||||
@ -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>({
|
export const relationPickerSearchFilterScopedState =
|
||||||
key: 'relationPickerSearchFilterScopedState',
|
createStateScopeMap<string>({
|
||||||
defaultValue: '',
|
key: 'relationPickerSearchFilterScopedState',
|
||||||
});
|
defaultValue: '',
|
||||||
|
});
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { SearchQuery } from '@/object-record/relation-picker/types/SearchQuery';
|
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',
|
key: 'searchQueryScopedState',
|
||||||
defaultValue: null,
|
defaultValue: null,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export const SettingsAccountsEmailsCard = ({
|
|||||||
<Card>
|
<Card>
|
||||||
{accounts.map((account, index) => (
|
{accounts.map((account, index) => (
|
||||||
<SettingsAccountRow
|
<SettingsAccountRow
|
||||||
key={account.uuid}
|
key={account.id}
|
||||||
LeftIcon={IconGmail}
|
LeftIcon={IconGmail}
|
||||||
account={account}
|
account={account}
|
||||||
rightComponent={
|
rightComponent={
|
||||||
@ -43,7 +43,7 @@ export const SettingsAccountsEmailsCard = ({
|
|||||||
<LightIconButton Icon={IconChevronRight} accent="tertiary" />
|
<LightIconButton Icon={IconChevronRight} accent="tertiary" />
|
||||||
</StyledRightContainer>
|
</StyledRightContainer>
|
||||||
}
|
}
|
||||||
onClick={() => navigate(`/settings/accounts/emails/${account.uuid}`)}
|
onClick={() => navigate(`/settings/accounts/emails/${account.id}`)}
|
||||||
divider={index < accounts.length - 1}
|
divider={index < accounts.length - 1}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type DialogManagerScopeInternalContextProps = ScopedStateKey;
|
type DialogManagerScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const DialogManagerScopeInternalContext =
|
export const DialogManagerScopeInternalContext =
|
||||||
createScopeInternalContext<DialogManagerScopeInternalContextProps>();
|
createScopeInternalContext<DialogManagerScopeInternalContextProps>();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
import { DialogOptions } from '../types/DialogOptions';
|
import { DialogOptions } from '../types/DialogOptions';
|
||||||
|
|
||||||
@ -7,7 +7,7 @@ type DialogState = {
|
|||||||
queue: DialogOptions[];
|
queue: DialogOptions[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dialogInternalScopedState = createScopedState<DialogState>({
|
export const dialogInternalScopedState = createStateScopeMap<DialogState>({
|
||||||
key: 'dialog/internal-state',
|
key: 'dialog/internal-state',
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
maxQueue: 2,
|
maxQueue: 2,
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type SnackBarManagerScopeInternalContextProps = ScopedStateKey;
|
type SnackBarManagerScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const SnackBarManagerScopeInternalContext =
|
export const SnackBarManagerScopeInternalContext =
|
||||||
createScopeInternalContext<SnackBarManagerScopeInternalContextProps>();
|
createScopeInternalContext<SnackBarManagerScopeInternalContextProps>();
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
import { SnackBarProps } from '../components/SnackBar';
|
import { SnackBarProps } from '../components/SnackBar';
|
||||||
|
|
||||||
@ -11,7 +11,7 @@ type SnackBarState = {
|
|||||||
queue: SnackBarOptions[];
|
queue: SnackBarOptions[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const snackBarInternalScopedState = createScopedState<SnackBarState>({
|
export const snackBarInternalScopedState = createStateScopeMap<SnackBarState>({
|
||||||
key: 'snackBarState',
|
key: 'snackBarState',
|
||||||
defaultValue: {
|
defaultValue: {
|
||||||
maxQueue: 3,
|
maxQueue: 3,
|
||||||
|
|||||||
@ -61,9 +61,9 @@ const IconPickerIcon = ({
|
|||||||
selectedIconKey,
|
selectedIconKey,
|
||||||
Icon,
|
Icon,
|
||||||
}: IconPickerIconProps) => {
|
}: IconPickerIconProps) => {
|
||||||
const { isSelectedItemIdFamilyState } = useSelectableList();
|
const { isSelectedItemIdSelector } = useSelectableList();
|
||||||
|
|
||||||
const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(iconKey));
|
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(iconKey));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledLightIconButton
|
<StyledLightIconButton
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type DropdownScopeInternalContextProps = ScopedStateKey;
|
type DropdownScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const DropdownScopeInternalContext =
|
export const DropdownScopeInternalContext =
|
||||||
createScopeInternalContext<DropdownScopeInternalContextProps>();
|
createScopeInternalContext<DropdownScopeInternalContextProps>();
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
export const dropdownHotkeyScopeScopedState = createScopedState<
|
export const dropdownHotkeyScopeScopedState = createStateScopeMap<
|
||||||
HotkeyScope | null | undefined
|
HotkeyScope | null | undefined
|
||||||
>({
|
>({
|
||||||
key: 'dropdownHotkeyScopeScopedState',
|
key: 'dropdownHotkeyScopeScopedState',
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
export const dropdownWidthScopedState = createScopedState<number | undefined>({
|
export const dropdownWidthScopedState = createStateScopeMap<number | undefined>(
|
||||||
key: 'dropdownWidthScopedState',
|
{
|
||||||
defaultValue: 160,
|
key: 'dropdownWidthScopedState',
|
||||||
});
|
defaultValue: 160,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
export const isDropdownOpenScopedState = createScopedState<boolean>({
|
export const isDropdownOpenScopedState = createStateScopeMap<boolean>({
|
||||||
key: 'isDropdownOpenScopedState',
|
key: 'isDropdownOpenScopedState',
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -14,9 +14,9 @@ export const SelectableItem = ({
|
|||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
}: SelectableItemProps) => {
|
}: SelectableItemProps) => {
|
||||||
const { isSelectedItemIdFamilyState } = useSelectableList();
|
const { isSelectedItemIdSelector } = useSelectableList();
|
||||||
|
|
||||||
const isSelectedItemId = useRecoilValue(isSelectedItemIdFamilyState(itemId));
|
const isSelectedItemId = useRecoilValue(isSelectedItemIdSelector(itemId));
|
||||||
|
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { useRecoilCallback } from 'recoil';
|
import { useRecoilCallback } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
|
|
||||||
import { useSelectableListScopedState } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState';
|
import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
|
||||||
import { getSelectableListScopeInjectors } from '@/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors';
|
|
||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||||
|
import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotValue';
|
||||||
|
|
||||||
type Direction = 'up' | 'down' | 'left' | 'right';
|
type Direction = 'up' | 'down' | 'left' | 'right';
|
||||||
|
|
||||||
@ -27,27 +27,22 @@ export const useSelectableListHotKeys = (
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const { injectSnapshotValueWithSelectableListScopeId } =
|
const {
|
||||||
useSelectableListScopedState({
|
selectedItemIdState,
|
||||||
selectableListScopeId: scopeId,
|
selectableItemIdsState,
|
||||||
});
|
isSelectedItemIdSelector,
|
||||||
|
selectableListOnEnterState,
|
||||||
|
} = useSelectableListStates({
|
||||||
|
selectableListScopeId: scopeId,
|
||||||
|
});
|
||||||
|
|
||||||
const handleSelect = useRecoilCallback(
|
const handleSelect = useRecoilCallback(
|
||||||
({ snapshot, set }) =>
|
({ snapshot, set }) =>
|
||||||
(direction: Direction) => {
|
(direction: Direction) => {
|
||||||
const {
|
const selectedItemId = getSnapshotValue(snapshot, selectedItemIdState);
|
||||||
selectedItemIdScopeInjector,
|
const selectableItemIds = getSnapshotValue(
|
||||||
selectableItemIdsScopeInjector,
|
|
||||||
isSelectedItemIdFamilyScopeInjector,
|
|
||||||
} = getSelectableListScopeInjectors();
|
|
||||||
|
|
||||||
const selectedItemId = injectSnapshotValueWithSelectableListScopeId(
|
|
||||||
snapshot,
|
snapshot,
|
||||||
selectedItemIdScopeInjector,
|
selectableItemIdsState,
|
||||||
);
|
|
||||||
const selectableItemIds = injectSnapshotValueWithSelectableListScopeId(
|
|
||||||
snapshot,
|
|
||||||
selectableItemIdsScopeInjector,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const currentPosition = findPosition(selectableItemIds, selectedItemId);
|
const currentPosition = findPosition(selectableItemIds, selectedItemId);
|
||||||
@ -107,19 +102,16 @@ export const useSelectableListHotKeys = (
|
|||||||
|
|
||||||
if (selectedItemId !== nextId) {
|
if (selectedItemId !== nextId) {
|
||||||
if (nextId) {
|
if (nextId) {
|
||||||
set(isSelectedItemIdFamilyScopeInjector(scopeId, nextId), true);
|
set(isSelectedItemIdSelector(nextId), true);
|
||||||
set(selectedItemIdScopeInjector(scopeId), nextId);
|
set(selectedItemIdState, nextId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedItemId) {
|
if (selectedItemId) {
|
||||||
set(
|
set(isSelectedItemIdSelector(selectedItemId), false);
|
||||||
isSelectedItemIdFamilyScopeInjector(scopeId, selectedItemId),
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[injectSnapshotValueWithSelectableListScopeId, scopeId],
|
[isSelectedItemIdSelector, selectableItemIdsState, selectedItemIdState],
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedHotkeys(Key.ArrowUp, () => handleSelect('up'), hotkeyScope, []);
|
useScopedHotkeys(Key.ArrowUp, () => handleSelect('up'), hotkeyScope, []);
|
||||||
@ -140,25 +132,20 @@ export const useSelectableListHotKeys = (
|
|||||||
useRecoilCallback(
|
useRecoilCallback(
|
||||||
({ snapshot }) =>
|
({ snapshot }) =>
|
||||||
() => {
|
() => {
|
||||||
const {
|
const selectedItemId = getSnapshotValue(
|
||||||
selectedItemIdScopeInjector,
|
|
||||||
selectableListOnEnterScopeInjector,
|
|
||||||
} = getSelectableListScopeInjectors();
|
|
||||||
const selectedItemId = injectSnapshotValueWithSelectableListScopeId(
|
|
||||||
snapshot,
|
snapshot,
|
||||||
selectedItemIdScopeInjector,
|
selectedItemIdState,
|
||||||
);
|
);
|
||||||
|
const onEnter = getSnapshotValue(
|
||||||
const onEnter = injectSnapshotValueWithSelectableListScopeId(
|
|
||||||
snapshot,
|
snapshot,
|
||||||
selectableListOnEnterScopeInjector,
|
selectableListOnEnterState,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectedItemId) {
|
if (selectedItemId) {
|
||||||
onEnter?.(selectedItemId);
|
onEnter?.(selectedItemId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[injectSnapshotValueWithSelectableListScopeId],
|
[selectableListOnEnterState, selectedItemIdState],
|
||||||
),
|
),
|
||||||
hotkeyScope,
|
hotkeyScope,
|
||||||
[],
|
[],
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
import { SelectableListScopeInternalContext } from '@/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext';
|
|
||||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
|
||||||
import { useScopedState } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useScopedState';
|
|
||||||
|
|
||||||
type UseSelectableListScopedStatesProps = {
|
|
||||||
selectableListScopeId?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useSelectableListScopedState = ({
|
|
||||||
selectableListScopeId,
|
|
||||||
}: UseSelectableListScopedStatesProps) => {
|
|
||||||
const scopeId = useAvailableScopeIdOrThrow(
|
|
||||||
SelectableListScopeInternalContext,
|
|
||||||
selectableListScopeId,
|
|
||||||
);
|
|
||||||
|
|
||||||
const {
|
|
||||||
getScopedState,
|
|
||||||
getScopedFamilyState,
|
|
||||||
getScopedSnapshotValue,
|
|
||||||
getScopedFamilySnapshotValue,
|
|
||||||
} = useScopedState(scopeId);
|
|
||||||
|
|
||||||
return {
|
|
||||||
scopeId,
|
|
||||||
injectStateWithSelectableListScopeId: getScopedState,
|
|
||||||
injectFamilyStateWithSelectableListScopeId: getScopedFamilyState,
|
|
||||||
injectSnapshotValueWithSelectableListScopeId: getScopedSnapshotValue,
|
|
||||||
injectFamilySnapshotValueWithSelectableListScopeId:
|
|
||||||
getScopedFamilySnapshotValue,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
import { SelectableListScopeInternalContext } from '@/ui/layout/selectable-list/scopes/scope-internal-context/SelectableListScopeInternalContext';
|
||||||
|
import { selectableItemIdsStateScopeMap } from '@/ui/layout/selectable-list/states/selectableItemIdsStateScopeMap';
|
||||||
|
import { selectableListOnEnterStateScopeMap } from '@/ui/layout/selectable-list/states/selectableListOnEnterStateScopeMap';
|
||||||
|
import { selectedItemIdStateScopeMap } from '@/ui/layout/selectable-list/states/selectedItemIdStateScopeMap';
|
||||||
|
import { isSelectedItemIdFamilySelectorScopeMap } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdFamilySelectorScopeMap';
|
||||||
|
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||||
|
import { getFamilyState } from '@/ui/utilities/recoil-scope/utils/getFamilyState';
|
||||||
|
import { getState } from '@/ui/utilities/recoil-scope/utils/getState';
|
||||||
|
|
||||||
|
type useSelectableListStatesProps = {
|
||||||
|
selectableListScopeId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useSelectableListStates = ({
|
||||||
|
selectableListScopeId,
|
||||||
|
}: useSelectableListStatesProps) => {
|
||||||
|
const scopeId = useAvailableScopeIdOrThrow(
|
||||||
|
SelectableListScopeInternalContext,
|
||||||
|
selectableListScopeId,
|
||||||
|
);
|
||||||
|
|
||||||
|
return {
|
||||||
|
scopeId,
|
||||||
|
isSelectedItemIdSelector: getFamilyState(
|
||||||
|
isSelectedItemIdFamilySelectorScopeMap,
|
||||||
|
scopeId,
|
||||||
|
),
|
||||||
|
selectableItemIdsState: getState(selectableItemIdsStateScopeMap, scopeId),
|
||||||
|
selectableListOnEnterState: getState(
|
||||||
|
selectableListOnEnterStateScopeMap,
|
||||||
|
scopeId,
|
||||||
|
),
|
||||||
|
selectedItemIdState: getState(selectedItemIdStateScopeMap, scopeId),
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -1,38 +1,24 @@
|
|||||||
import { useResetRecoilState, useSetRecoilState } from 'recoil';
|
import { useResetRecoilState, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { useSelectableListScopedState } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListScopedState';
|
import { useSelectableListStates } from '@/ui/layout/selectable-list/hooks/internal/useSelectableListStates';
|
||||||
import { getSelectableListScopeInjectors } from '@/ui/layout/selectable-list/utils/internal/getSelectableListScopeInjectors';
|
|
||||||
|
|
||||||
export const useSelectableList = (selectableListId?: string) => {
|
export const useSelectableList = (selectableListId?: string) => {
|
||||||
const {
|
const {
|
||||||
injectStateWithSelectableListScopeId,
|
|
||||||
injectFamilyStateWithSelectableListScopeId,
|
|
||||||
scopeId,
|
scopeId,
|
||||||
} = useSelectableListScopedState({
|
selectableItemIdsState,
|
||||||
|
selectableListOnEnterState,
|
||||||
|
isSelectedItemIdSelector,
|
||||||
|
selectedItemIdState,
|
||||||
|
} = useSelectableListStates({
|
||||||
selectableListScopeId: selectableListId,
|
selectableListScopeId: selectableListId,
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const setSelectableItemIds = useSetRecoilState(selectableItemIdsState);
|
||||||
selectedItemIdScopeInjector,
|
|
||||||
selectableItemIdsScopeInjector,
|
|
||||||
selectableListOnEnterScopeInjector,
|
|
||||||
isSelectedItemIdFamilyScopeInjector,
|
|
||||||
} = getSelectableListScopeInjectors();
|
|
||||||
|
|
||||||
const setSelectableItemIds = useSetRecoilState(
|
|
||||||
injectStateWithSelectableListScopeId(selectableItemIdsScopeInjector),
|
|
||||||
);
|
|
||||||
const setSelectableListOnEnter = useSetRecoilState(
|
const setSelectableListOnEnter = useSetRecoilState(
|
||||||
injectStateWithSelectableListScopeId(selectableListOnEnterScopeInjector),
|
selectableListOnEnterState,
|
||||||
);
|
);
|
||||||
const isSelectedItemIdFamilyState =
|
|
||||||
injectFamilyStateWithSelectableListScopeId(
|
|
||||||
isSelectedItemIdFamilyScopeInjector,
|
|
||||||
);
|
|
||||||
|
|
||||||
const resetSelectedItemIdState = useResetRecoilState(
|
const resetSelectedItemIdState = useResetRecoilState(selectedItemIdState);
|
||||||
injectStateWithSelectableListScopeId(selectedItemIdScopeInjector),
|
|
||||||
);
|
|
||||||
|
|
||||||
const resetSelectedItem = () => {
|
const resetSelectedItem = () => {
|
||||||
resetSelectedItemIdState();
|
resetSelectedItemIdState();
|
||||||
@ -42,7 +28,7 @@ export const useSelectableList = (selectableListId?: string) => {
|
|||||||
selectableListId: scopeId,
|
selectableListId: scopeId,
|
||||||
|
|
||||||
setSelectableItemIds,
|
setSelectableItemIds,
|
||||||
isSelectedItemIdFamilyState,
|
isSelectedItemIdSelector,
|
||||||
setSelectableListOnEnter,
|
setSelectableListOnEnter,
|
||||||
resetSelectedItem,
|
resetSelectedItem,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -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';
|
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||||
|
|
||||||
type SelectableListScopeInternalContextProps = ScopedStateKey;
|
type SelectableListScopeInternalContextProps = StateScopeMapKey;
|
||||||
|
|
||||||
export const SelectableListScopeInternalContext =
|
export const SelectableListScopeInternalContext =
|
||||||
createScopeInternalContext<SelectableListScopeInternalContextProps>();
|
createScopeInternalContext<SelectableListScopeInternalContextProps>();
|
||||||
|
|||||||
@ -0,0 +1,9 @@
|
|||||||
|
import { createFamilyStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilyStateScopeMap';
|
||||||
|
|
||||||
|
export const isSelectedItemIdFamilyStateScopeMap = createFamilyStateScopeMap<
|
||||||
|
boolean,
|
||||||
|
string
|
||||||
|
>({
|
||||||
|
key: 'isSelectedItemIdMapScopedFamilyState',
|
||||||
|
defaultValue: false,
|
||||||
|
});
|
||||||
@ -1,9 +0,0 @@
|
|||||||
import { createScopedFamilyState } from '@/ui/utilities/recoil-scope/utils/createScopedFamilyState';
|
|
||||||
|
|
||||||
export const isSelectedItemIdMapScopedFamilyState = createScopedFamilyState<
|
|
||||||
boolean,
|
|
||||||
string
|
|
||||||
>({
|
|
||||||
key: 'isSelectedItemIdMapScopedFamilyState',
|
|
||||||
defaultValue: false,
|
|
||||||
});
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
|
||||||
|
|
||||||
export const selectableItemIdsScopedState = createScopedState<string[][]>({
|
|
||||||
key: 'selectableItemIdsScopedState',
|
|
||||||
defaultValue: [[]],
|
|
||||||
});
|
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
|
export const selectableItemIdsStateScopeMap = createStateScopeMap<string[][]>({
|
||||||
|
key: 'selectableItemIdsScopedState',
|
||||||
|
defaultValue: [[]],
|
||||||
|
});
|
||||||
@ -1,8 +0,0 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
|
||||||
|
|
||||||
export const selectableListOnEnterScopedState = createScopedState<
|
|
||||||
((itemId: string) => void) | undefined
|
|
||||||
>({
|
|
||||||
key: 'selectableListOnEnterScopedState',
|
|
||||||
defaultValue: undefined,
|
|
||||||
});
|
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
|
export const selectableListOnEnterStateScopeMap = createStateScopeMap<
|
||||||
|
((itemId: string) => void) | undefined
|
||||||
|
>({
|
||||||
|
key: 'selectableListOnEnterScopedState',
|
||||||
|
defaultValue: undefined,
|
||||||
|
});
|
||||||
@ -1,6 +0,0 @@
|
|||||||
import { createScopedState } from '@/ui/utilities/recoil-scope/utils/createScopedState';
|
|
||||||
|
|
||||||
export const selectedItemIdScopedState = createScopedState<string | null>({
|
|
||||||
key: 'selectedItemIdScopedState',
|
|
||||||
defaultValue: null,
|
|
||||||
});
|
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
import { createStateScopeMap } from '@/ui/utilities/recoil-scope/utils/createStateScopeMap';
|
||||||
|
|
||||||
|
export const selectedItemIdStateScopeMap = createStateScopeMap<string | null>({
|
||||||
|
key: 'selectedItemIdScopedState',
|
||||||
|
defaultValue: null,
|
||||||
|
});
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
import { isSelectedItemIdFamilyStateScopeMap } from '@/ui/layout/selectable-list/states/isSelectedItemIdFamilyStateScopeMap';
|
||||||
|
import { createFamilySelectorScopeMap } from '@/ui/utilities/recoil-scope/utils/createFamilySelectorScopeMap';
|
||||||
|
|
||||||
|
export const isSelectedItemIdFamilySelectorScopeMap =
|
||||||
|
createFamilySelectorScopeMap<boolean, string>({
|
||||||
|
key: 'isSelectedItemIdScopedFamilySelector',
|
||||||
|
get:
|
||||||
|
({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
|
||||||
|
({ get }) =>
|
||||||
|
get(
|
||||||
|
isSelectedItemIdFamilyStateScopeMap({
|
||||||
|
scopeId: scopeId,
|
||||||
|
familyKey: familyKey,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
set:
|
||||||
|
({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
|
||||||
|
({ set }, newValue) =>
|
||||||
|
set(
|
||||||
|
isSelectedItemIdFamilyStateScopeMap({
|
||||||
|
scopeId: scopeId,
|
||||||
|
familyKey: familyKey,
|
||||||
|
}),
|
||||||
|
newValue,
|
||||||
|
),
|
||||||
|
});
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import { isSelectedItemIdMapScopedFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdMapScopedFamilyState';
|
|
||||||
import { createScopedFamilySelector } from '@/ui/utilities/recoil-scope/utils/createScopedFamilySelector';
|
|
||||||
|
|
||||||
export const isSelectedItemIdScopedFamilySelector = createScopedFamilySelector<
|
|
||||||
boolean,
|
|
||||||
string
|
|
||||||
>({
|
|
||||||
key: 'isSelectedItemIdScopedFamilySelector',
|
|
||||||
get:
|
|
||||||
({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
|
|
||||||
({ get }) =>
|
|
||||||
get(
|
|
||||||
isSelectedItemIdMapScopedFamilyState({
|
|
||||||
scopeId: scopeId,
|
|
||||||
familyKey: familyKey,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
set:
|
|
||||||
({ scopeId, familyKey }: { scopeId: string; familyKey: string }) =>
|
|
||||||
({ set }, newValue) =>
|
|
||||||
set(
|
|
||||||
isSelectedItemIdMapScopedFamilyState({
|
|
||||||
scopeId: scopeId,
|
|
||||||
familyKey: familyKey,
|
|
||||||
}),
|
|
||||||
newValue,
|
|
||||||
),
|
|
||||||
});
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import { selectableItemIdsScopedState } from '@/ui/layout/selectable-list/states/selectableItemIdsScopedState';
|
|
||||||
import { selectableListOnEnterScopedState } from '@/ui/layout/selectable-list/states/selectableListOnEnterScopedState';
|
|
||||||
import { selectedItemIdScopedState } from '@/ui/layout/selectable-list/states/selectedItemIdScopedState';
|
|
||||||
import { isSelectedItemIdScopedFamilySelector } from '@/ui/layout/selectable-list/states/selectors/isSelectedItemIdScopedFamilySelector';
|
|
||||||
import { getFamilyScopeInjector } from '@/ui/utilities/recoil-scope/utils/getFamilyScopeInjector';
|
|
||||||
import { getScopeInjector } from '@/ui/utilities/recoil-scope/utils/getScopeInjector';
|
|
||||||
|
|
||||||
export const getSelectableListScopeInjectors = () => {
|
|
||||||
const selectedItemIdScopeInjector = getScopeInjector(
|
|
||||||
selectedItemIdScopedState,
|
|
||||||
);
|
|
||||||
const selectableItemIdsScopeInjector = getScopeInjector(
|
|
||||||
selectableItemIdsScopedState,
|
|
||||||
);
|
|
||||||
const selectableListOnEnterScopeInjector = getScopeInjector(
|
|
||||||
selectableListOnEnterScopedState,
|
|
||||||
);
|
|
||||||
const isSelectedItemIdFamilyScopeInjector = getFamilyScopeInjector(
|
|
||||||
isSelectedItemIdScopedFamilySelector,
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
selectedItemIdScopeInjector,
|
|
||||||
selectableItemIdsScopeInjector,
|
|
||||||
selectableListOnEnterScopeInjector,
|
|
||||||
isSelectedItemIdFamilyScopeInjector,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@ -1,13 +1,13 @@
|
|||||||
import { RecoilState, SerializableParam, useRecoilState } from 'recoil';
|
import { RecoilState, SerializableParam, useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
|
import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
|
||||||
|
|
||||||
export const useRecoilScopedFamilyState = <
|
export const useRecoilScopedFamilyState = <
|
||||||
StateType,
|
StateType,
|
||||||
FamilyKey extends SerializableParam,
|
FamilyKey extends SerializableParam,
|
||||||
>(
|
>(
|
||||||
recoilState: (
|
recoilState: (
|
||||||
scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
|
scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
|
||||||
) => RecoilState<StateType>,
|
) => RecoilState<StateType>,
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
familyKey?: FamilyKey,
|
familyKey?: FamilyKey,
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { RecoilState, useRecoilState } from 'recoil';
|
import { RecoilState, useRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
|
import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
|
||||||
|
|
||||||
export const useRecoilScopedStateV2 = <StateType>(
|
export const useRecoilScopedStateV2 = <StateType>(
|
||||||
recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
|
recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
) => {
|
) => {
|
||||||
return useRecoilState<StateType>(
|
return useRecoilState<StateType>(
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { RecoilState, useRecoilValue } from 'recoil';
|
import { RecoilState, useRecoilValue } from 'recoil';
|
||||||
|
|
||||||
import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
|
import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
|
||||||
|
|
||||||
export const useRecoilScopedValueV2 = <StateType>(
|
export const useRecoilScopedValueV2 = <StateType>(
|
||||||
recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
|
recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
) => {
|
) => {
|
||||||
return useRecoilValue<StateType>(
|
return useRecoilValue<StateType>(
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { RecoilState, SerializableParam, useSetRecoilState } from 'recoil';
|
import { RecoilState, SerializableParam, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { ScopedFamilyStateKey } from '../scopes-internal/types/ScopedFamilyStateKey';
|
import { FamilyStateScopeMapKey } from '../scopes-internal/types/FamilyStateScopeMapKey';
|
||||||
|
|
||||||
export const useSetRecoilScopedFamilyState = <
|
export const useSetRecoilScopedFamilyState = <
|
||||||
StateType,
|
StateType,
|
||||||
FamilyKey extends SerializableParam,
|
FamilyKey extends SerializableParam,
|
||||||
>(
|
>(
|
||||||
recoilState: (
|
recoilState: (
|
||||||
scopedFamilyKey: ScopedFamilyStateKey<FamilyKey>,
|
scopedFamilyKey: FamilyStateScopeMapKey<FamilyKey>,
|
||||||
) => RecoilState<StateType>,
|
) => RecoilState<StateType>,
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
familyKey?: FamilyKey,
|
familyKey?: FamilyKey,
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { RecoilState, useSetRecoilState } from 'recoil';
|
import { RecoilState, useSetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { ScopedStateKey } from '../scopes-internal/types/ScopedStateKey';
|
import { StateScopeMapKey } from '../scopes-internal/types/StateScopeMapKey';
|
||||||
|
|
||||||
export const useSetRecoilScopedStateV2 = <StateType>(
|
export const useSetRecoilScopedStateV2 = <StateType>(
|
||||||
recoilState: (scopedKey: ScopedStateKey) => RecoilState<StateType>,
|
recoilState: (scopedKey: StateScopeMapKey) => RecoilState<StateType>,
|
||||||
scopeId: string,
|
scopeId: string,
|
||||||
) => {
|
) => {
|
||||||
return useSetRecoilState<StateType>(
|
return useSetRecoilState<StateType>(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { SerializableParam } from 'recoil';
|
import { SerializableParam } from 'recoil';
|
||||||
|
|
||||||
export type ScopedFamilyStateKey<FamilyKey extends SerializableParam> = {
|
export type FamilyStateScopeMapKey<FamilyKey extends SerializableParam> = {
|
||||||
scopeId: string;
|
scopeId: string;
|
||||||
familyKey: FamilyKey;
|
familyKey: FamilyKey;
|
||||||
};
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user