+
-
-
-
-
-
partialUpdate({ filterText: event.target.value} )}
- />
-
-
-
+
partialUpdate({ filterText: newValue} )}
+ dense
+ />
+
@@ -204,7 +193,7 @@ function TemplateTab({ state, partialUpdate }: TemplateTabProps) {
);
diff --git a/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/index.tsx b/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/index.tsx
new file mode 100644
index 00000000..6c83c066
--- /dev/null
+++ b/rsconcept/frontend/src/dialogs/DlgConstituentaTemplate/index.tsx
@@ -0,0 +1,156 @@
+import { useEffect, useLayoutEffect, useState } from 'react';
+import { TabList, TabPanel, Tabs } from 'react-tabs';
+
+import ConceptTab from '../../components/Common/ConceptTab';
+import ConceptTooltip from '../../components/Common/ConceptTooltip';
+import Modal, { ModalProps } from '../../components/Common/Modal';
+import HelpRSTemplates from '../../components/Help/HelpRSTemplates';
+import { HelpIcon } from '../../components/Icons';
+import usePartialUpdate from '../../hooks/usePartialUpdate';
+import { CstType, ICstCreateData, IRSForm } from '../../models/rsform';
+import { createAliasFor, validateCstAlias } from '../../utils/misc';
+import ArgumentsTab, { IArgumentsState } from './ArgumentsTab';
+import ConstituentaTab from './ConstituentaTab';
+import TemplateTab, { ITemplateState } from './TemplateTab';
+
+interface DlgConstituentaTemplateProps
+extends Pick
{
+ schema: IRSForm
+ onCreate: (data: ICstCreateData) => void
+}
+
+export enum TabID {
+ TEMPLATE = 0,
+ ARGUMENTS = 1,
+ CONSTITUENTA = 2
+}
+
+function DlgConstituentaTemplate({ hideWindow, schema, onCreate }: DlgConstituentaTemplateProps) {
+ const [validated, setValidated] = useState(false);
+ const [ templateData, updateTemplateData ] = usePartialUpdate({
+ filterText: ''
+ });
+ const [ argumentsData, updateArgumentsData ] = usePartialUpdate({
+ filterText: '',
+ definition: ''
+ });
+ const [cstData, updateCstData] = usePartialUpdate({
+ cst_type: CstType.TERM,
+ insert_after: null,
+ alias: '',
+ convention: '',
+ definition_formal: '',
+ definition_raw: '',
+ term_raw: '',
+ term_forms: []
+ });
+
+ const [ activeTab, setActiveTab ] = useState(TabID.TEMPLATE);
+
+ const handleSubmit = () => onCreate(cstData);
+
+ useLayoutEffect(
+ () => {
+ updateCstData({ alias: createAliasFor(cstData.cst_type, schema) });
+ }, [cstData.cst_type, updateCstData, schema]);
+
+ useEffect(
+ () => {
+ setValidated(validateCstAlias(cstData.alias, cstData.cst_type, schema));
+ }, [cstData.alias, cstData.cst_type, schema]);
+
+ useLayoutEffect(
+ () => {
+ if (!templateData.prototype) {
+ updateCstData({
+ definition_raw: '',
+ definition_formal: '',
+ term_raw: ''
+ });
+ updateArgumentsData({
+ definition: '',
+ arguments: []
+ });
+ } else {
+ updateCstData({
+ cst_type: templateData.prototype.cst_type,
+ definition_raw: templateData.prototype.definition_raw,
+ definition_formal: templateData.prototype.definition_formal,
+ term_raw: templateData.prototype.term_raw
+ });
+ updateArgumentsData({
+ definition: templateData.prototype.definition_formal,
+ arguments: []
+ });
+ }
+ }, [templateData.prototype, updateCstData, updateArgumentsData]);
+
+ return (
+
+
+
+
+
+
+ Шаблон
+
+
+ Аргументы
+
+
+ Конституента
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default DlgConstituentaTemplate;
diff --git a/rsconcept/frontend/src/dialogs/DlgCreateCst.tsx b/rsconcept/frontend/src/dialogs/DlgCreateCst.tsx
index 9a80fc14..181a71b3 100644
--- a/rsconcept/frontend/src/dialogs/DlgCreateCst.tsx
+++ b/rsconcept/frontend/src/dialogs/DlgCreateCst.tsx
@@ -79,7 +79,6 @@ function DlgCreateCst({ hideWindow, initial, schema, onCreate }: DlgCreateCstPro
/>
updateCstData({definition_formal: value})}
diff --git a/rsconcept/frontend/src/dialogs/DlgEditReference/index.tsx b/rsconcept/frontend/src/dialogs/DlgEditReference/index.tsx
index 05c2cf20..df66d1d1 100644
--- a/rsconcept/frontend/src/dialogs/DlgEditReference/index.tsx
+++ b/rsconcept/frontend/src/dialogs/DlgEditReference/index.tsx
@@ -1,6 +1,7 @@
import { createColumnHelper } from '@tanstack/react-table';
import { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react';
+import ConceptSearch from '../../components/Common/ConceptSearch';
import ConceptTooltip from '../../components/Common/ConceptTooltip';
import Label from '../../components/Common/Label';
import Modal from '../../components/Common/Modal';
@@ -9,7 +10,7 @@ import TextInput from '../../components/Common/TextInput';
import DataTable, { IConditionalStyle } from '../../components/DataTable';
import ConstituentaTooltip from '../../components/Help/ConstituentaTooltip';
import HelpTerminologyControl from '../../components/Help/HelpTerminologyControl';
-import { HelpIcon, MagnifyingGlassIcon } from '../../components/Icons';
+import { HelpIcon } from '../../components/Icons';
import { useConceptTheme } from '../../context/ThemeContext';
import {
getCompatibleGrams, Grammeme,
@@ -183,7 +184,6 @@ function DlgEditReference({ hideWindow, items, initial, onSave }: DlgEditReferen
() => [
constituentaHelper.accessor('alias', {
id: 'alias',
- header: 'Имя',
size: 65,
minSize: 65,
cell: props => {
@@ -207,7 +207,6 @@ function DlgEditReference({ hideWindow, items, initial, onSave }: DlgEditReferen
}),
constituentaHelper.accessor('term_resolved', {
id: 'term',
- header: 'Термин',
size: 600,
minSize: 350,
maxSize: 600
@@ -287,35 +286,31 @@ function DlgEditReference({ hideWindow, items, initial, onSave }: DlgEditReferen