@dialob/composer-material 0.0.6 → 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.
@@ -99,19 +99,20 @@ export declare const ChoiceEditor: default_2.FC;
99
99
  export declare const ChoiceItem: default_2.FC<ChoiceItemProps>;
100
100
 
101
101
  declare interface ChoiceItemProps {
102
- item: TreeItem;
102
+ entry: ValueSetEntry;
103
+ index: number;
103
104
  valueSetId?: string;
104
- provided: TreeDraggableProvided;
105
105
  isGlobal?: boolean;
106
106
  onRuleEdit: (entry: ValueSetEntry, rule: string) => void;
107
107
  onTextEdit: (entry: ValueSetEntry, label: LocalizedString) => void;
108
108
  onDelete: (entry: ValueSetEntry) => void;
109
109
  onUpdateId: (entry: ValueSetEntry, id: string) => void;
110
+ onMove?: (entry: ValueSetEntry, direction: 'up' | 'down') => void;
110
111
  }
111
112
 
112
113
  export declare const ChoiceList: default_2.FC<{
113
114
  valueSet?: ValueSet;
114
- updateValueSet: (value: default_2.SetStateAction<ValueSet | undefined>) => void;
115
+ updateValueSet?: (value: default_2.SetStateAction<ValueSet | undefined>) => void;
115
116
  isGlobal?: boolean;
116
117
  }>;
117
118
 
@@ -121,6 +122,16 @@ declare type ComposerCallbacks = {
121
122
  onAddItem?: (state: ComposerState, item: DialobItem) => void;
122
123
  };
123
124
 
125
+ declare type ComposerMetadata = {
126
+ globalValueSets?: {
127
+ label?: string;
128
+ valueSetId: string;
129
+ }[];
130
+ contextValues?: {
131
+ [name: string]: string;
132
+ };
133
+ };
134
+
124
135
  declare type ComposerState = {
125
136
  _id?: string;
126
137
  _rev?: string;
@@ -144,15 +155,7 @@ declare type ComposerState = {
144
155
  valid?: boolean;
145
156
  created?: string;
146
157
  lastSaved?: string;
147
- composer?: {
148
- globalValueSets?: {
149
- label?: string;
150
- valueSetId: string;
151
- }[];
152
- contextValues?: {
153
- [name: string]: string;
154
- };
155
- };
158
+ composer?: ComposerMetadata;
156
159
  [prop: string]: any;
157
160
  };
158
161
  };
@@ -312,6 +315,7 @@ declare namespace DialobTypes {
312
315
  DialobItems,
313
316
  VisibilityType,
314
317
  ComposerTag,
318
+ ComposerMetadata,
315
319
  ComposerState,
316
320
  INIT_STATE,
317
321
  ComposerCallbacks
@@ -539,6 +543,13 @@ declare interface SaveResult {
539
543
  errors: EditorError[];
540
544
  }
541
545
 
546
+ declare interface SavingState {
547
+ item?: DialobItem;
548
+ valueSets?: ValueSet[];
549
+ composerMetadata?: ComposerMetadata;
550
+ variables?: (ContextVariable | Variable)[];
551
+ }
552
+
542
553
  export declare const SimpleField: default_2.FC<{
543
554
  item: DialobItem;
544
555
  } & Record<string, any>>;
@@ -603,7 +614,7 @@ export declare const useComposer: () => {
603
614
  setMetadataValue: (attr: string, value: any) => void;
604
615
  setContextValue: (name: string, value: string) => void;
605
616
  createVariable: (context: boolean) => void;
606
- updateContextVariable: (variableId: string, contextType: ContextVariableType | string, defaultValue?: any) => void;
617
+ updateContextVariable: (variableId: string, contextType?: ContextVariableType | string, defaultValue?: any) => void;
607
618
  updateExpressionVariable: (variableId: string, expression: string) => void;
608
619
  updateVariablePublishing: (variableId: string, published: boolean) => void;
609
620
  updateVariableDescription: (variableId: string, description: string) => void;
@@ -613,6 +624,9 @@ export declare const useComposer: () => {
613
624
  deleteLanguage: (language: string) => void;
614
625
  setForm: (form: ComposerState, tagName?: string, save?: boolean) => void;
615
626
  setRevision: (revision: string) => void;
627
+ applyItemChanges: (newState: SavingState) => void;
628
+ applyListChanges: (newState: SavingState) => void;
629
+ applyVariableChanges: (newState: SavingState) => void;
616
630
  form: ComposerState;
617
631
  };
618
632
 
@@ -667,8 +681,8 @@ declare type Variable = {
667
681
  };
668
682
 
669
683
  declare interface VariableProps {
670
- item: TreeItem;
671
- provided: TreeDraggableProvided;
684
+ index: number;
685
+ item: Variable | ContextVariable;
672
686
  onClose: () => void;
673
687
  }
674
688