@dialob/composer-material 0.0.5 → 0.0.6

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.
@@ -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';
@@ -150,6 +157,8 @@ declare type ComposerState = {
150
157
  };
151
158
  };
152
159
 
160
+ declare type ComposerStatus = 'ERROR' | 'WARNING' | 'INFO' | 'FATAL' | 'OK';
161
+
153
162
  declare type ComposerTag = {
154
163
  name: string;
155
164
  formName: string;
@@ -170,6 +179,8 @@ declare interface ConfigItemProps {
170
179
 
171
180
  export declare const ConfirmationDialog: default_2.FC;
172
181
 
182
+ declare type ConfirmationDialogType = 'duplicate' | 'delete';
183
+
173
184
  declare type ContextVariable = {
174
185
  name: string;
175
186
  published?: boolean;
@@ -187,6 +198,8 @@ export declare const ContextVariables: default_2.FC<{
187
198
 
188
199
  declare type ContextVariableType = 'text' | 'number' | 'decimal' | 'boolean' | 'date' | 'time';
189
200
 
201
+ export { ConversionMenu }
202
+
190
203
  export declare const ConvertConfirmationDialog: default_2.FC<{
191
204
  type: 'local' | 'global' | undefined;
192
205
  onClick: () => void;
@@ -328,6 +341,19 @@ declare type EditorError = {
328
341
 
329
342
  declare type ErrorSeverity = 'ERROR' | 'WARNING' | 'INFO' | 'FATAL';
330
343
 
344
+ declare namespace ErrorUtils {
345
+ export {
346
+ getErrorSeverity,
347
+ getItemErrorColor,
348
+ useErrorColorSx,
349
+ useErrorColor,
350
+ getErrorIcon,
351
+ getStatusIcon,
352
+ getStatus
353
+ }
354
+ }
355
+ export { ErrorUtils }
356
+
331
357
  export declare const ExpressionVariableRow: default_2.FC<VariableProps>;
332
358
 
333
359
  export declare const ExpressionVariables: default_2.FC<{
@@ -339,6 +365,16 @@ export declare const FormOptionsDialog: default_2.FC<{
339
365
  onClose: () => void;
340
366
  }>;
341
367
 
368
+ declare const getErrorIcon: (errors: EditorError[] | undefined, itemId: string) => default_2.ReactNode | undefined;
369
+
370
+ declare const getErrorSeverity: (error: EditorError) => AlertColor;
371
+
372
+ declare const getItemErrorColor: (errors: EditorError[] | undefined, itemId: string) => "info" | "warning" | "error" | "primary";
373
+
374
+ declare const getStatus: (errors: EditorError[] | undefined) => ComposerStatus;
375
+
376
+ declare const getStatusIcon: (errors: EditorError[] | undefined) => default_2.ReactElement;
377
+
342
378
  export declare const GlobalList: default_2.FC<{
343
379
  entries?: ValueSetEntry[];
344
380
  }>;
@@ -352,11 +388,15 @@ export declare const Group: default_2.FC<{
352
388
  item: DialobItem;
353
389
  } & Record<string, any>>;
354
390
 
391
+ export { IdField }
392
+
355
393
  declare interface IndexedRule {
356
394
  index: number;
357
395
  validationRule: ValidationRule;
358
396
  }
359
397
 
398
+ export { Indicators }
399
+
360
400
  declare const INIT_STATE: ComposerState;
361
401
 
362
402
  declare const InputProp: (props: any) => JSX_2.Element;
@@ -426,6 +466,10 @@ declare interface OptionEditor {
426
466
  editor: React.FC;
427
467
  }
428
468
 
469
+ export { OptionsMenu }
470
+
471
+ declare type OptionsTabType = 'id' | 'label' | 'description' | 'rules' | 'validations' | 'choices' | 'properties';
472
+
429
473
  export declare const PageTabs: default_2.FC<{
430
474
  items: DialobItems;
431
475
  }>;
@@ -499,6 +543,8 @@ export declare const SimpleField: default_2.FC<{
499
543
  item: DialobItem;
500
544
  } & Record<string, any>>;
501
545
 
546
+ export { StyledTable }
547
+
502
548
  export declare const TranslationDialog: default_2.FC<{
503
549
  open: boolean;
504
550
  onClose: () => void;
@@ -531,6 +577,63 @@ export declare const UploadValuesetDialog: default_2.FC<{
531
577
  setCurrentValueSet: default_2.Dispatch<default_2.SetStateAction<ValueSet | undefined>>;
532
578
  }>;
533
579
 
580
+ export declare const useComposer: () => {
581
+ addItem: (itemTemplate: DialobItemTemplate, parentItemId: string, afterItemId?: string, callbacks?: ComposerCallbacks) => void;
582
+ updateItem: (itemId: string, attribute: string, value: string, language?: string) => void;
583
+ updateLocalizedString: (itemId: string, attribute: string, value: LocalizedString, index?: number) => void;
584
+ changeItemType: (itemId: string, config: DialobItemTemplate) => void;
585
+ deleteItem: (itemId: string) => void;
586
+ setItemProp: (itemId: string, key: string, value: any) => void;
587
+ deleteItemProp: (itemId: string, key: string) => void;
588
+ moveItem: (itemId: string, fromIndex: number, toIndex: number, fromParent: string, toParent: string) => void;
589
+ createValidation: (itemId: string, rule?: ValidationRule) => void;
590
+ setValidationMessage: (itemId: string, index: number, language: string, message: string) => void;
591
+ setValidationExpression: (itemId: string, index: number, expression: string) => void;
592
+ deleteValidation: (itemId: string, index: number) => void;
593
+ createValueSet: (itemId: string | null, entries?: ValueSetEntry[]) => void;
594
+ setValueSetEntries: (valueSetId: string, entries: ValueSetEntry[]) => void;
595
+ addValueSetEntry: (valueSetId: string, entry?: ValueSetEntry) => void;
596
+ updateValueSetEntry: (valueSetId: string, index: number, entry: ValueSetEntry) => void;
597
+ updateValueSetEntryLabel: (valueSetId: string, index: number, text: string | null, language: string) => void;
598
+ deleteValueSetEntry: (valueSetId: string, index: number) => void;
599
+ moveValueSetEntry: (valueSetId: string, from: number, to: number) => void;
600
+ setGlobalValueSetName: (valueSetId: string, name: string) => void;
601
+ deleteGlobalValueSet: (valueSetId: string) => void;
602
+ deleteLocalValueSet: (valueSetId: string) => void;
603
+ setMetadataValue: (attr: string, value: any) => void;
604
+ setContextValue: (name: string, value: string) => void;
605
+ createVariable: (context: boolean) => void;
606
+ updateContextVariable: (variableId: string, contextType: ContextVariableType | string, defaultValue?: any) => void;
607
+ updateExpressionVariable: (variableId: string, expression: string) => void;
608
+ updateVariablePublishing: (variableId: string, published: boolean) => void;
609
+ updateVariableDescription: (variableId: string, description: string) => void;
610
+ deleteVariable: (variableId: string) => void;
611
+ moveVariable: (origin: ContextVariable | Variable, destination: ContextVariable | Variable) => void;
612
+ addLanguage: (language: string, copyFrom?: string) => void;
613
+ deleteLanguage: (language: string) => void;
614
+ setForm: (form: ComposerState, tagName?: string, save?: boolean) => void;
615
+ setRevision: (revision: string) => void;
616
+ form: ComposerState;
617
+ };
618
+
619
+ export declare const useEditor: () => {
620
+ editor: EditorState;
621
+ setActivePage: (page: DialobItem) => void;
622
+ setActiveFormLanguage: (language: string) => void;
623
+ setErrors: (errors: EditorError[]) => void;
624
+ clearErrors: () => void;
625
+ setActiveItem: (item?: DialobItem) => void;
626
+ setConfirmationDialogType: (dialogType?: ConfirmationDialogType) => void;
627
+ setItemOptionsActiveTab: (tab?: OptionsTabType) => void;
628
+ setHighlightedItem: (item?: DialobItem) => void;
629
+ setActiveList: (listId?: string) => void;
630
+ setActiveVariableTab: (tab?: VariableTabType) => void;
631
+ };
632
+
633
+ declare const useErrorColor: (error: EditorError | undefined) => string | undefined;
634
+
635
+ declare const useErrorColorSx: (errors: EditorError[] | undefined, itemId: string) => string | undefined;
636
+
534
637
  declare type ValidationRule = {
535
638
  message?: LocalizedString;
536
639
  rule?: string;
@@ -574,6 +677,8 @@ export declare const VariablesDialog: default_2.FC<{
574
677
  onClose: () => void;
575
678
  }>;
576
679
 
680
+ declare type VariableTabType = 'context' | 'expression';
681
+
577
682
  export declare const VersioningDialog: default_2.FC<{
578
683
  open: boolean;
579
684
  onClose: () => void;