@dialob/composer-material 0.0.16 → 0.0.17
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.
- package/README.md +35 -0
- package/dist-lib/index.d.ts +17 -4
- package/dist-lib/index.js +11697 -11317
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,41 @@ pnpm run preview
|
|
|
101
101
|
|
|
102
102
|
Starts preview server for built application from `/dist` (No hot-reload!). Run `pnpm build` first to build the package
|
|
103
103
|
|
|
104
|
+
## AI Translation Feature
|
|
105
|
+
|
|
106
|
+
The composer includes an AI-powered translation feature that helps automate the translation of form content across multiple languages.
|
|
107
|
+
|
|
108
|
+
### Configuration
|
|
109
|
+
|
|
110
|
+
The AI translation feature needs `translationServiceUrl` to be set in `AppConfig` - it can come from the backend (`config.translationServiceUrl` configuration parameter) or be set manually in the app config (e.g. in `index.html`). This is the URL of the translation service API, including the path to the translation service endpoint.
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
export const appConfig: AppConfig = {
|
|
114
|
+
...
|
|
115
|
+
translationServiceUrl: 'http://localhost:8083/api/translate',
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Key Features
|
|
120
|
+
|
|
121
|
+
- **Automated Translation**: Translate labels, descriptions, validation messages, and value set entries from one language to another using AI
|
|
122
|
+
- **Translation Tracking**: All AI-generated translations are tracked with metadata including:
|
|
123
|
+
- Source and target languages
|
|
124
|
+
- Translation timestamp
|
|
125
|
+
- Translation type (label, description, validation, etc.)
|
|
126
|
+
- **Visual Indicators**: AI-translated content is marked with a visual indicator in the translation editor
|
|
127
|
+
- **Manual Validation**: Users can review AI translations and remove the AI flag once validated
|
|
128
|
+
- **Bulk Operations**: Support for translating entire choice lists and multiple form elements at once
|
|
129
|
+
|
|
130
|
+
### Usage
|
|
131
|
+
|
|
132
|
+
The AI translation feature is available in multiple places in the composer, either for translating single items or in bulk:
|
|
133
|
+
- in the translation dialog (for translating entire form content)
|
|
134
|
+
- in the item options dialog (for translating single items)
|
|
135
|
+
- in the choice editor (for translating value set entries)
|
|
136
|
+
|
|
137
|
+
The source language is always the active form language. Translations can be validated by clicking the AI indicator.
|
|
138
|
+
|
|
104
139
|
### Item type configuration
|
|
105
140
|
|
|
106
141
|
Item type configuration defines the structure of the "Add Item" menu and available item types with their properties and behavior.
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { EditorState } from '..';
|
|
|
7
7
|
import { FunctionComponent } from '../../node_modules/@types/react';
|
|
8
8
|
import { IdField } from '../items/ItemComponents';
|
|
9
9
|
import { Indicators } from '../items/ItemComponents';
|
|
10
|
+
import { default as ItemOptionsDialog } from '../dialogs/ItemOptionsDialog';
|
|
10
11
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
11
12
|
import { LabelField } from '../items/ItemComponents';
|
|
12
13
|
import { LanguageEditor } from '../components/translations/LanguageEditor';
|
|
@@ -173,7 +174,7 @@ declare interface ConfigItemProps {
|
|
|
173
174
|
|
|
174
175
|
export declare const ConfirmationDialog: default_2.FC;
|
|
175
176
|
|
|
176
|
-
declare type ConfirmationDialogType = 'duplicate' | 'delete';
|
|
177
|
+
declare type ConfirmationDialogType = 'duplicate' | 'delete' | 'deleteVariable';
|
|
177
178
|
|
|
178
179
|
declare type ContextVariable = {
|
|
179
180
|
name: string;
|
|
@@ -281,6 +282,7 @@ declare type DialobItemTemplate = {
|
|
|
281
282
|
activeWhen?: string;
|
|
282
283
|
canAddRowWhen?: string;
|
|
283
284
|
canRemoveRowWhen?: string;
|
|
285
|
+
readOnlyWhen?: string;
|
|
284
286
|
items?: string[];
|
|
285
287
|
className?: string[];
|
|
286
288
|
props?: {
|
|
@@ -342,6 +344,8 @@ declare type ErrorSeverity = 'ERROR' | 'WARNING' | 'INFO' | 'FATAL';
|
|
|
342
344
|
|
|
343
345
|
declare namespace ErrorUtils {
|
|
344
346
|
export {
|
|
347
|
+
parseVariableItemId,
|
|
348
|
+
parseRowgroupIdFromVariableItemId,
|
|
345
349
|
getErrorSeverity,
|
|
346
350
|
getItemErrorColor,
|
|
347
351
|
useErrorColorSx,
|
|
@@ -364,6 +368,7 @@ declare interface FlattenedItem extends TreeItem {
|
|
|
364
368
|
depth: number;
|
|
365
369
|
index: number;
|
|
366
370
|
isFallbackLabel?: boolean;
|
|
371
|
+
isVariable?: boolean;
|
|
367
372
|
}
|
|
368
373
|
|
|
369
374
|
declare type FormMetadata = {
|
|
@@ -434,9 +439,9 @@ declare interface ItemConfigItem {
|
|
|
434
439
|
props: ConfigItemProps;
|
|
435
440
|
}
|
|
436
441
|
|
|
437
|
-
export declare const itemFactory: (item: DialobItem, itemConfig: ItemConfig, setHighlightedItem?: (item: DialobItem) => void, props?: any) => JSX_2.Element | null;
|
|
442
|
+
export declare const itemFactory: (item: DialobItem | string, itemConfig: ItemConfig, setHighlightedItem?: (item: DialobItem) => void, props?: any) => JSX_2.Element | null;
|
|
438
443
|
|
|
439
|
-
export
|
|
444
|
+
export { ItemOptionsDialog }
|
|
440
445
|
|
|
441
446
|
declare interface ItemProp {
|
|
442
447
|
key: string;
|
|
@@ -493,6 +498,10 @@ export declare const PageTabs: default_2.FC<{
|
|
|
493
498
|
items: DialobItems;
|
|
494
499
|
}>;
|
|
495
500
|
|
|
501
|
+
declare const parseRowgroupIdFromVariableItemId: (itemId: string) => string | undefined;
|
|
502
|
+
|
|
503
|
+
declare const parseVariableItemId: (itemId: string) => string;
|
|
504
|
+
|
|
496
505
|
export declare const PreviewDialog: default_2.FC<{
|
|
497
506
|
open: boolean;
|
|
498
507
|
onClose: () => void;
|
|
@@ -549,7 +558,7 @@ export declare const RuleEditor: default_3.FC<{
|
|
|
549
558
|
|
|
550
559
|
export declare const RulesEditor: default_3.FC;
|
|
551
560
|
|
|
552
|
-
declare type RuleType = 'visibility' | 'requirement' | 'canaddrow' | 'canremoverow';
|
|
561
|
+
declare type RuleType = 'visibility' | 'requirement' | 'readOnly' | 'canaddrow' | 'canremoverow';
|
|
553
562
|
|
|
554
563
|
declare interface SaveResult {
|
|
555
564
|
ok: boolean;
|
|
@@ -564,6 +573,7 @@ declare interface SavingState {
|
|
|
564
573
|
composerMetadata?: ComposerMetadata;
|
|
565
574
|
variables?: (ContextVariable | Variable)[];
|
|
566
575
|
formMetadata?: FormMetadata;
|
|
576
|
+
items?: DialobItems;
|
|
567
577
|
}
|
|
568
578
|
|
|
569
579
|
export declare const SimpleField: default_2.FC<{
|
|
@@ -630,6 +640,7 @@ declare interface TreeItem {
|
|
|
630
640
|
collapsible?: boolean;
|
|
631
641
|
collapsed?: boolean;
|
|
632
642
|
isFallbackLabel?: boolean;
|
|
643
|
+
isVariable?: boolean;
|
|
633
644
|
}
|
|
634
645
|
|
|
635
646
|
export declare const UploadValuesetDialog: default_2.FC<{
|
|
@@ -666,6 +677,7 @@ export declare const useComposer: () => {
|
|
|
666
677
|
setMetadataValue: (attr: string, value: any) => void;
|
|
667
678
|
setContextValue: (name: string, value: string) => void;
|
|
668
679
|
createVariable: (context: boolean) => void;
|
|
680
|
+
createScopedExpressionVariable: (rowgroupId: string, callbacks?: ComposerCallbacks) => void;
|
|
669
681
|
updateContextVariable: (variableId: string, contextType?: ContextVariableType | string, defaultValue?: any) => void;
|
|
670
682
|
updateExpressionVariable: (variableId: string, expression: string) => void;
|
|
671
683
|
updateVariablePublishing: (variableId: string, published: boolean) => void;
|
|
@@ -697,6 +709,7 @@ export declare const useEditor: () => {
|
|
|
697
709
|
setHighlightedItem: (item?: DialobItem) => void;
|
|
698
710
|
setActiveList: (listId?: string) => void;
|
|
699
711
|
setActiveVariableTab: (tab?: VariableTabType) => void;
|
|
712
|
+
setActiveVariable: (variableId?: string, idEditMode?: boolean) => void;
|
|
700
713
|
setConfirmationActiveItem: (item?: DialobItem) => void;
|
|
701
714
|
toggleItemCollapsed: (itemId: string) => void;
|
|
702
715
|
setMarkdownHelpDialogOpen: (open: boolean) => void;
|