diff --git a/rsconcept/frontend/src/components/Common/SwitchButton.tsx b/rsconcept/frontend/src/components/Common/SwitchButton.tsx new file mode 100644 index 00000000..801d3d07 --- /dev/null +++ b/rsconcept/frontend/src/components/Common/SwitchButton.tsx @@ -0,0 +1,31 @@ +interface SwitchButtonProps { + id?: string + value: ValueType + label?: string + icon?: React.ReactNode + tooltip?: string + dimensions?: string + + isSelected?: boolean + onSelect: (value: ValueType) => void +} + +function SwitchButton({ + value, icon, label, tooltip, + dimensions='w-fit h-fit', + isSelected, onSelect, ...props +}: SwitchButtonProps) { + return ( + + ); +} + +export default SwitchButton; diff --git a/rsconcept/frontend/src/components/Help/HelpRSTemplates.tsx b/rsconcept/frontend/src/components/Help/HelpRSTemplates.tsx new file mode 100644 index 00000000..3d6ba5b5 --- /dev/null +++ b/rsconcept/frontend/src/components/Help/HelpRSTemplates.tsx @@ -0,0 +1,10 @@ +function HelpRSTemplates() { + return ( +
+

Банк выражений

+

Реализовано создание конституент из параметризованных выражений.

+

Функционал фильтрации и выбор шаблонов выражений находится в активной разработке.

+
); +} + +export default HelpRSTemplates; diff --git a/rsconcept/frontend/src/components/Icons.tsx b/rsconcept/frontend/src/components/Icons.tsx index 8331f5e3..7b765df4 100644 --- a/rsconcept/frontend/src/components/Icons.tsx +++ b/rsconcept/frontend/src/components/Icons.tsx @@ -81,7 +81,7 @@ export function NotSubscribedIcon(props: IconProps) { export function ASTNetworkIcon(props: IconProps) { return ( - + ); } @@ -225,6 +225,15 @@ export function SmallPlusIcon(props: IconProps) { ); } +export function ArrowDropdownIcon(props: IconProps) { + return ( + + + + + ); +} + export function UploadIcon(props: IconProps) { return ( @@ -253,16 +262,16 @@ export function OwnerIcon(props: IconProps) { export function ArrowUpIcon(props: IconProps) { return ( - - + + ); } export function ArrowDownIcon(props: IconProps) { return ( - - + + ); } @@ -293,6 +302,14 @@ export function CloneIcon(props: IconProps) { ); } +export function DiamondIcon(props: IconProps) { + return ( + + + + ); +} + export function DumpBinIcon(props: IconProps) { return ( @@ -335,10 +352,11 @@ export function GithubIcon(props: IconProps) { ); } -export function MeshIcon(props: IconProps) { +export function UpdateIcon(props: IconProps) { return ( - - + + + ); } diff --git a/rsconcept/frontend/src/components/RefsInput/DlgEditReference.tsx b/rsconcept/frontend/src/components/RefsInput/DlgEditReference.tsx index 12cab5dc..f3b05bc9 100644 --- a/rsconcept/frontend/src/components/RefsInput/DlgEditReference.tsx +++ b/rsconcept/frontend/src/components/RefsInput/DlgEditReference.tsx @@ -2,7 +2,11 @@ import { createColumnHelper } from '@tanstack/react-table'; import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react'; import { useConceptTheme } from '../../context/ThemeContext'; -import { getCompatibleGrams, Grammeme, parseEntityReference,parseGrammemes,parseSyntacticReference,ReferenceType } from '../../models/language'; +import { + getCompatibleGrams, Grammeme, + parseEntityReference, parseGrammemes, + parseSyntacticReference, ReferenceType +} from '../../models/language'; import { CstMatchMode } from '../../models/miscelanious'; import { IConstituenta, matchConstituenta } from '../../models/rsform'; import ConstituentaTooltip from '../../pages/RSFormPage/elements/ConstituentaTooltip'; diff --git a/rsconcept/frontend/src/components/RefsInput/ReferenceTypeButton.tsx b/rsconcept/frontend/src/components/RefsInput/ReferenceTypeButton.tsx index 886459b6..3a1e9b73 100644 --- a/rsconcept/frontend/src/components/RefsInput/ReferenceTypeButton.tsx +++ b/rsconcept/frontend/src/components/RefsInput/ReferenceTypeButton.tsx @@ -1,22 +1,22 @@ import { ReferenceType } from '../../models/language'; import { labelReferenceType } from '../../utils/labels'; +import SwitchButton from '../Common/SwitchButton'; interface ReferenceTypeButtonProps { - id?: string type: ReferenceType isSelected?: boolean onSelect: (type: ReferenceType) => void } -function ReferenceTypeButton({ type, isSelected, onSelect, ...props }: ReferenceTypeButtonProps) { +function ReferenceTypeButton({ type, isSelected, onSelect }: ReferenceTypeButtonProps) { return ( - + ); } diff --git a/rsconcept/frontend/src/index.css b/rsconcept/frontend/src/index.css index e28d570b..79e828a0 100644 --- a/rsconcept/frontend/src/index.css +++ b/rsconcept/frontend/src/index.css @@ -25,7 +25,7 @@ --cl-red-bg-100: hsl(000, 100%, 095%); --cl-red-fg-100: hsl(000, 072%, 051%); - --cl-green-fg-100: hsl(120, 080%, 058%); + --cl-green-fg-100: hsl(120, 080%, 37%); /* Dark Theme */ --cd-bg-120: hsl(000, 000%, 005%); @@ -47,7 +47,7 @@ --cd-red-bg-100: hsl(000, 100%, 015%); --cd-red-fg-100: hsl(000, 080%, 055%); - --cd-green-fg-100: hsl(120, 080%, 040%); + --cd-green-fg-100: hsl(120, 080%, 042%); /* Import overrides */ --toastify-color-dark: var(--cd-bg-60); diff --git a/rsconcept/frontend/src/models/miscelanious.ts b/rsconcept/frontend/src/models/miscelanious.ts index c568e8b9..f2b3b769 100644 --- a/rsconcept/frontend/src/models/miscelanious.ts +++ b/rsconcept/frontend/src/models/miscelanious.ts @@ -20,6 +20,7 @@ export enum HelpTopic { CSTLIST = 'cstlist', CONSTITUENTA = 'constituenta', GRAPH_TERM = 'graph-term', + RSTEMPLATES = 'rstemplates', RSLANG = 'rslang', TERM_CONTROL = 'terminology-control', EXTEOR = 'exteor', diff --git a/rsconcept/frontend/src/models/rsform.ts b/rsconcept/frontend/src/models/rsform.ts index df27fd61..d0b62f16 100644 --- a/rsconcept/frontend/src/models/rsform.ts +++ b/rsconcept/frontend/src/models/rsform.ts @@ -73,7 +73,11 @@ export interface IConstituentaList { } export interface ICstCreateData -extends Pick { +extends Pick< + IConstituentaMeta, + 'alias' | 'cst_type' | 'definition_raw' | 'term_raw' | + 'convention' | 'definition_formal' | 'term_forms' +> { insert_after: number | null } diff --git a/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx b/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx index ae037969..74b3c642 100644 --- a/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx +++ b/rsconcept/frontend/src/pages/ManualsPage/ViewTopic.tsx @@ -6,6 +6,7 @@ import HelpMain from '../../components/Help/HelpMain'; import HelpRSFormItems from '../../components/Help/HelpRSFormItems'; import HelpRSFormMeta from '../../components/Help/HelpRSFormMeta'; import HelpRSLang from '../../components/Help/HelpRSLang'; +import HelpRSTemplates from '../../components/Help/HelpRSTemplates'; import HelpTermGraph from '../../components/Help/HelpTermGraph'; import HelpTerminologyControl from '../../components/Help/HelpTerminologyControl'; import { HelpTopic } from '../../models/miscelanious'; @@ -23,6 +24,7 @@ function ViewTopic({ topic }: ViewTopicProps) { {topic === HelpTopic.CSTLIST && } {topic === HelpTopic.CONSTITUENTA && } {topic === HelpTopic.GRAPH_TERM && } + {topic === HelpTopic.RSTEMPLATES && } {topic === HelpTopic.RSLANG && } {topic === HelpTopic.TERM_CONTROL && } {topic === HelpTopic.EXTEOR && } diff --git a/rsconcept/frontend/src/pages/RSFormPage/DlgCreateCst.tsx b/rsconcept/frontend/src/pages/RSFormPage/DlgCreateCst.tsx index 31dd7c8e..4a54032d 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/DlgCreateCst.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/DlgCreateCst.tsx @@ -35,7 +35,8 @@ function DlgCreateCst({ hideWindow, initial, schema, onCreate }: DlgCreateCstPro convention: convention, definition_formal: expression, definition_raw: textDefinition, - term_raw: term + term_raw: term, + term_forms: [] }; } diff --git a/rsconcept/frontend/src/pages/RSFormPage/DlgTemplates.tsx b/rsconcept/frontend/src/pages/RSFormPage/DlgTemplates.tsx new file mode 100644 index 00000000..7a06a543 --- /dev/null +++ b/rsconcept/frontend/src/pages/RSFormPage/DlgTemplates.tsx @@ -0,0 +1,178 @@ +import { useEffect, useLayoutEffect, useState } from 'react'; + +import ConceptTooltip from '../../components/Common/ConceptTooltip'; +import Modal, { ModalProps } from '../../components/Common/Modal'; +import SelectSingle from '../../components/Common/SelectSingle'; +import SwitchButton from '../../components/Common/SwitchButton'; +import TextArea from '../../components/Common/TextArea'; +import TextInput from '../../components/Common/TextInput'; +import HelpRSTemplates from '../../components/Help/HelpRSTemplates'; +import { HelpIcon } from '../../components/Icons'; +import RSInput from '../../components/RSInput'; +import { CstType,ICstCreateData, IRSForm } from '../../models/rsform'; +import { labelCstType } from '../../utils/labels'; +import { createAliasFor, getCstTypePrefix } from '../../utils/misc'; +import { SelectorCstType } from '../../utils/selectors'; + +interface DlgTemplatesProps +extends Pick { + schema: IRSForm + onCreate: (data: ICstCreateData) => void +} + +function DlgTemplates({ hideWindow, schema, onCreate }: DlgTemplatesProps) { + const [validated, setValidated] = useState(false); + const [selectedType, setSelectedType] = useState(CstType.TERM); + const [alias, setAlias] = useState(''); + + const [term, setTerm] = useState(''); + const [textDefinition, setTextDefinition] = useState(''); + const [expression, setExpression] = useState(''); + const [convention, setConvention] = useState(''); + + const [ showAttributes, setShowAttributes ] = useState(false); + + function getData(): ICstCreateData { + return { + cst_type: selectedType, + insert_after: null, + alias: alias, + convention: convention, + definition_formal: expression, + definition_raw: textDefinition, + term_raw: term, + term_forms: [] + }; + } + + const handleSubmit = () => onCreate(getData()); + + useLayoutEffect( + () => { + setAlias(createAliasFor(selectedType, schema)); + }, [selectedType, schema]); + + useEffect( + () => { + if(alias.length < 2 || alias[0] !== getCstTypePrefix(selectedType)) { + setValidated(false); + } else { + setValidated(!schema.items.find(cst => cst.alias === alias)) + } + }, [alias, selectedType, schema]); + +{/* */} + //
+ // + // + + //
+ + return ( + +
+
+ setShowAttributes(value)} + /> + setShowAttributes(value)} + /> +
+ +
+ + + +
+ + { !showAttributes && +
+ Выбор шаблона и параметров +
} + + { showAttributes && +
+
+ setSelectedType(data?.value ?? CstType.BASE)} + /> + setAlias(event.target.value)} + /> +
+