tycho-components 0.21.19 → 0.22.0

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.
Files changed (153) hide show
  1. package/dist/configs/Localization.js +12 -0
  2. package/dist/features/DocumentDrawer/Actions/Actions.d.ts +12 -0
  3. package/dist/features/DocumentDrawer/Actions/Actions.js +77 -0
  4. package/dist/features/DocumentDrawer/Actions/index.d.ts +2 -0
  5. package/dist/features/DocumentDrawer/Actions/index.js +2 -0
  6. package/dist/features/DocumentDrawer/Actions/style.scss +6 -0
  7. package/dist/features/DocumentDrawer/AutomaticParser/AutomaticParser.d.ts +8 -0
  8. package/dist/features/DocumentDrawer/AutomaticParser/AutomaticParser.js +96 -0
  9. package/dist/features/DocumentDrawer/AutomaticParser/index.d.ts +2 -0
  10. package/dist/features/DocumentDrawer/AutomaticParser/index.js +2 -0
  11. package/dist/features/DocumentDrawer/AutomaticParser/style.scss +10 -0
  12. package/dist/features/DocumentDrawer/DocumentDrawer.d.ts +14 -0
  13. package/dist/features/DocumentDrawer/DocumentDrawer.js +111 -0
  14. package/dist/features/DocumentDrawer/DocumentEdit/DocumentEdit.d.ts +35 -0
  15. package/dist/features/DocumentDrawer/DocumentEdit/DocumentEdit.js +207 -0
  16. package/dist/features/DocumentDrawer/DocumentEdit/index.d.ts +2 -0
  17. package/dist/features/DocumentDrawer/DocumentEdit/index.js +1 -0
  18. package/dist/features/DocumentDrawer/DocumentExport/DocumentExport.d.ts +7 -0
  19. package/dist/features/DocumentDrawer/DocumentExport/DocumentExport.js +71 -0
  20. package/dist/features/DocumentDrawer/DocumentExport/ExportInvalidSentences.d.ts +7 -0
  21. package/dist/features/DocumentDrawer/DocumentExport/ExportInvalidSentences.js +12 -0
  22. package/dist/features/DocumentDrawer/DocumentExport/index.d.ts +2 -0
  23. package/dist/features/DocumentDrawer/DocumentExport/index.js +2 -0
  24. package/dist/features/DocumentDrawer/DocumentExport/style.scss +31 -0
  25. package/dist/features/DocumentDrawer/DocumentLexicon/DocumentLexicon.d.ts +7 -0
  26. package/dist/features/DocumentDrawer/DocumentLexicon/DocumentLexicon.js +22 -0
  27. package/dist/features/DocumentDrawer/DocumentLexicon/index.d.ts +2 -0
  28. package/dist/features/DocumentDrawer/DocumentLexicon/index.js +2 -0
  29. package/dist/features/DocumentDrawer/DocumentLexicon/style.scss +38 -0
  30. package/dist/features/DocumentDrawer/DocumentRemove/DocumentRemove.d.ts +12 -0
  31. package/dist/features/DocumentDrawer/DocumentRemove/DocumentRemove.js +28 -0
  32. package/dist/features/DocumentDrawer/DocumentRemove/index.d.ts +2 -0
  33. package/dist/features/DocumentDrawer/DocumentRemove/index.js +2 -0
  34. package/dist/features/DocumentDrawer/DocumentRemove/style.scss +0 -0
  35. package/dist/features/DocumentDrawer/Github/Github.d.ts +8 -0
  36. package/dist/features/DocumentDrawer/Github/Github.js +11 -0
  37. package/dist/features/DocumentDrawer/Github/GithubCommit.d.ts +8 -0
  38. package/dist/features/DocumentDrawer/Github/GithubCommit.js +86 -0
  39. package/dist/features/DocumentDrawer/Github/index.d.ts +2 -0
  40. package/dist/features/DocumentDrawer/Github/index.js +2 -0
  41. package/dist/features/DocumentDrawer/Github/style.scss +31 -0
  42. package/dist/features/DocumentDrawer/ImageGallery/GalleryImage.d.ts +8 -0
  43. package/dist/features/DocumentDrawer/ImageGallery/GalleryImage.js +5 -0
  44. package/dist/features/DocumentDrawer/ImageGallery/GalleryRemoval.d.ts +9 -0
  45. package/dist/features/DocumentDrawer/ImageGallery/GalleryRemoval.js +14 -0
  46. package/dist/features/DocumentDrawer/ImageGallery/ImageGallery.d.ts +9 -0
  47. package/dist/features/DocumentDrawer/ImageGallery/ImageGallery.js +45 -0
  48. package/dist/features/DocumentDrawer/ImageGallery/index.d.ts +2 -0
  49. package/dist/features/DocumentDrawer/ImageGallery/index.js +2 -0
  50. package/dist/features/DocumentDrawer/ImageGallery/style.scss +41 -0
  51. package/dist/features/DocumentDrawer/Info/Info.d.ts +10 -0
  52. package/dist/features/DocumentDrawer/Info/Info.js +16 -0
  53. package/dist/features/DocumentDrawer/Info/index.d.ts +2 -0
  54. package/dist/features/DocumentDrawer/Info/index.js +2 -0
  55. package/dist/features/DocumentDrawer/Info/style.scss +24 -0
  56. package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/DocumentMetadata.d.ts +8 -0
  57. package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/DocumentMetadata.js +60 -0
  58. package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/index.d.ts +2 -0
  59. package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/index.js +2 -0
  60. package/dist/features/DocumentDrawer/Metadata/DocumentMetadata/style.scss +7 -0
  61. package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/DocumentMetadataEdit.d.ts +11 -0
  62. package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/DocumentMetadataEdit.js +195 -0
  63. package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/index.d.ts +2 -0
  64. package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/index.js +2 -0
  65. package/dist/features/DocumentDrawer/Metadata/DocumentMetadataEdit/style.scss +58 -0
  66. package/dist/features/DocumentDrawer/PageStatusComponent/PageStatusComponent.d.ts +9 -0
  67. package/dist/features/DocumentDrawer/PageStatusComponent/PageStatusComponent.js +30 -0
  68. package/dist/features/DocumentDrawer/PageStatusComponent/index.d.ts +2 -0
  69. package/dist/features/DocumentDrawer/PageStatusComponent/index.js +2 -0
  70. package/dist/features/DocumentDrawer/PageStatusComponent/style.scss +19 -0
  71. package/dist/features/DocumentDrawer/Pages/BoxRemoval.d.ts +9 -0
  72. package/dist/features/DocumentDrawer/Pages/BoxRemoval.js +14 -0
  73. package/dist/features/DocumentDrawer/Pages/Boxes.d.ts +9 -0
  74. package/dist/features/DocumentDrawer/Pages/Boxes.js +63 -0
  75. package/dist/features/DocumentDrawer/Pages/PageRemoval.d.ts +9 -0
  76. package/dist/features/DocumentDrawer/Pages/PageRemoval.js +15 -0
  77. package/dist/features/DocumentDrawer/Pages/Pages.d.ts +10 -0
  78. package/dist/features/DocumentDrawer/Pages/Pages.js +72 -0
  79. package/dist/features/DocumentDrawer/Pages/style.scss +48 -0
  80. package/dist/features/DocumentDrawer/deps.d.ts +28 -0
  81. package/dist/features/DocumentDrawer/deps.js +20 -0
  82. package/dist/features/DocumentDrawer/functions/FileUtils.d.ts +4 -0
  83. package/dist/features/DocumentDrawer/functions/FileUtils.js +8 -0
  84. package/dist/features/DocumentDrawer/functions/MetadataUtils.d.ts +41 -0
  85. package/dist/features/DocumentDrawer/functions/MetadataUtils.js +192 -0
  86. package/dist/features/DocumentDrawer/index.d.ts +5 -0
  87. package/dist/features/DocumentDrawer/index.js +3 -0
  88. package/dist/features/DocumentDrawer/localization/ActionsTexts.d.ts +77 -0
  89. package/dist/features/DocumentDrawer/localization/ActionsTexts.js +77 -0
  90. package/dist/features/DocumentDrawer/localization/DocumentTexts.d.ts +140 -0
  91. package/dist/features/DocumentDrawer/localization/DocumentTexts.js +140 -0
  92. package/dist/features/DocumentDrawer/localization/ExportTexts.d.ts +59 -0
  93. package/dist/features/DocumentDrawer/localization/ExportTexts.js +59 -0
  94. package/dist/features/DocumentDrawer/localization/GithubTexts.d.ts +35 -0
  95. package/dist/features/DocumentDrawer/localization/GithubTexts.js +35 -0
  96. package/dist/features/DocumentDrawer/localization/PageTexts.d.ts +45 -0
  97. package/dist/features/DocumentDrawer/localization/PageTexts.js +45 -0
  98. package/dist/features/DocumentDrawer/localization/ParserTexts.d.ts +30 -0
  99. package/dist/features/DocumentDrawer/localization/ParserTexts.js +30 -0
  100. package/dist/features/DocumentDrawer/services/AutomaticParserService.d.ts +8 -0
  101. package/dist/features/DocumentDrawer/services/AutomaticParserService.js +9 -0
  102. package/dist/features/DocumentDrawer/services/BoundingBoxService.d.ts +11 -0
  103. package/dist/features/DocumentDrawer/services/BoundingBoxService.js +20 -0
  104. package/dist/features/DocumentDrawer/services/DocumentService.d.ts +13 -0
  105. package/dist/features/DocumentDrawer/services/DocumentService.js +20 -0
  106. package/dist/features/DocumentDrawer/services/ExportService.d.ts +11 -0
  107. package/dist/features/DocumentDrawer/services/ExportService.js +16 -0
  108. package/dist/features/DocumentDrawer/services/GithubService.d.ts +8 -0
  109. package/dist/features/DocumentDrawer/services/GithubService.js +12 -0
  110. package/dist/features/DocumentDrawer/services/ImageService.d.ts +8 -0
  111. package/dist/features/DocumentDrawer/services/ImageService.js +12 -0
  112. package/dist/features/DocumentDrawer/services/LexiconService.d.ts +10 -0
  113. package/dist/features/DocumentDrawer/services/LexiconService.js +9 -0
  114. package/dist/features/DocumentDrawer/services/MetadataService.d.ts +15 -0
  115. package/dist/features/DocumentDrawer/services/MetadataService.js +26 -0
  116. package/dist/features/DocumentDrawer/services/PageService.d.ts +11 -0
  117. package/dist/features/DocumentDrawer/services/PageService.js +16 -0
  118. package/dist/features/DocumentDrawer/services/SentenceService.d.ts +6 -0
  119. package/dist/features/DocumentDrawer/services/SentenceService.js +6 -0
  120. package/dist/features/DocumentDrawer/style.scss +171 -0
  121. package/dist/features/DocumentDrawer/types/BoundingBox.d.ts +8 -0
  122. package/dist/features/DocumentDrawer/types/BoundingBox.js +1 -0
  123. package/dist/features/DocumentDrawer/types/CatalogSearchFilter.d.ts +15 -0
  124. package/dist/features/DocumentDrawer/types/CatalogSearchFilter.js +16 -0
  125. package/dist/features/DocumentDrawer/types/Category.d.ts +16 -0
  126. package/dist/features/DocumentDrawer/types/Category.js +5 -0
  127. package/dist/features/DocumentDrawer/types/DocumentStatus.d.ts +7 -0
  128. package/dist/features/DocumentDrawer/types/DocumentStatus.js +6 -0
  129. package/dist/features/DocumentDrawer/types/DocumentUpdateRequest.d.ts +13 -0
  130. package/dist/features/DocumentDrawer/types/DocumentUpdateRequest.js +1 -0
  131. package/dist/features/DocumentDrawer/types/Export.d.ts +25 -0
  132. package/dist/features/DocumentDrawer/types/Export.js +36 -0
  133. package/dist/features/DocumentDrawer/types/Lexicon.d.ts +6 -0
  134. package/dist/features/DocumentDrawer/types/Lexicon.js +1 -0
  135. package/dist/features/DocumentDrawer/types/LexiconResponse.d.ts +6 -0
  136. package/dist/features/DocumentDrawer/types/LexiconResponse.js +1 -0
  137. package/dist/features/DocumentDrawer/types/Metadata.d.ts +22 -0
  138. package/dist/features/DocumentDrawer/types/Metadata.js +8 -0
  139. package/dist/features/DocumentDrawer/types/Page.d.ts +10 -0
  140. package/dist/features/DocumentDrawer/types/Page.js +1 -0
  141. package/dist/features/DocumentDrawer/types/PageStatus.d.ts +9 -0
  142. package/dist/features/DocumentDrawer/types/PageStatus.js +8 -0
  143. package/dist/features/DocumentDrawer/types/Parser.d.ts +18 -0
  144. package/dist/features/DocumentDrawer/types/Parser.js +21 -0
  145. package/dist/features/DocumentDrawer/types/Query.d.ts +6 -0
  146. package/dist/features/DocumentDrawer/types/Query.js +1 -0
  147. package/dist/features/DocumentDrawer/types/Sentence.d.ts +4 -0
  148. package/dist/features/DocumentDrawer/types/Sentence.js +1 -0
  149. package/dist/features/index.d.ts +4 -0
  150. package/dist/features/index.js +2 -0
  151. package/dist/shell/Header/HeaderApps/HeaderApps.js +2 -1
  152. package/dist/shell/Header/HelpButton/HelpModal.js +2 -1
  153. package/package.json +1 -1
