tycho-components 0.28.7 → 0.28.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ export declare const TreeTexts: {
10
10
  'button.search': string;
11
11
  'label.syntactic.category': string;
12
12
  'label.pos.tag': string;
13
+ 'label.token.addTag': string;
13
14
  'label.empty.category': string;
14
15
  'label.word.value': string;
15
16
  };
@@ -24,6 +25,7 @@ export declare const TreeTexts: {
24
25
  'button.search': string;
25
26
  'label.syntactic.category': string;
26
27
  'label.pos.tag': string;
28
+ 'label.token.addTag': string;
27
29
  'label.empty.category': string;
28
30
  'label.word.value': string;
29
31
  };
@@ -37,6 +39,7 @@ export declare const TreeTexts: {
37
39
  'button.search': string;
38
40
  'label.syntactic.category': string;
39
41
  'label.pos.tag': string;
42
+ 'label.token.addTag': string;
40
43
  'label.empty.category': string;
41
44
  'label.word.value': string;
42
45
  };
@@ -10,6 +10,7 @@ export const TreeTexts = {
10
10
  'button.search': 'Search',
11
11
  'label.syntactic.category': 'Syntactic Category',
12
12
  'label.pos.tag': 'POS Tag',
13
+ 'label.token.addTag': 'add tag',
13
14
  'label.empty.category': 'Empty Category',
14
15
  'label.word.value': 'Word',
15
16
  },
@@ -24,6 +25,7 @@ export const TreeTexts = {
24
25
  'button.search': 'Buscar',
25
26
  'label.syntactic.category': 'Categoria Sintática',
26
27
  'label.pos.tag': 'Etiqueta POS',
28
+ 'label.token.addTag': 'adicionar etiqueta',
27
29
  'label.empty.category': 'Categoria Vazia',
28
30
  'label.word.value': 'Palavra',
29
31
  },
@@ -37,6 +39,7 @@ export const TreeTexts = {
37
39
  'button.search': 'Cerca',
38
40
  'label.syntactic.category': 'Categoria Sintattica',
39
41
  'label.pos.tag': 'Etichetta POS',
42
+ 'label.token.addTag': 'aggiungi etichetta',
40
43
  'label.empty.category': 'Categoria Vuota',
41
44
  'label.word.value': 'Parola',
42
45
  },
