@dialob/composer-material 0.0.5 → 0.0.7
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/dist-lib/index.d.ts +133 -14
- package/dist-lib/index.js +20147 -19888
- package/package.json +1 -3
package/dist-lib/index.d.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
import { AlertColor } from '@mui/material';
|
|
1
2
|
import { Component } from 'react';
|
|
3
|
+
import { ConversionMenu } from '../items/ItemComponents';
|
|
2
4
|
import { default as default_2 } from 'react';
|
|
5
|
+
import { EditorState } from '..';
|
|
3
6
|
import { FunctionComponent } from 'react';
|
|
7
|
+
import { IdField } from '../items/ItemComponents';
|
|
8
|
+
import { Indicators } from '../items/ItemComponents';
|
|
4
9
|
import { ItemId } from '@atlaskit/tree';
|
|
5
10
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
6
11
|
import { LabelField } from '../items/ItemComponents';
|
|
7
12
|
import { LanguageEditor } from '../components/translations/LanguageEditor';
|
|
13
|
+
import { OptionsMenu } from '../items/ItemComponents';
|
|
14
|
+
import { StyledTable } from '../items/ItemComponents';
|
|
8
15
|
import { SvgIconProps } from '@mui/material';
|
|
9
16
|
import { TreeDraggableProvided } from '@atlaskit/tree/dist/types/components/TreeItem/TreeItem-types';
|
|
10
17
|
import { TreeItem } from '@atlaskit/tree';
|
|
@@ -92,19 +99,20 @@ export declare const ChoiceEditor: default_2.FC;
|
|
|
92
99
|
export declare const ChoiceItem: default_2.FC<ChoiceItemProps>;
|
|
93
100
|
|
|
94
101
|
declare interface ChoiceItemProps {
|
|
95
|
-
|
|
102
|
+
entry: ValueSetEntry;
|
|
103
|
+
index: number;
|
|
96
104
|
valueSetId?: string;
|
|
97
|
-
provided: TreeDraggableProvided;
|
|
98
105
|
isGlobal?: boolean;
|
|
99
106
|
onRuleEdit: (entry: ValueSetEntry, rule: string) => void;
|
|
100
107
|
onTextEdit: (entry: ValueSetEntry, label: LocalizedString) => void;
|
|
101
108
|
onDelete: (entry: ValueSetEntry) => void;
|
|
102
109
|
onUpdateId: (entry: ValueSetEntry, id: string) => void;
|
|
110
|
+
onMove?: (entry: ValueSetEntry, direction: 'up' | 'down') => void;
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
export declare const ChoiceList: default_2.FC<{
|
|
106
114
|
valueSet?: ValueSet;
|
|
107
|
-
updateValueSet
|
|
115
|
+
updateValueSet?: (value: default_2.SetStateAction<ValueSet | undefined>) => void;
|
|
108
116
|
isGlobal?: boolean;
|
|
109
117
|
}>;
|
|
110
118
|
|
|
@@ -114,6 +122,16 @@ declare type ComposerCallbacks = {
|
|
|
114
122
|
onAddItem?: (state: ComposerState, item: DialobItem) => void;
|
|
115
123
|
};
|
|
116
124
|
|
|
125
|
+
declare type ComposerMetadata = {
|
|
126
|
+
globalValueSets?: {
|
|
127
|
+
label?: string;
|
|
128
|
+
valueSetId: string;
|
|
129
|
+
}[];
|
|
130
|
+
contextValues?: {
|
|
131
|
+
[name: string]: string;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
117
135
|
declare type ComposerState = {
|
|
118
136
|
_id?: string;
|
|
119
137
|
_rev?: string;
|
|
@@ -137,19 +155,13 @@ declare type ComposerState = {
|
|
|
137
155
|
valid?: boolean;
|
|
138
156
|
created?: string;
|
|
139
157
|
lastSaved?: string;
|
|
140
|
-
composer?:
|
|
141
|
-
globalValueSets?: {
|
|
142
|
-
label?: string;
|
|
143
|
-
valueSetId: string;
|
|
144
|
-
}[];
|
|
145
|
-
contextValues?: {
|
|
146
|
-
[name: string]: string;
|
|
147
|
-
};
|
|
148
|
-
};
|
|
158
|
+
composer?: ComposerMetadata;
|
|
149
159
|
[prop: string]: any;
|
|
150
160
|
};
|
|
151
161
|
};
|
|
152
162
|
|
|
163
|
+
declare type ComposerStatus = 'ERROR' | 'WARNING' | 'INFO' | 'FATAL' | 'OK';
|
|
164
|
+
|
|
153
165
|
declare type ComposerTag = {
|
|
154
166
|
name: string;
|
|
155
167
|
formName: string;
|
|
@@ -170,6 +182,8 @@ declare interface ConfigItemProps {
|
|
|
170
182
|
|
|
171
183
|
export declare const ConfirmationDialog: default_2.FC;
|
|
172
184
|
|
|
185
|
+
declare type ConfirmationDialogType = 'duplicate' | 'delete';
|
|
186
|
+
|
|
173
187
|
declare type ContextVariable = {
|
|
174
188
|
name: string;
|
|
175
189
|
published?: boolean;
|
|
@@ -187,6 +201,8 @@ export declare const ContextVariables: default_2.FC<{
|
|
|
187
201
|
|
|
188
202
|
declare type ContextVariableType = 'text' | 'number' | 'decimal' | 'boolean' | 'date' | 'time';
|
|
189
203
|
|
|
204
|
+
export { ConversionMenu }
|
|
205
|
+
|
|
190
206
|
export declare const ConvertConfirmationDialog: default_2.FC<{
|
|
191
207
|
type: 'local' | 'global' | undefined;
|
|
192
208
|
onClick: () => void;
|
|
@@ -299,6 +315,7 @@ declare namespace DialobTypes {
|
|
|
299
315
|
DialobItems,
|
|
300
316
|
VisibilityType,
|
|
301
317
|
ComposerTag,
|
|
318
|
+
ComposerMetadata,
|
|
302
319
|
ComposerState,
|
|
303
320
|
INIT_STATE,
|
|
304
321
|
ComposerCallbacks
|
|
@@ -328,6 +345,19 @@ declare type EditorError = {
|
|
|
328
345
|
|
|
329
346
|
declare type ErrorSeverity = 'ERROR' | 'WARNING' | 'INFO' | 'FATAL';
|
|
330
347
|
|
|
348
|
+
declare namespace ErrorUtils {
|
|
349
|
+
export {
|
|
350
|
+
getErrorSeverity,
|
|
351
|
+
getItemErrorColor,
|
|
352
|
+
useErrorColorSx,
|
|
353
|
+
useErrorColor,
|
|
354
|
+
getErrorIcon,
|
|
355
|
+
getStatusIcon,
|
|
356
|
+
getStatus
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
export { ErrorUtils }
|
|
360
|
+
|
|
331
361
|
export declare const ExpressionVariableRow: default_2.FC<VariableProps>;
|
|
332
362
|
|
|
333
363
|
export declare const ExpressionVariables: default_2.FC<{
|
|
@@ -339,6 +369,16 @@ export declare const FormOptionsDialog: default_2.FC<{
|
|
|
339
369
|
onClose: () => void;
|
|
340
370
|
}>;
|
|
341
371
|
|
|
372
|
+
declare const getErrorIcon: (errors: EditorError[] | undefined, itemId: string) => default_2.ReactNode | undefined;
|
|
373
|
+
|
|
374
|
+
declare const getErrorSeverity: (error: EditorError) => AlertColor;
|
|
375
|
+
|
|
376
|
+
declare const getItemErrorColor: (errors: EditorError[] | undefined, itemId: string) => "info" | "warning" | "error" | "primary";
|
|
377
|
+
|
|
378
|
+
declare const getStatus: (errors: EditorError[] | undefined) => ComposerStatus;
|
|
379
|
+
|
|
380
|
+
declare const getStatusIcon: (errors: EditorError[] | undefined) => default_2.ReactElement;
|
|
381
|
+
|
|
342
382
|
export declare const GlobalList: default_2.FC<{
|
|
343
383
|
entries?: ValueSetEntry[];
|
|
344
384
|
}>;
|
|
@@ -352,11 +392,15 @@ export declare const Group: default_2.FC<{
|
|
|
352
392
|
item: DialobItem;
|
|
353
393
|
} & Record<string, any>>;
|
|
354
394
|
|
|
395
|
+
export { IdField }
|
|
396
|
+
|
|
355
397
|
declare interface IndexedRule {
|
|
356
398
|
index: number;
|
|
357
399
|
validationRule: ValidationRule;
|
|
358
400
|
}
|
|
359
401
|
|
|
402
|
+
export { Indicators }
|
|
403
|
+
|
|
360
404
|
declare const INIT_STATE: ComposerState;
|
|
361
405
|
|
|
362
406
|
declare const InputProp: (props: any) => JSX_2.Element;
|
|
@@ -426,6 +470,10 @@ declare interface OptionEditor {
|
|
|
426
470
|
editor: React.FC;
|
|
427
471
|
}
|
|
428
472
|
|
|
473
|
+
export { OptionsMenu }
|
|
474
|
+
|
|
475
|
+
declare type OptionsTabType = 'id' | 'label' | 'description' | 'rules' | 'validations' | 'choices' | 'properties';
|
|
476
|
+
|
|
429
477
|
export declare const PageTabs: default_2.FC<{
|
|
430
478
|
items: DialobItems;
|
|
431
479
|
}>;
|
|
@@ -495,10 +543,19 @@ declare interface SaveResult {
|
|
|
495
543
|
errors: EditorError[];
|
|
496
544
|
}
|
|
497
545
|
|
|
546
|
+
declare interface SavingState {
|
|
547
|
+
item?: DialobItem;
|
|
548
|
+
valueSets?: ValueSet[];
|
|
549
|
+
composerMetadata?: ComposerMetadata;
|
|
550
|
+
variables?: (ContextVariable | Variable)[];
|
|
551
|
+
}
|
|
552
|
+
|
|
498
553
|
export declare const SimpleField: default_2.FC<{
|
|
499
554
|
item: DialobItem;
|
|
500
555
|
} & Record<string, any>>;
|
|
501
556
|
|
|
557
|
+
export { StyledTable }
|
|
558
|
+
|
|
502
559
|
export declare const TranslationDialog: default_2.FC<{
|
|
503
560
|
open: boolean;
|
|
504
561
|
onClose: () => void;
|
|
@@ -531,6 +588,66 @@ export declare const UploadValuesetDialog: default_2.FC<{
|
|
|
531
588
|
setCurrentValueSet: default_2.Dispatch<default_2.SetStateAction<ValueSet | undefined>>;
|
|
532
589
|
}>;
|
|
533
590
|
|
|
591
|
+
export declare const useComposer: () => {
|
|
592
|
+
addItem: (itemTemplate: DialobItemTemplate, parentItemId: string, afterItemId?: string, callbacks?: ComposerCallbacks) => void;
|
|
593
|
+
updateItem: (itemId: string, attribute: string, value: string, language?: string) => void;
|
|
594
|
+
updateLocalizedString: (itemId: string, attribute: string, value: LocalizedString, index?: number) => void;
|
|
595
|
+
changeItemType: (itemId: string, config: DialobItemTemplate) => void;
|
|
596
|
+
deleteItem: (itemId: string) => void;
|
|
597
|
+
setItemProp: (itemId: string, key: string, value: any) => void;
|
|
598
|
+
deleteItemProp: (itemId: string, key: string) => void;
|
|
599
|
+
moveItem: (itemId: string, fromIndex: number, toIndex: number, fromParent: string, toParent: string) => void;
|
|
600
|
+
createValidation: (itemId: string, rule?: ValidationRule) => void;
|
|
601
|
+
setValidationMessage: (itemId: string, index: number, language: string, message: string) => void;
|
|
602
|
+
setValidationExpression: (itemId: string, index: number, expression: string) => void;
|
|
603
|
+
deleteValidation: (itemId: string, index: number) => void;
|
|
604
|
+
createValueSet: (itemId: string | null, entries?: ValueSetEntry[]) => void;
|
|
605
|
+
setValueSetEntries: (valueSetId: string, entries: ValueSetEntry[]) => void;
|
|
606
|
+
addValueSetEntry: (valueSetId: string, entry?: ValueSetEntry) => void;
|
|
607
|
+
updateValueSetEntry: (valueSetId: string, index: number, entry: ValueSetEntry) => void;
|
|
608
|
+
updateValueSetEntryLabel: (valueSetId: string, index: number, text: string | null, language: string) => void;
|
|
609
|
+
deleteValueSetEntry: (valueSetId: string, index: number) => void;
|
|
610
|
+
moveValueSetEntry: (valueSetId: string, from: number, to: number) => void;
|
|
611
|
+
setGlobalValueSetName: (valueSetId: string, name: string) => void;
|
|
612
|
+
deleteGlobalValueSet: (valueSetId: string) => void;
|
|
613
|
+
deleteLocalValueSet: (valueSetId: string) => void;
|
|
614
|
+
setMetadataValue: (attr: string, value: any) => void;
|
|
615
|
+
setContextValue: (name: string, value: string) => void;
|
|
616
|
+
createVariable: (context: boolean) => void;
|
|
617
|
+
updateContextVariable: (variableId: string, contextType?: ContextVariableType | string, defaultValue?: any) => void;
|
|
618
|
+
updateExpressionVariable: (variableId: string, expression: string) => void;
|
|
619
|
+
updateVariablePublishing: (variableId: string, published: boolean) => void;
|
|
620
|
+
updateVariableDescription: (variableId: string, description: string) => void;
|
|
621
|
+
deleteVariable: (variableId: string) => void;
|
|
622
|
+
moveVariable: (origin: ContextVariable | Variable, destination: ContextVariable | Variable) => void;
|
|
623
|
+
addLanguage: (language: string, copyFrom?: string) => void;
|
|
624
|
+
deleteLanguage: (language: string) => void;
|
|
625
|
+
setForm: (form: ComposerState, tagName?: string, save?: boolean) => void;
|
|
626
|
+
setRevision: (revision: string) => void;
|
|
627
|
+
applyItemChanges: (newState: SavingState) => void;
|
|
628
|
+
applyListChanges: (newState: SavingState) => void;
|
|
629
|
+
applyVariableChanges: (newState: SavingState) => void;
|
|
630
|
+
form: ComposerState;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
export declare const useEditor: () => {
|
|
634
|
+
editor: EditorState;
|
|
635
|
+
setActivePage: (page: DialobItem) => void;
|
|
636
|
+
setActiveFormLanguage: (language: string) => void;
|
|
637
|
+
setErrors: (errors: EditorError[]) => void;
|
|
638
|
+
clearErrors: () => void;
|
|
639
|
+
setActiveItem: (item?: DialobItem) => void;
|
|
640
|
+
setConfirmationDialogType: (dialogType?: ConfirmationDialogType) => void;
|
|
641
|
+
setItemOptionsActiveTab: (tab?: OptionsTabType) => void;
|
|
642
|
+
setHighlightedItem: (item?: DialobItem) => void;
|
|
643
|
+
setActiveList: (listId?: string) => void;
|
|
644
|
+
setActiveVariableTab: (tab?: VariableTabType) => void;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
declare const useErrorColor: (error: EditorError | undefined) => string | undefined;
|
|
648
|
+
|
|
649
|
+
declare const useErrorColorSx: (errors: EditorError[] | undefined, itemId: string) => string | undefined;
|
|
650
|
+
|
|
534
651
|
declare type ValidationRule = {
|
|
535
652
|
message?: LocalizedString;
|
|
536
653
|
rule?: string;
|
|
@@ -564,8 +681,8 @@ declare type Variable = {
|
|
|
564
681
|
};
|
|
565
682
|
|
|
566
683
|
declare interface VariableProps {
|
|
567
|
-
|
|
568
|
-
|
|
684
|
+
index: number;
|
|
685
|
+
item: Variable | ContextVariable;
|
|
569
686
|
onClose: () => void;
|
|
570
687
|
}
|
|
571
688
|
|
|
@@ -574,6 +691,8 @@ export declare const VariablesDialog: default_2.FC<{
|
|
|
574
691
|
onClose: () => void;
|
|
575
692
|
}>;
|
|
576
693
|
|
|
694
|
+
declare type VariableTabType = 'context' | 'expression';
|
|
695
|
+
|
|
577
696
|
export declare const VersioningDialog: default_2.FC<{
|
|
578
697
|
open: boolean;
|
|
579
698
|
onClose: () => void;
|