mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
M: Remove MockCst from sideView
This commit is contained in:
parent
00a1deda32
commit
ae1fceafcf
|
@ -96,8 +96,6 @@ export function DependencyIcon({ value, size = '1.25rem', className }: DomIconPr
|
|||
switch (value) {
|
||||
case DependencyMode.ALL:
|
||||
return <IconSettings size={size} className={className} />;
|
||||
case DependencyMode.EXPRESSION:
|
||||
return <IconText size={size} className={className ?? 'clr-text-primary'} />;
|
||||
case DependencyMode.OUTPUTS:
|
||||
return <IconGraphOutputs size={size} className={className ?? 'clr-text-primary'} />;
|
||||
case DependencyMode.INPUTS:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import clsx from 'clsx';
|
||||
|
||||
import { CstClass, IConstituenta } from '@/models/rsform';
|
||||
import { isMockCst } from '@/models/rsformAPI';
|
||||
import { colorFgCstStatus, IColorTheme } from '@/styling/color';
|
||||
|
||||
import { CProps } from '../props';
|
||||
|
@ -28,11 +27,7 @@ function BadgeConstituenta({ value, prefixID, className, style, theme }: BadgeCo
|
|||
style={{
|
||||
borderColor: colorFgCstStatus(value.status, theme),
|
||||
color: colorFgCstStatus(value.status, theme),
|
||||
backgroundColor: isMockCst(value)
|
||||
? theme.bgWarning
|
||||
: value.cst_class === CstClass.BASIC
|
||||
? theme.bgGreen25
|
||||
: theme.bgInput,
|
||||
backgroundColor: value.cst_class === CstClass.BASIC ? theme.bgGreen25 : theme.bgInput,
|
||||
...style
|
||||
}}
|
||||
>
|
||||
|
|
|
@ -12,7 +12,6 @@ import { IOperation } from './oss';
|
|||
*/
|
||||
export enum DependencyMode {
|
||||
ALL = 0,
|
||||
EXPRESSION,
|
||||
OUTPUTS,
|
||||
INPUTS,
|
||||
EXPAND_OUTPUTS,
|
||||
|
|
|
@ -6,15 +6,7 @@ import { TextMatcher } from '@/utils/utils';
|
|||
|
||||
import { BASIC_SCHEMAS, ILibraryItem } from './library';
|
||||
import { CstMatchMode } from './miscellaneous';
|
||||
import {
|
||||
CATEGORY_CST_TYPE,
|
||||
ConstituentaID,
|
||||
CstClass,
|
||||
CstType,
|
||||
ExpressionStatus,
|
||||
IConstituenta,
|
||||
IRSForm
|
||||
} from './rsform';
|
||||
import { CATEGORY_CST_TYPE, CstClass, CstType, ExpressionStatus, IConstituenta, IRSForm } from './rsform';
|
||||
import { ParsingStatus, ValueClass } from './rslang';
|
||||
|
||||
/**
|
||||
|
@ -111,49 +103,6 @@ export function inferClass(type: CstType, isTemplate: boolean = false): CstClass
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a mock {@link IConstituenta} object with the provided parameters and default values for other properties.
|
||||
*/
|
||||
export function createMockConstituenta(id: ConstituentaID, alias: string, comment: string): IConstituenta {
|
||||
return {
|
||||
id: id,
|
||||
spawner: id,
|
||||
spawn: [],
|
||||
spawn_alias: [],
|
||||
is_simple_expression: false,
|
||||
schema: -1,
|
||||
alias: alias,
|
||||
convention: comment,
|
||||
cst_type: CstType.BASE,
|
||||
term_raw: '',
|
||||
term_resolved: '',
|
||||
term_forms: [],
|
||||
definition_formal: '',
|
||||
definition_raw: '',
|
||||
definition_resolved: '',
|
||||
status: ExpressionStatus.INCORRECT,
|
||||
parent_schema_index: 0,
|
||||
is_template: false,
|
||||
is_inherited: false,
|
||||
has_inherited_children: false,
|
||||
cst_class: CstClass.DERIVED,
|
||||
parse: {
|
||||
status: ParsingStatus.INCORRECT,
|
||||
valueClass: ValueClass.INVALID,
|
||||
typification: 'N/A',
|
||||
syntaxTree: '',
|
||||
args: []
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if given {@link IConstituenta} is mock.
|
||||
*/
|
||||
export function isMockCst(cst: IConstituenta) {
|
||||
return cst.id <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply filter based on start {@link IConstituenta} type.
|
||||
*/
|
||||
|
|
|
@ -11,8 +11,7 @@ import useLocalStorage from '@/hooks/useLocalStorage';
|
|||
import { CstMatchMode, DependencyMode } from '@/models/miscellaneous';
|
||||
import { applyGraphFilter } from '@/models/miscellaneousAPI';
|
||||
import { ConstituentaID, IConstituenta, IRSForm } from '@/models/rsform';
|
||||
import { createMockConstituenta, matchConstituenta } from '@/models/rsformAPI';
|
||||
import { extractGlobals } from '@/models/rslangAPI';
|
||||
import { matchConstituenta } from '@/models/rsformAPI';
|
||||
import { storage } from '@/utils/constants';
|
||||
|
||||
interface ConstituentsSearchProps {
|
||||
|
@ -35,15 +34,7 @@ function ConstituentsSearch({ schema, activeID, activeExpression, dense, setFilt
|
|||
return;
|
||||
}
|
||||
let result: IConstituenta[] = [];
|
||||
if (filterSource === DependencyMode.EXPRESSION) {
|
||||
const aliases = extractGlobals(activeExpression);
|
||||
result = schema.items.filter(cst => aliases.has(cst.alias));
|
||||
const names = result.map(cst => cst.alias);
|
||||
const diff = Array.from(aliases).filter(name => !names.includes(name));
|
||||
if (diff.length > 0) {
|
||||
diff.forEach((alias, index) => result.push(createMockConstituenta(-index, alias, 'Конституента отсутствует')));
|
||||
}
|
||||
} else if (!activeID) {
|
||||
if (!activeID) {
|
||||
result = schema.items;
|
||||
} else {
|
||||
result = applyGraphFilter(schema, activeID, filterSource);
|
||||
|
|
|
@ -8,7 +8,6 @@ import NoData from '@/components/ui/NoData';
|
|||
import TextContent from '@/components/ui/TextContent';
|
||||
import { useConceptOptions } from '@/context/ConceptOptionsContext';
|
||||
import { ConstituentaID, IConstituenta } from '@/models/rsform';
|
||||
import { isMockCst } from '@/models/rsformAPI';
|
||||
import { PARAMETER, prefixes } from '@/utils/constants';
|
||||
import { describeConstituenta } from '@/utils/labels';
|
||||
|
||||
|
@ -53,9 +52,7 @@ function TableSideConstituents({
|
|||
|
||||
const handleRowClicked = useCallback(
|
||||
(cst: IConstituenta) => {
|
||||
if (!isMockCst(cst)) {
|
||||
onOpenEdit(cst.id);
|
||||
}
|
||||
},
|
||||
[onOpenEdit]
|
||||
);
|
||||
|
@ -90,8 +87,7 @@ function TableSideConstituents({
|
|||
maxLength={DESCRIPTION_MAX_SYMBOLS}
|
||||
style={{
|
||||
textWrap: 'pretty',
|
||||
fontSize: 12,
|
||||
color: isMockCst(props.row.original) ? colors.fgWarning : undefined
|
||||
fontSize: 12
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
|
|
@ -244,7 +244,6 @@ export function labelCstSource(mode: DependencyMode): string {
|
|||
// prettier-ignore
|
||||
switch (mode) {
|
||||
case DependencyMode.ALL: return 'не ограничен';
|
||||
case DependencyMode.EXPRESSION: return 'выражение';
|
||||
case DependencyMode.OUTPUTS: return 'потребители';
|
||||
case DependencyMode.INPUTS: return 'поставщики';
|
||||
case DependencyMode.EXPAND_OUTPUTS: return 'зависимые';
|
||||
|
@ -259,7 +258,6 @@ export function describeCstSource(mode: DependencyMode): string {
|
|||
// prettier-ignore
|
||||
switch (mode) {
|
||||
case DependencyMode.ALL: return 'все конституенты';
|
||||
case DependencyMode.EXPRESSION: return 'имена из выражения';
|
||||
case DependencyMode.OUTPUTS: return 'прямые исходящие';
|
||||
case DependencyMode.INPUTS: return 'прямые входящие';
|
||||
case DependencyMode.EXPAND_OUTPUTS: return 'цепочка исходящих';
|
||||
|
|
Loading…
Reference in New Issue
Block a user