@@ -1,7 +1,7 @@
1
- import CatalogSearchFilter from "../types/CatalogSearchFilter";
2
- import type { DocumentDrawerActionId } from "../types/DocumentDrawerActionId";
3
- import { Document } from "../deps";
4
- import "./style.scss";
1
+ import CatalogSearchFilter from '../types/CatalogSearchFilter';
2
+ import type { DocumentDrawerActionId } from '../types/DocumentDrawerActionId';
3
+ import { Document } from '../deps';
4
+ import './style.scss';
5
5
  type Props = {
6
6
  document: Document;
7
7
  setOpenFile: (b: boolean) => void;
@@ -1,17 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import AutomaticParser from "../AutomaticParser";
3
- import DocumentRemove from "../DocumentRemove";
4
- import InconsistencyActions from "../Inconsistency/InconsistencyActions";
5
- import DocumentService from "../services/DocumentService";
6
- import SentenceService from "../services/SentenceService";
7
- import PageRemoveSentences from "./PageRemoveSentences";
8
- import { useMemo, useState } from "react";
9
- import { useTranslation } from "react-i18next";
10
- import { ToolsUtils, useCorpusUtils, useMessageUtils } from "../deps";
11
- import { Icon } from "tycho-storybook";
12
- import "./style.scss";
2
+ import AutomaticParser from '../AutomaticParser';
3
+ import DocumentRemove from '../DocumentRemove';
4
+ import InconsistencyActions from '../Inconsistency/InconsistencyActions';
5
+ import DocumentService from '../services/DocumentService';
6
+ import SentenceService from '../services/SentenceService';
7
+ import PageRemoveSentences from './PageRemoveSentences';
8
+ import { useMemo, useState } from 'react';
9
+ import { useTranslation } from 'react-i18next';
10
+ import { ToolsUtils, useCorpusUtils, useMessageUtils } from '../deps';
11
+ import { Icon } from 'tycho-storybook';
12
+ import './style.scss';
13
13
  export default function Actions({ document, setOpenFile, setFilter, handleClickDocument, useGrid, pageUid, pageOrder, onPageReload, hiddenActions = [], }) {
14
- const { t } = useTranslation("actions");
14
+ const { t } = useTranslation('actions');
15
15
  const { getCorpus } = useCorpusUtils();
16
16
  const [openRemove, setOpenRemove] = useState(false);
17
17
  const [openRemoveSentences, setOpenRemoveSentences] = useState(false);
@@ -24,7 +24,7 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
24
24
  const handleResume = () => {
25
25
  SentenceService.resume(document.uid).then((r) => {
26
26
  if (!r.data) {
27
- dispatchError({ err: "warning.syntactic.review", t });
27
+ dispatchError({ err: 'warning.syntactic.review', t });
28
28
  return;
29
29
  }
30
30
  navigateSameWindow(`${import.meta.env.VITE_APP_REVISION_URL}/tree/${r.data.uid}`);
@@ -32,7 +32,7 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
32
32
  };
33
33
  const handleReview = () => {
34
34
  const baseUrl = import.meta.env.VITE_APP_REVISION_URL;
35
- const url = document.defaultTool === "DESIGN"
35
+ const url = document.defaultTool === 'DESIGN'
36
36
  ? `${baseUrl}/box/${document.uid}`
37
37
  : `${baseUrl}/${document.uid}`;
38
38
  navigateSameWindow(url);
@@ -42,79 +42,79 @@ export default function Actions({ document, setOpenFile, setFilter, handleClickD
42
42
  };
43
43
  const handleTranscription = () => {
44
44
  if (!pageUid) {
45
- dispatchError({ err: "error.page.required", t });
45
+ dispatchError({ err: 'error.page.required', t });
46
46
  return;
47
47
  }
48
48
  setOpenRemoveSentences(true);
49
49
  };
50
50
  const handleSyncSearch = () => {
51
51
  DocumentService.syncSearch(document.uid)
52
- .then(() => dispatchMessage({ key: "sync.search.success", t }))
53
- .catch(() => dispatchError({ err: "error.unknown", t }));
52
+ .then(() => dispatchMessage({ key: 'sync.search.success', t }))
53
+ .catch(() => dispatchError({ err: 'error.unknown', t }));
54
54
  };
55
55
  const actionOptions = [
56
56
  {
57
- id: "documents",
58
- iconName: "list",
59
- title: t("label.documents.title"),
60
- description: t("label.documents.description"),
57
+ id: 'documents',
58
+ iconName: 'list',
59
+ title: t('label.documents.title'),
60
+ description: t('label.documents.description'),
61
61
  onClick: handleDocuments,
62
62
  },
63
63
  {
64
- id: "edition",
64
+ id: 'edition',
65
65
  iconName: ToolsUtils.getIcon(document.defaultTool),
66
- title: t("label.edition.title"),
67
- description: t("label.edition.description"),
66
+ title: t('label.edition.title'),
67
+ description: t('label.edition.description'),
68
68
  onClick: () => handleClickDocument(document.uid),
69
- buttonClassName: document.defaultTool === "DESIGN" ? "action-design" : undefined,
69
+ buttonClassName: document.defaultTool === 'DESIGN' ? 'action-design' : undefined,
70
70
  },
71
71
  {
72
- id: "syntactic",
73
- iconName: "graph_4",
74
- title: t("label.syntactic.title"),
75
- description: t("label.syntactic.description"),
72
+ id: 'syntactic',
73
+ iconName: 'graph_4',
74
+ title: t('label.syntactic.title'),
75
+ description: t('label.syntactic.description'),
76
76
  onClick: handleReview,
77
77
  },
78
78
  {
79
- id: "resume",
80
- iconName: "play_arrow",
81
- title: t("label.resume.title"),
82
- description: t("label.resume.description"),
79
+ id: 'resume',
80
+ iconName: 'play_arrow',
81
+ title: t('label.resume.title'),
82
+ description: t('label.resume.description'),
83
83
  onClick: handleResume,
84
84
  },
85
85
  {
86
- id: "transcription",
87
- iconName: "checkbook",
88
- title: t("label.transcription.title"),
89
- description: t("label.transcription.description", {
86
+ id: 'transcription',
87
+ iconName: 'checkbook',
88
+ title: t('label.transcription.title'),
89
+ description: t('label.transcription.description', {
90
90
  pageNumber: pageOrder,
91
91
  }),
92
92
  onClick: handleTranscription,
93
93
  },
94
94
  {
95
- id: "automatic",
96
- iconName: "settings_timelapse",
97
- title: t("label.automatic.title"),
98
- description: t("label.automatic.description"),
95
+ id: 'automatic',
96
+ iconName: 'settings_timelapse',
97
+ title: t('label.automatic.title'),
98
+ description: t('label.automatic.description'),
99
99
  onClick: () => setOpenAutomatic(true),
100
100
  },
101
101
  {
102
- id: "sync",
103
- iconName: "sync",
104
- title: t("label.sync.title"),
105
- description: t("label.sync.description"),
102
+ id: 'sync',
103
+ iconName: 'sync',
104
+ title: t('label.sync.title'),
105
+ description: t('label.sync.description'),
106
106
  onClick: handleSyncSearch,
107
107
  },
108
108
  {
109
- id: "remove",
110
- iconName: "delete",
111
- title: t("actions.label.remove"),
112
- description: t("actions.label.remove.description"),
109
+ id: 'remove',
110
+ iconName: 'delete',
111
+ title: t('actions.label.remove'),
112
+ description: t('actions.label.remove.description'),
113
113
  onClick: () => setOpenRemove(true),
114
114
  },
115
115
  ];
116
116
  const visibleActions = actionOptions.filter((action) => !hidden.has(action.id));
117
- return (_jsxs("div", { className: "file-actions-container", children: [_jsx("div", { className: "header", children: _jsx("div", { className: "title", children: t("actions.label.title") }) }), _jsxs("div", { className: "body", children: [visibleActions.map(({ id, iconName, title, description, onClick, buttonClassName }) => (_jsxs("div", { className: "action-line", onClick: onClick, children: [_jsx("div", { className: `action-button${buttonClassName ? ` ${buttonClassName}` : ""}`, children: _jsx(Icon, { name: iconName, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { children: description })] })] }, id))), !hidden.has("inconsistency") && (_jsx(InconsistencyActions, { document: document }))] }), openRemove && (_jsx(DocumentRemove, { document: document, setFilter: setFilter, onClose: () => setOpenRemove(false), useGrid: useGrid, setOpenFile: setOpenFile })), openAutomatic && (_jsx(AutomaticParser, { document: document, onClose: () => setOpenAutomatic(false) })), openRemoveSentences && pageUid && (_jsx(PageRemoveSentences, { pageUid: pageUid, onClose: () => setOpenRemoveSentences(false), onSuccess: () => {
117
+ return (_jsxs("div", { className: "file-actions-container", children: [_jsxs("div", { className: "body", children: [visibleActions.map(({ id, iconName, title, description, onClick, buttonClassName }) => (_jsxs("div", { className: "action-line", onClick: onClick, children: [_jsx("div", { className: `action-button${buttonClassName ? ` ${buttonClassName}` : ''}`, children: _jsx(Icon, { name: iconName, size: "medium" }) }), _jsxs("div", { className: "action-desc", children: [_jsx("span", { className: "title", children: title }), _jsx("span", { children: description })] })] }, id))), !hidden.has('inconsistency') && (_jsx(InconsistencyActions, { document: document }))] }), openRemove && (_jsx(DocumentRemove, { document: document, setFilter: setFilter, onClose: () => setOpenRemove(false), useGrid: useGrid, setOpenFile: setOpenFile })), openAutomatic && (_jsx(AutomaticParser, { document: document, onClose: () => setOpenAutomatic(false) })), openRemoveSentences && pageUid && (_jsx(PageRemoveSentences, { pageUid: pageUid, onClose: () => setOpenRemoveSentences(false), onSuccess: () => {
118
118
  onPageReload?.();
119
119
  setOpenFile(false);
120
120
  } }))] }));
@@ -1,6 +0,0 @@
1
- .file-actions-container {
2
- .body {
3
- height: 94vh;
4
- overflow-y: auto;
5
- }
6
- }
@@ -1,8 +1,8 @@
1
- import CatalogSearchFilter from "./types/CatalogSearchFilter";
2
- import Category from "./types/Category";
3
- import type { DocumentDrawerActionId } from "./types/DocumentDrawerActionId";
4
- import { Document } from "./deps";
5
- import "./style.scss";
1
+ import CatalogSearchFilter from './types/CatalogSearchFilter';
2
+ import Category from './types/Category';
3
+ import type { DocumentDrawerActionId } from './types/DocumentDrawerActionId';
4
+ import { Document } from './deps';
5
+ import './style.scss';
6
6
  export type DocumentDrawerProps = {
7
7
  uid: string;
8
8
  setOpenFile: (b: boolean) => void;
@@ -1,25 +1,25 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import documenService from "./services/DocumentService";
3
- import { Drawer, Tab, Tabs } from "@mui/material";
4
- import { useEffect, useMemo, useState } from "react";
5
- import { useTranslation } from "react-i18next";
6
- import { Participants, useCorpusUtils } from "./deps";
7
- import { Icon } from "tycho-storybook";
8
- import DocumentMetadata from "./Metadata/DocumentMetadata";
9
- import Actions from "./Actions";
10
- import DocumentExport from "./DocumentExport";
11
- import DocumentLexicon from "./DocumentLexicon";
12
- import Github from "./Github";
13
- import ImageGallery from "./ImageGallery";
14
- import Info from "./Info";
15
- import Boxes from "./Pages/Boxes";
16
- import Pages from "./Pages/Pages";
17
- import "./style.scss";
2
+ import documenService from './services/DocumentService';
3
+ import { Drawer, Tab, Tabs } from '@mui/material';
4
+ import { useEffect, useMemo, useState } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Participants, useCorpusUtils } from './deps';
7
+ import { Icon, IconButton } from 'tycho-storybook';
8
+ import DocumentMetadata from './Metadata/DocumentMetadata';
9
+ import Actions from './Actions';
10
+ import DocumentExport from './DocumentExport';
11
+ import DocumentLexicon from './DocumentLexicon';
12
+ import Github from './Github';
13
+ import ImageGallery from './ImageGallery';
14
+ import Info from './Info';
15
+ import Boxes from './Pages/Boxes';
16
+ import Pages from './Pages/Pages';
17
+ import './style.scss';
18
18
  export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChange, handleClickDocument, useGrid, categoriesHierarchy, pageUid, pageOrder, onPageReload, hiddenActions, }) {
19
- const { t } = useTranslation("document");
19
+ const { t } = useTranslation('document');
20
20
  const { getCorpus, hasParameter } = useCorpusUtils();
21
21
  const [document, setDocument] = useState();
22
- const [activeKey, setActiveKey] = useState("actions");
22
+ const [activeKey, setActiveKey] = useState('actions');
23
23
  const fileItems = useMemo(() => {
24
24
  if (!document)
25
25
  return [];
@@ -34,7 +34,7 @@ export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChan
34
34
  const renderPages = () => {
35
35
  if (!document)
36
36
  return null;
37
- if (document.defaultTool && document.defaultTool === "DESIGN")
37
+ if (document.defaultTool && document.defaultTool === 'DESIGN')
38
38
  return (_jsx(Boxes, { document: document, setDocument: setDocument, setOpenFile: setOpenFile, handleChange: handleChange }));
39
39
  return (_jsx(Pages, { document: document, setDocument: setDocument, setOpenFile: setOpenFile, handleChange: handleChange }));
40
40
  };
@@ -45,58 +45,58 @@ export default function DocumentDrawer({ uid, setOpenFile, setFilter, handleChan
45
45
  }, [uid]);
46
46
  if (!document)
47
47
  return null;
48
- return (_jsx(Drawer, { anchor: "left", open: true, onClose: () => setOpenFile(false), className: "offcanvas-file", children: _jsxs("div", { className: "drawer-container", children: [_jsxs("div", { className: "tabs-col", children: [_jsxs("div", { className: "nav-item-close", onClick: () => setOpenFile(false), children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: "arrow_circle_left" }) }), _jsx("span", { className: "title", children: t("menu.label.close") })] }), _jsx(Tabs, { orientation: "vertical", value: activeKey, onChange: handleTabChange, className: "nav", children: fileItems.map((item, idx) => (_jsx(Tab, { value: item.eventKey, label: _jsxs(_Fragment, { children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: item.icon }) }), _jsx("span", { className: "title", children: t(item.title) })] }) }, idx.valueOf()))) })] }), _jsxs("div", { className: "info-col", children: [activeKey === "home" && (_jsx(Info, { document: document, categoriesHierarchy: categoriesHierarchy, handleChange: (updated) => {
49
- handleChange(updated);
50
- setDocument(updated);
51
- } })), activeKey === "metadata" && (_jsx(DocumentMetadata, { document: document, onDocumentChange: (updated) => {
52
- handleChange(updated);
53
- setDocument(updated);
54
- } })), activeKey === "lexicon" && _jsx(DocumentLexicon, { document: document }), activeKey === "export" && _jsx(DocumentExport, { doc: document }), activeKey === "actions" && (_jsx(Actions, { document: document, setOpenFile: setOpenFile, setFilter: setFilter, handleClickDocument: handleClickDocument, useGrid: useGrid, pageUid: pageUid, pageOrder: pageOrder, onPageReload: onPageReload, hiddenActions: hiddenActions })), activeKey === "pages" && renderPages(), activeKey === "gallery" && (_jsx(ImageGallery, { document: document, setDocument: setDocument, handleChange: handleChange })), activeKey === "participants" && (_jsx(Participants, { document: document.uid, participants: document.participants || [], onChange: (r) => setDocument({ ...document, participants: r }), useChat: hasParameter(getCorpus(), "useParticipantChat") })), activeKey === "github" && (_jsx(Github, { document: document, setOpenFile: setOpenFile }))] })] }) }));
48
+ return (_jsx(Drawer, { anchor: "left", open: true, onClose: () => setOpenFile(false), className: "offcanvas-file", children: _jsxs("div", { className: "drawer-container", children: [_jsxs("div", { className: "drawer-header", children: [_jsxs("div", { className: "header-content", children: [_jsx("div", { className: "corpus", children: getCorpus().name }), _jsx("div", { className: "document", children: document.name })] }), _jsx(IconButton, { name: "close", size: "medium", mode: "ghost", iconSize: "medium", onClick: () => setOpenFile(false) })] }), _jsxs("div", { className: "drawer-body", children: [_jsx("div", { className: "tabs-col", children: _jsx(Tabs, { orientation: "vertical", value: activeKey, onChange: handleTabChange, className: "nav", children: fileItems.map((item, idx) => (_jsx(Tab, { value: item.eventKey, label: _jsxs(_Fragment, { children: [_jsx("span", { className: "nav-link-icon", children: _jsx(Icon, { name: item.icon }) }), _jsx("span", { className: "title", children: t(item.title) })] }) }, idx.valueOf()))) }) }), _jsxs("div", { className: "info-col", children: [activeKey === 'home' && (_jsx(Info, { document: document, categoriesHierarchy: categoriesHierarchy, handleChange: (updated) => {
49
+ handleChange(updated);
50
+ setDocument(updated);
51
+ } })), activeKey === 'metadata' && (_jsx(DocumentMetadata, { document: document, onDocumentChange: (updated) => {
52
+ handleChange(updated);
53
+ setDocument(updated);
54
+ } })), activeKey === 'lexicon' && _jsx(DocumentLexicon, { document: document }), activeKey === 'export' && _jsx(DocumentExport, { doc: document }), activeKey === 'actions' && (_jsx(Actions, { document: document, setOpenFile: setOpenFile, setFilter: setFilter, handleClickDocument: handleClickDocument, useGrid: useGrid, pageUid: pageUid, pageOrder: pageOrder, onPageReload: onPageReload, hiddenActions: hiddenActions })), activeKey === 'pages' && renderPages(), activeKey === 'gallery' && (_jsx(ImageGallery, { document: document, setDocument: setDocument, handleChange: handleChange })), activeKey === 'participants' && (_jsx(Participants, { document: document.uid, participants: document.participants || [], onChange: (r) => setDocument({ ...document, participants: r }), useChat: hasParameter(getCorpus(), 'useParticipantChat') })), activeKey === 'github' && (_jsx(Github, { document: document, setOpenFile: setOpenFile }))] })] })] }) }));
55
55
  }
56
56
  const baseFileItems = [
57
57
  {
58
- eventKey: "actions",
59
- icon: "manufacturing",
60
- title: "menu.label.actions",
58
+ eventKey: 'actions',
59
+ icon: 'manufacturing',
60
+ title: 'menu.label.actions',
61
61
  },
62
62
  {
63
- eventKey: "home",
64
- icon: "info",
65
- title: "menu.label.home",
63
+ eventKey: 'home',
64
+ icon: 'info',
65
+ title: 'menu.label.home',
66
66
  },
67
67
  {
68
- eventKey: "pages",
69
- icon: "article",
70
- title: "menu.label.pages",
68
+ eventKey: 'pages',
69
+ icon: 'article',
70
+ title: 'menu.label.pages',
71
71
  },
72
72
  {
73
- eventKey: "gallery",
74
- icon: "photo_library",
75
- title: "menu.label.images",
73
+ eventKey: 'gallery',
74
+ icon: 'photo_library',
75
+ title: 'menu.label.images',
76
76
  },
77
77
  {
78
- eventKey: "metadata",
79
- icon: "bookmark",
80
- title: "menu.label.metadata",
78
+ eventKey: 'metadata',
79
+ icon: 'bookmark',
80
+ title: 'menu.label.metadata',
81
81
  },
82
82
  {
83
- eventKey: "lexicon",
84
- icon: "sort_by_alpha",
85
- title: "menu.label.lexicon",
83
+ eventKey: 'lexicon',
84
+ icon: 'sort_by_alpha',
85
+ title: 'menu.label.lexicon',
86
86
  },
87
87
  {
88
- eventKey: "export",
89
- icon: "file_export",
90
- title: "menu.label.export",
88
+ eventKey: 'export',
89
+ icon: 'file_export',
90
+ title: 'menu.label.export',
91
91
  },
92
92
  {
93
- eventKey: "participants",
94
- icon: "group",
95
- title: "menu.label.participants",
93
+ eventKey: 'participants',
94
+ icon: 'group',
95
+ title: 'menu.label.participants',
96
96
  },
97
97
  ];
98
98
  const githubFileItem = {
99
- eventKey: "github",
100
- icon: "code",
101
- title: "menu.label.github",
99
+ eventKey: 'github',
100
+ icon: 'code',
101
+ title: 'menu.label.github',
102
102
  };
@@ -1,6 +1,5 @@
1
1
  export declare const DocumentTexts: {
2
2
  en: {
3
- 'menu.label.close': string;
4
3
  'menu.label.home': string;
5
4
  'menu.label.pages': string;
6
5
  'menu.label.images': string;
@@ -46,7 +45,6 @@ export declare const DocumentTexts: {
46
45
  'placeholder.empty.images': string;
47
46
  };
48
47
  'pt-BR': {
49
- 'menu.label.close': string;
50
48
  'menu.label.home': string;
51
49
  'menu.label.pages': string;
52
50
  'menu.label.images': string;
@@ -92,7 +90,6 @@ export declare const DocumentTexts: {
92
90
  'placeholder.empty.images': string;
93
91
  };
94
92
  it: {
95
- 'menu.label.close': string;
96
93
  'menu.label.home': string;
97
94
  'menu.label.pages': string;
98
95
  'menu.label.images': string;
@@ -1,6 +1,5 @@
1
1
  export const DocumentTexts = {
2
2
  en: {
3
- 'menu.label.close': 'Close',
4
3
  'menu.label.home': 'Details',
5
4
  'menu.label.pages': 'Pages',
6
5
  'menu.label.images': 'Images',
@@ -46,7 +45,6 @@ export const DocumentTexts = {
46
45
  'placeholder.empty.images': 'There are no images for this document.',
47
46
  },
48
47
  'pt-BR': {
49
- 'menu.label.close': 'Fechar',
50
48
  'menu.label.home': 'Detalhes',
51
49
  'menu.label.pages': 'Páginas',
52
50
  'menu.label.images': 'Imagens',
@@ -92,7 +90,6 @@ export const DocumentTexts = {
92
90
  'placeholder.empty.images': 'Não existem imagens para este documento.',
93
91
  },
94
92
  it: {
95
- 'menu.label.close': 'Chiudi',
96
93
  'menu.label.home': 'Dettagli',
97
94
  'menu.label.pages': 'Pagine',
98
95
  'menu.label.images': 'Immagini',
@@ -1,9 +1,46 @@
1
1
  .drawer-container {
2
2
  display: flex;
3
+ flex-direction: column;
3
4
  height: 100%;
5
+ overflow: hidden;
6
+
7
+ > .drawer-header {
8
+ display: flex;
9
+ background-color: #1651aa;
10
+ color: var(--text-on-color-light);
11
+ border-bottom: 1px solid var(--border-subtle-2);
12
+ padding: 8px 24px;
13
+ gap: 4px;
14
+
15
+ .corpus {
16
+ @include subtitle-small-2;
17
+ }
18
+
19
+ .document {
20
+ @include body-medium-2;
21
+ }
22
+
23
+ .ds-icon-button {
24
+ margin-left: auto;
25
+
26
+ &:hover {
27
+ background-color: #13458f;
28
+ }
29
+
30
+ .ds-icon {
31
+ color: var(--text-on-color-light) !important;
32
+ }
33
+ }
34
+ }
35
+
36
+ > .drawer-body {
37
+ display: flex;
38
+ }
4
39
 
5
40
  .info-col {
6
41
  width: 75%;
42
+ overflow-y: auto;
43
+ height: 94vh;
7
44
 
8
45
  .header {
9
46
  @include subtitle-medium-2;
@@ -98,22 +135,6 @@
98
135
  color: var(--text-on-color-light);
99
136
  }
100
137
  }
101
-
102
- .nav-item-close {
103
- display: flex;
104
- cursor: pointer;
105
- padding: 12px 0 12px 24px;
106
- color: var(--text-on-color-light);
107
- margin: 24px 0px;
108
-
109
- .title {
110
- @include label-medium-1;
111
- }
112
-
113
- &:hover {
114
- background-color: #1651aa;
115
- }
116
- }
117
138
  }
118
139
  }
119
140
 
@@ -32,7 +32,9 @@ export default function TreeView({ struct, expression, selector = "canvas-tree",
32
32
  return;
33
33
  let tree;
34
34
  try {
35
- tree = new CytoscapeTreeConverter().execute(struct, showInfo);
35
+ tree = new CytoscapeTreeConverter().execute(struct, showInfo, {
36
+ missingPosTagLabel: t('label.token.addTag'),
37
+ });
36
38
  }
37
39
  catch (e) {
38
40
  setInvalid(true);
@@ -1,9 +1,14 @@
1
1
  import { Struct, Token } from '../../../configs/types/Struct';
2
2
  import { CytoscapeTreeCalculation } from './NodeCalculation';
3
+ export type CytoscapeTreeConverterOptions = {
4
+ missingPosTagLabel?: string;
5
+ };
3
6
  export default class CytoscapeTreeConverter {
4
7
  private ID_SPLITTER;
5
8
  private extraInfo;
6
- execute(struct: Struct, extraInfo: boolean): CytoscapeTreeCalculation | undefined;
9
+ private missingPosTagLabel;
10
+ static formatPosTagLabel(token: Pick<Token, 't' | 'coidx'>, missingPosTagLabel?: string): string;
11
+ execute(struct: Struct, extraInfo: boolean, options?: CytoscapeTreeConverterOptions): CytoscapeTreeCalculation | undefined;
7
12
  getLabelLeaf(token: Token): string;
8
13
  private splitAttributeValue;
9
14
  private validate;
@@ -4,10 +4,25 @@ export default class CytoscapeTreeConverter {
4
4
  constructor() {
5
5
  this.ID_SPLITTER = '|';
6
6
  this.extraInfo = false;
7
+ this.missingPosTagLabel = '';
7
8
  }
8
- execute(struct, extraInfo) {
9
+ static formatPosTagLabel(token, missingPosTagLabel = '') {
10
+ const tag = token.t?.trim();
11
+ const base = tag
12
+ ? tag
13
+ : `<span class="token-tag-missing">${missingPosTagLabel}</span>`;
14
+ let idxLabel = '';
15
+ if (token.coidx) {
16
+ for (const idx of token.coidx) {
17
+ idxLabel += `-${idx.toString()}`;
18
+ }
19
+ }
20
+ return base + idxLabel;
21
+ }
22
+ execute(struct, extraInfo, options) {
9
23
  if (!this.validate(struct))
10
24
  return undefined;
25
+ this.missingPosTagLabel = options?.missingPosTagLabel ?? '';
11
26
  const tree = this.initTree(struct);
12
27
  this.extraInfo = extraInfo;
13
28
  this.inflate(tree, struct);
@@ -47,12 +62,7 @@ export default class CytoscapeTreeConverter {
47
62
  if (!struct.tokens || struct.tokens.length === 0) {
48
63
  return false;
49
64
  }
50
- return struct.tokens.every((token) => {
51
- if (token.ec) {
52
- return true;
53
- }
54
- return token.t !== undefined && token.t.trim() !== '';
55
- });
65
+ return true;
56
66
  }
57
67
  calculatePositions(cytoscape) {
58
68
  const converter = new CytoscapePositionCalculator();
@@ -220,8 +230,8 @@ export default class CytoscapeTreeConverter {
220
230
  sb.push('-');
221
231
  sb.push(`${token.idx}`);
222
232
  }
223
- if (token.t) {
224
- sb.push('+');
233
+ sb.push('+');
234
+ if (token.t?.trim()) {
225
235
  sb.push(token.t);
226
236
  }
227
237
  return sb.join('');
@@ -322,7 +332,7 @@ export default class CytoscapeTreeConverter {
322
332
  id,
323
333
  data: {
324
334
  id,
325
- label: this.getLabelValue(token.t, token.coidx),
335
+ label: CytoscapeTreeConverter.formatPosTagLabel(token, this.missingPosTagLabel),
326
336
  token: JSON.parse(JSON.stringify(token)),
327
337
  },
328
338
  };
@@ -55,6 +55,11 @@
55
55
  display: block;
56
56
  color: red;
57
57
  }
58
+
59
+ .token-tag-missing {
60
+ font-style: italic;
61
+ color: var(--text-error);
62
+ }
58
63
  }
59
64
  }
60
65
 
@@ -9,6 +9,7 @@ export { EMPTY_PARTICIPANT, } from './Participants/types/Participant';
9
9
  export { default as SentenceView } from './SentenceView';
10
10
  export { default as TreeView } from './TreeView';
11
11
  export { default as CytoscapeTreeConverter } from './TreeView/cytoscape/CytoscapeTreeConverter';
12
+ export type { CytoscapeTreeConverterOptions } from './TreeView/cytoscape/CytoscapeTreeConverter';
12
13
  export { default as SyntreesCytoscape } from './TreeView/cytoscape/SyntreesCytoscape';
13
14
  export { default as TreeViewSearch } from './TreeView/TreeViewSearch/TreeViewSearch';
14
15
  export type { SearchCriteria } from './TreeView/TreeViewSearch/TreeViewSearch';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.28.7",
4
+ "version": "0.28.10",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -82,7 +82,7 @@
82
82
  "react-i18next": "^13.0.2",
83
83
  "react-router-dom": "^6.14.2",
84
84
  "react-toastify": "^9.1.3",
85
- "tycho-storybook": "0.10.0",
85
+ "tycho-storybook": "0.10.1",
86
86
  "wavesurfer-react": "^2.2.2",
87
87
  "wavesurfer.js": "^6.6.3"
88
88
  },
@@ -111,7 +111,7 @@
111
111
  "react-toastify": "^9.1.3",
112
112
  "sass-embedded": "^1.97.2",
113
113
  "storybook": "^10.1.11",
114
- "tycho-storybook": "^0.10.0",
114
+ "tycho-storybook": "^0.10.1",
115
115
  "typescript": "^5.7.3",
116
116
  "vite": "^7.0.0",
117
117
  "vitest": "^3.2.6",