@@ -0,0 +1,48 @@
1
+ .pages-container {
2
+ height: 100%;
3
+ display: flex;
4
+ flex-direction: column;
5
+
6
+ > .body {
7
+ display: flex;
8
+ flex-wrap: wrap;
9
+ max-height: 90vh;
10
+ overflow-y: auto;
11
+ padding: 16px;
12
+ gap: 16px;
13
+
14
+ > .ds-app-card {
15
+ cursor: pointer;
16
+ flex: 0 0 calc(50% - 16px);
17
+
18
+ > .body {
19
+ position: relative;
20
+ display: flex;
21
+ justify-content: center;
22
+ align-items: center;
23
+ height: 20vh;
24
+ overflow: hidden;
25
+
26
+ .page-status-tag {
27
+ position: absolute;
28
+ top: 5px;
29
+ right: 5px;
30
+ }
31
+
32
+ img {
33
+ max-height: 20vh;
34
+ max-width: 230px;
35
+ }
36
+ }
37
+
38
+ > .footer {
39
+ align-items: center;
40
+ justify-content: space-between;
41
+ }
42
+ }
43
+ }
44
+
45
+ > .footer {
46
+ margin-top: auto;
47
+ }
48
+ }
@@ -0,0 +1,28 @@
1
+ export type { default as Document } from '../../configs/types/Document';
2
+ export type { DocumentStatus } from '../../configs/types/Document';
3
+ export { DocumentStatusNames } from '../../configs/types/Document';
4
+ export type { Corpus } from '../../configs/types/Corpus';
5
+ export { useCorpusUtils } from '../../configs/useCorpusUtils';
6
+ export { useMessageUtils } from '../../configs/useMessageUtils';
7
+ export { default as AppModal } from '../../common/AppModal/AppModal';
8
+ export { default as AppModalConfirm } from '../../common/AppModal/AppModalConfirm';
9
+ export { default as AppForm } from '../../common/AppForm/AppForm';
10
+ export type { AppFormField } from '../../common/AppForm/AppFormField';
11
+ export { default as AppFormInfo } from '../../common/AppForm/AppFormInfo';
12
+ export { default as AppCopyText } from '../../common/AppCopyText';
13
+ export { default as AppLoading } from '../../common/AppLoading/AppLoading';
14
+ export { default as AppPlaceholder } from '../../common/AppPlaceholder/AppPlaceholder';
15
+ export { default as AppCard } from '../../common/AppCard/AppCard';
16
+ export { default as AppPagination } from '../../common/AppPagination/AppPagination';
17
+ export { default as AppPicture } from '../../common/AppPicture/AppPicture';
18
+ export { default as AppDropzone } from '../../common/AppDropzone/AppDropzone';
19
+ export type { UploadedFile } from '../../common/AppDropzone/UploadedFile';
20
+ export type { AppPage } from '../../common/AppTable/types/AppPage';
21
+ export { default as DateUtils } from '../../functions/DateUtils';
22
+ export { default as FormUtils } from '../../functions/FormUtils';
23
+ export { default as ToolsUtils, EDITION_TOOLS } from '../../functions/ToolsUtils';
24
+ export type { PlatformTools } from '../../functions/ToolsUtils';
25
+ export { default as UsabilityUtils } from '../../functions/UsabilityUtils';
26
+ export { yupResolver, yup } from '../../vendor';
27
+ export type { PaginationState } from '../../vendor';
28
+ export { default as Participants } from '../Participants';
@@ -0,0 +1,20 @@
1
+ export { DocumentStatusNames } from '../../configs/types/Document';
2
+ export { useCorpusUtils } from '../../configs/useCorpusUtils';
3
+ export { useMessageUtils } from '../../configs/useMessageUtils';
4
+ export { default as AppModal } from '../../common/AppModal/AppModal';
5
+ export { default as AppModalConfirm } from '../../common/AppModal/AppModalConfirm';
6
+ export { default as AppForm } from '../../common/AppForm/AppForm';
7
+ export { default as AppFormInfo } from '../../common/AppForm/AppFormInfo';
8
+ export { default as AppCopyText } from '../../common/AppCopyText';
9
+ export { default as AppLoading } from '../../common/AppLoading/AppLoading';
10
+ export { default as AppPlaceholder } from '../../common/AppPlaceholder/AppPlaceholder';
11
+ export { default as AppCard } from '../../common/AppCard/AppCard';
12
+ export { default as AppPagination } from '../../common/AppPagination/AppPagination';
13
+ export { default as AppPicture } from '../../common/AppPicture/AppPicture';
14
+ export { default as AppDropzone } from '../../common/AppDropzone/AppDropzone';
15
+ export { default as DateUtils } from '../../functions/DateUtils';
16
+ export { default as FormUtils } from '../../functions/FormUtils';
17
+ export { default as ToolsUtils, EDITION_TOOLS } from '../../functions/ToolsUtils';
18
+ export { default as UsabilityUtils } from '../../functions/UsabilityUtils';
19
+ export { yupResolver, yup } from '../../vendor';
20
+ export { default as Participants } from '../Participants';
@@ -0,0 +1,4 @@
1
+ declare const FileUtils: {
2
+ getFileNameFromURL: (url: string) => string | undefined;
3
+ };
4
+ export default FileUtils;
@@ -0,0 +1,8 @@
1
+ const getFileNameFromURL = (url) => {
2
+ const segments = url.split('/');
3
+ return segments.pop();
4
+ };
5
+ const FileUtils = {
6
+ getFileNameFromURL,
7
+ };
8
+ export default FileUtils;
@@ -0,0 +1,41 @@
1
+ import { AppFormField, Document } from '../deps';
2
+ import { SelectItem } from 'tycho-storybook';
3
+ import Metadata, { MetadataType } from '../types/Metadata';
4
+ export type MetadataEntry = {
5
+ attr: string;
6
+ meta: Metadata;
7
+ value: string;
8
+ };
9
+ declare function metaAttr(meta: Metadata): string;
10
+ declare function normalizeMetadataType(type: string | undefined): MetadataType | '';
11
+ declare function toAutocompleteFormValue(value: string): SelectItem | null;
12
+ declare function toMetadataString(raw: unknown): string;
13
+ /** Normalize API/storage values (ISO instant, offsets, yyyy-MM-dd) to yyyy-MM-dd for forms and PATCH. */
14
+ declare function normalizeMetadataDateValue(value: string): string;
15
+ /** Human-readable date for read-only metadata display (matches DatePicker display format). */
16
+ declare function formatMetadataDateForDisplay(value: string): string;
17
+ /** @deprecated Use normalizeMetadataDateValue */
18
+ declare function normalizeDateFormValue(value: string): string;
19
+ /** Read visible autocomplete input text when freeSolo value is not yet in form state. */
20
+ declare function readFieldInputText(root: ParentNode | null, attr: string): string;
21
+ declare function resolveRawFromForm(meta: Metadata, attr: string, formValues: Record<string, unknown>, domRoot: ParentNode | null): unknown;
22
+ declare function serializeMetadataValue(meta: Metadata, raw: unknown): string;
23
+ declare function toAppFormField(meta: Metadata, attr: string, t: (key: string) => string): AppFormField;
24
+ declare function compareMetadata(a: Metadata, b: Metadata): number;
25
+ declare function buildInitialEntries(defs: Metadata[], doc: Document): MetadataEntry[];
26
+ declare const MetadataUtils: {
27
+ metaAttr: typeof metaAttr;
28
+ normalizeMetadataType: typeof normalizeMetadataType;
29
+ toAppFormField: typeof toAppFormField;
30
+ toAutocompleteFormValue: typeof toAutocompleteFormValue;
31
+ toMetadataString: typeof toMetadataString;
32
+ normalizeMetadataDateValue: typeof normalizeMetadataDateValue;
33
+ normalizeDateFormValue: typeof normalizeDateFormValue;
34
+ formatMetadataDateForDisplay: typeof formatMetadataDateForDisplay;
35
+ readFieldInputText: typeof readFieldInputText;
36
+ resolveRawFromForm: typeof resolveRawFromForm;
37
+ serializeMetadataValue: typeof serializeMetadataValue;
38
+ compareMetadata: typeof compareMetadata;
39
+ buildInitialEntries: typeof buildInitialEntries;
40
+ };
41
+ export default MetadataUtils;
@@ -0,0 +1,192 @@
1
+ import { DateUtils } from '../deps';
2
+ const METADATA_DATE_STORAGE = 'yyyy-MM-dd';
3
+ function metaAttr(meta) {
4
+ return meta.symbol === 'genre' ? 'genre' : meta.uid;
5
+ }
6
+ function normalizeMetadataType(type) {
7
+ return (type?.toUpperCase() ?? '');
8
+ }
9
+ function metadataValueToString(raw) {
10
+ if (raw == null)
11
+ return '';
12
+ if (typeof raw === 'string')
13
+ return raw;
14
+ if (raw instanceof Date && DateUtils.isValidDate(raw)) {
15
+ return DateUtils.format(raw, METADATA_DATE_STORAGE);
16
+ }
17
+ return String(raw);
18
+ }
19
+ function listOptions(meta) {
20
+ if (!meta.values)
21
+ return [];
22
+ return meta.values.split(',').map((v) => {
23
+ const s = v.trim();
24
+ return { label: s, value: s };
25
+ });
26
+ }
27
+ function toAutocompleteFormValue(value) {
28
+ const s = value?.trim() ?? '';
29
+ if (!s)
30
+ return null;
31
+ return { label: s, value: s };
32
+ }
33
+ function toMetadataString(raw) {
34
+ if (raw == null)
35
+ return '';
36
+ if (typeof raw === 'string')
37
+ return raw.trim();
38
+ if (typeof raw === 'number' || typeof raw === 'boolean') {
39
+ return String(raw).trim();
40
+ }
41
+ const option = raw;
42
+ if (option.value != null && String(option.value).trim() !== '') {
43
+ return String(option.value).trim();
44
+ }
45
+ if (option.label != null && String(option.label).trim() !== '') {
46
+ return String(option.label).trim();
47
+ }
48
+ return '';
49
+ }
50
+ const METADATA_DATE_DISPLAY = 'dd/MM/yyyy';
51
+ /** Normalize API/storage values (ISO instant, offsets, yyyy-MM-dd) to yyyy-MM-dd for forms and PATCH. */
52
+ function normalizeMetadataDateValue(value) {
53
+ const s = value?.trim() ?? '';
54
+ if (!s)
55
+ return '';
56
+ const fromIso = DateUtils.parseISOString(s);
57
+ if (DateUtils.isValidDate(fromIso)) {
58
+ return DateUtils.format(fromIso, METADATA_DATE_STORAGE);
59
+ }
60
+ const storage = DateUtils.parseDate(s, METADATA_DATE_STORAGE, new Date());
61
+ if (DateUtils.isValidDate(storage))
62
+ return DateUtils.format(storage, METADATA_DATE_STORAGE);
63
+ const dotted = DateUtils.parseDate(s, 'dd.MM.yyyy', new Date());
64
+ if (DateUtils.isValidDate(dotted))
65
+ return DateUtils.format(dotted, METADATA_DATE_STORAGE);
66
+ const slashed = DateUtils.parseDate(s, METADATA_DATE_DISPLAY, new Date());
67
+ if (DateUtils.isValidDate(slashed))
68
+ return DateUtils.format(slashed, METADATA_DATE_STORAGE);
69
+ return '';
70
+ }
71
+ /** Human-readable date for read-only metadata display (matches DatePicker display format). */
72
+ function formatMetadataDateForDisplay(value) {
73
+ const normalized = normalizeMetadataDateValue(value);
74
+ if (!normalized)
75
+ return '';
76
+ const d = DateUtils.parseDate(normalized, METADATA_DATE_STORAGE, new Date());
77
+ return DateUtils.isValidDate(d) ? DateUtils.format(d, METADATA_DATE_DISPLAY) : normalized;
78
+ }
79
+ /** @deprecated Use normalizeMetadataDateValue */
80
+ function normalizeDateFormValue(value) {
81
+ return normalizeMetadataDateValue(value);
82
+ }
83
+ /** Read visible autocomplete input text when freeSolo value is not yet in form state. */
84
+ function readFieldInputText(root, attr) {
85
+ if (!root)
86
+ return '';
87
+ const row = root.querySelector(`[data-metadata-field="${attr}"]`);
88
+ if (!row)
89
+ return '';
90
+ const input = row.querySelector('.ds-select-text input') ??
91
+ row.querySelector('input');
92
+ return input?.value?.trim() ?? '';
93
+ }
94
+ function resolveRawFromForm(meta, attr, formValues, domRoot) {
95
+ const type = normalizeMetadataType(meta.type);
96
+ const formRaw = formValues[attr];
97
+ if (type === 'DATE') {
98
+ return formRaw;
99
+ }
100
+ if (type === 'TEXT') {
101
+ const typed = readFieldInputText(domRoot, attr);
102
+ if (typed)
103
+ return typed;
104
+ return formRaw;
105
+ }
106
+ return formRaw;
107
+ }
108
+ function serializeMetadataValue(meta, raw) {
109
+ const type = normalizeMetadataType(meta.type);
110
+ if (type === 'TEXT')
111
+ return toMetadataString(raw);
112
+ if (type === 'DATE') {
113
+ if (raw == null)
114
+ return '';
115
+ if (raw instanceof Date && DateUtils.isValidDate(raw)) {
116
+ return DateUtils.format(raw, METADATA_DATE_STORAGE);
117
+ }
118
+ return normalizeMetadataDateValue(String(raw));
119
+ }
120
+ if (raw == null)
121
+ return '';
122
+ return String(raw).trim();
123
+ }
124
+ function toAppFormField(meta, attr, t) {
125
+ const type = normalizeMetadataType(meta.type);
126
+ const base = {
127
+ attr,
128
+ name: meta.name,
129
+ type: 'text',
130
+ };
131
+ if (type === 'TEXT') {
132
+ return {
133
+ ...base,
134
+ type: 'autocomplete',
135
+ multiple: false,
136
+ freeSolo: true,
137
+ title: t('metadata.autocomplete.placeholder'),
138
+ translation: t('metadata.autocomplete.nooptions'),
139
+ };
140
+ }
141
+ if (type === 'LIST') {
142
+ return { ...base, type: 'select', options: listOptions(meta) };
143
+ }
144
+ if (type === 'DATE') {
145
+ return { ...base, type: 'datepicker' };
146
+ }
147
+ return base;
148
+ }
149
+ function compareMetadata(a, b) {
150
+ const aOrder = Number.isFinite(a.order) ? a.order : Number.MAX_SAFE_INTEGER;
151
+ const bOrder = Number.isFinite(b.order) ? b.order : Number.MAX_SAFE_INTEGER;
152
+ const orderDiff = aOrder - bOrder;
153
+ if (orderDiff !== 0)
154
+ return orderDiff;
155
+ return a.name.localeCompare(b.name);
156
+ }
157
+ function buildInitialEntries(defs, doc) {
158
+ const rows = doc.metadata || [];
159
+ const result = [];
160
+ for (const row of rows) {
161
+ const def = defs.find((d) => metaAttr(d) === row.uid);
162
+ if (def) {
163
+ const rawValue = metadataValueToString(row.value);
164
+ const value = normalizeMetadataType(def.type) === 'DATE'
165
+ ? normalizeMetadataDateValue(rawValue)
166
+ : rawValue;
167
+ result.push({
168
+ attr: row.uid,
169
+ meta: def,
170
+ value,
171
+ });
172
+ }
173
+ }
174
+ result.sort((a, b) => compareMetadata(a.meta, b.meta));
175
+ return result;
176
+ }
177
+ const MetadataUtils = {
178
+ metaAttr,
179
+ normalizeMetadataType,
180
+ toAppFormField,
181
+ toAutocompleteFormValue,
182
+ toMetadataString,
183
+ normalizeMetadataDateValue,
184
+ normalizeDateFormValue,
185
+ formatMetadataDateForDisplay,
186
+ readFieldInputText,
187
+ resolveRawFromForm,
188
+ serializeMetadataValue,
189
+ compareMetadata,
190
+ buildInitialEntries,
191
+ };
192
+ export default MetadataUtils;
@@ -0,0 +1,5 @@
1
+ import DocumentDrawer from './DocumentDrawer';
2
+ export default DocumentDrawer;
3
+ export type { DocumentDrawerProps } from './DocumentDrawer';
4
+ export type { default as CatalogSearchFilter } from './types/CatalogSearchFilter';
5
+ export { emptyCatalogSearchFilter, hasActiveCatalogFilter, } from './types/CatalogSearchFilter';
@@ -0,0 +1,3 @@
1
+ import DocumentDrawer from './DocumentDrawer';
2
+ export default DocumentDrawer;
3
+ export { emptyCatalogSearchFilter, hasActiveCatalogFilter, } from './types/CatalogSearchFilter';
@@ -0,0 +1,77 @@
1
+ export declare const ActionsTexts: {
2
+ en: {
3
+ 'label.tool': string;
4
+ 'button.label.add': string;
5
+ 'button.label.filter': string;
6
+ 'tooltip.label.list': string;
7
+ 'tooltip.label.grid': string;
8
+ 'label.automatic.title': string;
9
+ 'label.automatic.description': string;
10
+ 'label.sync.title': string;
11
+ 'label.sync.description': string;
12
+ 'actions.label.title': string;
13
+ 'actions.label.open': string;
14
+ 'actions.label.info': string;
15
+ 'actions.label.remove': string;
16
+ 'actions.label.remove.description': string;
17
+ 'label.resume.title': string;
18
+ 'label.resume.description': string;
19
+ 'label.syntactic.title': string;
20
+ 'label.syntactic.description': string;
21
+ 'label.edition.title': string;
22
+ 'label.edition.description': string;
23
+ 'modal.remove.title': string;
24
+ 'modal.title.design': string;
25
+ 'modal.description.design': string;
26
+ };
27
+ 'pt-BR': {
28
+ 'label.tool': string;
29
+ 'button.label.add': string;
30
+ 'button.label.filter': string;
31
+ 'tooltip.label.list': string;
32
+ 'tooltip.label.grid': string;
33
+ 'label.automatic.title': string;
34
+ 'label.automatic.description': string;
35
+ 'label.sync.title': string;
36
+ 'label.sync.description': string;
37
+ 'actions.label.title': string;
38
+ 'actions.label.open': string;
39
+ 'actions.label.info': string;
40
+ 'actions.label.remove': string;
41
+ 'actions.label.remove.description': string;
42
+ 'modal.remove.title': string;
43
+ 'label.resume.title': string;
44
+ 'label.resume.description': string;
45
+ 'label.syntactic.title': string;
46
+ 'label.syntactic.description': string;
47
+ 'label.edition.title': string;
48
+ 'label.edition.description': string;
49
+ 'modal.title.design': string;
50
+ 'modal.description.design': string;
51
+ };
52
+ it: {
53
+ 'label.tool': string;
54
+ 'button.label.add': string;
55
+ 'button.label.filter': string;
56
+ 'tooltip.label.list': string;
57
+ 'tooltip.label.grid': string;
58
+ 'label.automatic.title': string;
59
+ 'label.automatic.description': string;
60
+ 'label.sync.title': string;
61
+ 'label.sync.description': string;
62
+ 'actions.label.title': string;
63
+ 'actions.label.open': string;
64
+ 'actions.label.info': string;
65
+ 'actions.label.remove': string;
66
+ 'actions.label.remove.description': string;
67
+ 'label.resume.title': string;
68
+ 'label.resume.description': string;
69
+ 'label.syntactic.title': string;
70
+ 'label.syntactic.description': string;
71
+ 'label.edition.title': string;
72
+ 'label.edition.description': string;
73
+ 'modal.remove.title': string;
74
+ 'modal.title.design': string;
75
+ 'modal.description.design': string;
76
+ };
77
+ };
@@ -0,0 +1,77 @@
1
+ export const ActionsTexts = {
2
+ en: {
3
+ 'label.tool': 'Catalog',
4
+ 'button.label.add': 'Add new document',
5
+ 'button.label.filter': 'Filter',
6
+ 'tooltip.label.list': 'Display as list',
7
+ 'tooltip.label.grid': 'Display as grid',
8
+ 'label.automatic.title': 'Automatic Parsing',
9
+ 'label.automatic.description': 'Automatically parse all sentences.',
10
+ 'label.sync.title': 'Synchronize document search',
11
+ 'label.sync.description': 'Mark this document to be synchronized again by the search service.',
12
+ 'actions.label.title': 'Actions',
13
+ 'actions.label.open': 'Open in new window',
14
+ 'actions.label.info': 'Open information',
15
+ 'actions.label.remove': 'Remove document',
16
+ 'actions.label.remove.description': 'Attention! This process is irreversible.',
17
+ 'label.resume.title': 'Resume syntactic annotation',
18
+ 'label.resume.description': 'Continue from the last reviewed sentence.',
19
+ 'label.syntactic.title': 'Review Sentences',
20
+ 'label.syntactic.description': 'Review and validate syntactic annotations for sentences.',
21
+ 'label.edition.title': 'Resume editing the document',
22
+ 'label.edition.description': 'Continue editing the document content.',
23
+ 'modal.remove.title': 'Remove document',
24
+ 'modal.title.design': 'Change editing tool',
25
+ 'modal.description.design': 'You are about to change the default editing tool for this document from Design to another tool. <bold>Attention! Marks made in the image will be lost. Once confirmed, this change cannot be undone.</bold>',
26
+ },
27
+ 'pt-BR': {
28
+ 'label.tool': 'Catálogo',
29
+ 'button.label.add': 'Adicionar novo documento',
30
+ 'button.label.filter': 'Filtrar',
31
+ 'tooltip.label.list': 'Mostrar como lista',
32
+ 'tooltip.label.grid': 'Mostrar como grid',
33
+ 'label.automatic.title': 'Parser Automático',
34
+ 'label.automatic.description': 'Execute o parser automaticamente para todas as sentenças.',
35
+ 'label.sync.title': 'Sincronizar busca do documento',
36
+ 'label.sync.description': 'Marcar este documento para ser sincronizado novamente no serviço de busca.',
37
+ 'actions.label.title': 'Ações',
38
+ 'actions.label.open': 'Abrir em uma nova janela',
39
+ 'actions.label.info': 'Exibir informações',
40
+ 'actions.label.remove': 'Remover documento',
41
+ 'actions.label.remove.description': 'Atenção! Este processo é irreversível.',
42
+ 'modal.remove.title': 'Remover documento',
43
+ 'label.resume.title': 'Continuar anotação sintática',
44
+ 'label.resume.description': 'Continue a partir da última sentença revisada.',
45
+ 'label.syntactic.title': 'Revisar sentenças',
46
+ 'label.syntactic.description': 'Revise e valide as anotações sintáticas das sentenças.',
47
+ 'label.edition.title': 'Continuar a edição do documento',
48
+ 'label.edition.description': 'Continue editando o conteúdo do documento.',
49
+ 'modal.title.design': 'Alterar ferramenta de edição',
50
+ 'modal.description.design': 'Você está prestes a alterar a ferramenta de edição padrão deste documento do Design para outra ferramenta. <bold>Atenção! Marcas feitas na imagem serão perdidas. Uma vez confirmada, essa mudança não poderá ser desfeita.</bold>',
51
+ },
52
+ it: {
53
+ 'label.tool': 'Catalogo',
54
+ 'button.label.add': 'Aggiungi nuovo documento',
55
+ 'button.label.filter': 'Filtra',
56
+ 'tooltip.label.list': 'Mostra come elenco',
57
+ 'tooltip.label.grid': 'Mostra come griglia',
58
+ 'label.automatic.title': 'Analisi automatica',
59
+ 'label.automatic.description': 'Analizza automaticamente tutte le frasi.',
60
+ 'label.sync.title': 'Sincronizza ricerca documento',
61
+ 'label.sync.description': 'Segna questo documento per essere sincronizzato di nuovo dal servizio di ricerca.',
62
+ 'actions.label.title': 'Azioni',
63
+ 'actions.label.open': 'Apri in una nuova finestra',
64
+ 'actions.label.info': 'Apri informazioni',
65
+ 'actions.label.remove': 'Rimuovi documento',
66
+ 'actions.label.remove.description': 'Attenzione! Questo processo è irreversibile.',
67
+ 'label.resume.title': 'Riprendi annotazione sintattica',
68
+ 'label.resume.description': "Continua dall'ultima frase revisionata.",
69
+ 'label.syntactic.title': 'Revisiona frasi',
70
+ 'label.syntactic.description': 'Revisiona e convalida le annotazioni sintattiche delle frasi.',
71
+ 'label.edition.title': 'Riprendi modifica del documento',
72
+ 'label.edition.description': 'Continua a modificare il contenuto del documento.',
73
+ 'modal.remove.title': 'Rimuovi documento',
74
+ 'modal.title.design': 'Cambia strumento di modifica',
75
+ 'modal.description.design': 'Stai per cambiare lo strumento di modifica predefinito di questo documento da Design a un altro strumento. <bold>Attenzione! Le marcature sull\'immagine andranno perse. Una volta confermato, questa modifica non potrà essere annullata.</bold>',
76
+ },
77
+ };
@@ -0,0 +1,140 @@
1
+ export declare const DocumentTexts: {
2
+ en: {
3
+ 'menu.label.close': string;
4
+ 'menu.label.home': string;
5
+ 'menu.label.pages': string;
6
+ 'menu.label.images': string;
7
+ 'menu.label.actions': string;
8
+ 'menu.label.metadata': string;
9
+ 'menu.label.lexicon': string;
10
+ 'menu.label.export': string;
11
+ 'menu.label.participants': string;
12
+ 'menu.label.github': string;
13
+ 'document.label.title': string;
14
+ 'document.button.edit': string;
15
+ 'document.modal.edit.title': string;
16
+ 'document.field.name': string;
17
+ 'document.field.translated': string;
18
+ 'document.field.reference': string;
19
+ 'document.field.author': string;
20
+ 'document.field.description': string;
21
+ 'document.field.category': string;
22
+ 'document.field.status': string;
23
+ 'document.field.visible': string;
24
+ 'document.field.inc': string;
25
+ 'document.field.defaultTool': string;
26
+ 'images.label.title': string;
27
+ 'images.label.card': string;
28
+ 'images.tooltip.add': string;
29
+ 'images.tooltip.remove': string;
30
+ 'metadata.label.title': string;
31
+ 'metadata.modal.edit.title': string;
32
+ 'metadata.add.select.label': string;
33
+ 'metadata.add.select.placeholder': string;
34
+ 'metadata.button.add': string;
35
+ 'metadata.list.label': string;
36
+ 'metadata.remove.tooltip': string;
37
+ 'metadata.autocomplete.placeholder': string;
38
+ 'metadata.autocomplete.nooptions': string;
39
+ 'error.metadata.invalid': string;
40
+ 'lexicon.label.title': string;
41
+ 'lexicon.label.word': string;
42
+ 'lexicon.label.tag': string;
43
+ 'lexicon.label.editions': string;
44
+ 'placeholder.empty.lexicon': string;
45
+ 'placeholder.empty.metadata': string;
46
+ 'placeholder.empty.images': string;
47
+ };
48
+ 'pt-BR': {
49
+ 'menu.label.close': string;
50
+ 'menu.label.home': string;
51
+ 'menu.label.pages': string;
52
+ 'menu.label.images': string;
53
+ 'menu.label.actions': string;
54
+ 'menu.label.metadata': string;
55
+ 'menu.label.lexicon': string;
56
+ 'menu.label.export': string;
57
+ 'menu.label.participants': string;
58
+ 'menu.label.github': string;
59
+ 'document.label.title': string;
60
+ 'document.button.edit': string;
61
+ 'document.modal.edit.title': string;
62
+ 'document.field.name': string;
63
+ 'document.field.translated': string;
64
+ 'document.field.reference': string;
65
+ 'document.field.author': string;
66
+ 'document.field.description': string;
67
+ 'document.field.category': string;
68
+ 'document.field.status': string;
69
+ 'document.field.visible': string;
70
+ 'document.field.inc': string;
71
+ 'document.field.defaultTool': string;
72
+ 'images.label.title': string;
73
+ 'images.label.card': string;
74
+ 'images.tooltip.add': string;
75
+ 'images.tooltip.remove': string;
76
+ 'metadata.label.title': string;
77
+ 'metadata.modal.edit.title': string;
78
+ 'metadata.add.select.label': string;
79
+ 'metadata.add.select.placeholder': string;
80
+ 'metadata.button.add': string;
81
+ 'metadata.list.label': string;
82
+ 'metadata.remove.tooltip': string;
83
+ 'metadata.autocomplete.placeholder': string;
84
+ 'metadata.autocomplete.nooptions': string;
85
+ 'error.metadata.invalid': string;
86
+ 'lexicon.label.title': string;
87
+ 'lexicon.label.word': string;
88
+ 'lexicon.label.tag': string;
89
+ 'lexicon.label.editions': string;
90
+ 'placeholder.empty.lexicon': string;
91
+ 'placeholder.empty.metadata': string;
92
+ 'placeholder.empty.images': string;
93
+ };
94
+ it: {
95
+ 'menu.label.close': string;
96
+ 'menu.label.home': string;
97
+ 'menu.label.pages': string;
98
+ 'menu.label.images': string;
99
+ 'menu.label.actions': string;
100
+ 'menu.label.metadata': string;
101
+ 'menu.label.lexicon': string;
102
+ 'menu.label.export': string;
103
+ 'menu.label.participants': string;
104
+ 'menu.label.github': string;
105
+ 'document.label.title': string;
106
+ 'document.button.edit': string;
107
+ 'document.modal.edit.title': string;
108
+ 'document.field.name': string;
109
+ 'document.field.translated': string;
110
+ 'document.field.reference': string;
111
+ 'document.field.author': string;
112
+ 'document.field.description': string;
113
+ 'document.field.category': string;
114
+ 'document.field.status': string;
115
+ 'document.field.visible': string;
116
+ 'document.field.inc': string;
117
+ 'document.field.defaultTool': string;
118
+ 'images.label.title': string;
119
+ 'images.label.card': string;
120
+ 'images.tooltip.add': string;
121
+ 'images.tooltip.remove': string;
122
+ 'metadata.label.title': string;
123
+ 'metadata.modal.edit.title': string;
124
+ 'metadata.add.select.label': string;
125
+ 'metadata.add.select.placeholder': string;
126
+ 'metadata.button.add': string;
127
+ 'metadata.list.label': string;
128
+ 'metadata.remove.tooltip': string;
129
+ 'metadata.autocomplete.placeholder': string;
130
+ 'metadata.autocomplete.nooptions': string;
131
+ 'error.metadata.invalid': string;
132
+ 'lexicon.label.title': string;
133
+ 'lexicon.label.word': string;
134
+ 'lexicon.label.tag': string;
135
+ 'lexicon.label.editions': string;
136
+ 'placeholder.empty.lexicon': string;
137
+ 'placeholder.empty.metadata': string;
138
+ 'placeholder.empty.images': string;
139
+ };
140
+ };