@team-monolith/cds 1.11.3 → 1.12.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.
@@ -15,7 +15,7 @@ export interface Selection {
15
15
  export interface ProblemSelectPayload {
16
16
  selections: Selection[];
17
17
  selected: string[];
18
- hasMultipleAnswers?: boolean;
18
+ hasMultipleAnswers: boolean;
19
19
  key?: NodeKey;
20
20
  }
21
21
  export type SerializedProblemSelectNode = Spread<ProblemSelectPayload, SerializedLexicalNode>;
@@ -26,7 +26,7 @@ export type SerializedProblemSelectNode = Spread<ProblemSelectPayload, Serialize
26
26
  export declare class ProblemSelectNode extends DecoratorNode<ReactNode> {
27
27
  __selections: Selection[];
28
28
  __selected: string[];
29
- __hasMultipleAnswers: boolean | undefined;
29
+ __hasMultipleAnswers: boolean;
30
30
  isInline(): boolean;
31
31
  static getType(): string;
32
32
  getSelections(): Selection[];
@@ -34,7 +34,7 @@ export declare class ProblemSelectNode extends DecoratorNode<ReactNode> {
34
34
  setSelections(selections: Selection[]): void;
35
35
  setSelected(selected: string[]): void;
36
36
  static clone(node: ProblemSelectNode): ProblemSelectNode;
37
- constructor(selections: Selection[], selected: string[], hasMultipleAnswers?: boolean, key?: NodeKey);
37
+ constructor(selections: Selection[], selected: string[], hasMultipleAnswers: boolean, key?: NodeKey);
38
38
  createDOM(config: EditorConfig): HTMLElement;
39
39
  updateDOM(): boolean;
40
40
  static importJSON(serializedNode: SerializedProblemSelectNode): ProblemSelectNode;
@@ -60,6 +60,7 @@ export class ProblemSelectNode extends DecoratorNode {
60
60
  type: "problem-select",
61
61
  selections: this.__selections,
62
62
  selected: this.__selected,
63
+ hasMultipleAnswers: this.__hasMultipleAnswers,
63
64
  };
64
65
  }
65
66
  decorate() {
@@ -4,6 +4,6 @@ import { Selection } from "./ProblemSelectNode";
4
4
  export declare function SelectComponent(props: {
5
5
  selections: Selection[];
6
6
  selected: string[];
7
- hasMultipleAnswers?: boolean;
7
+ hasMultipleAnswers: boolean;
8
8
  nodeKey: NodeKey;
9
9
  }): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -54,7 +54,12 @@ export function SelectComponent(props) {
54
54
  if (!$isProblemSelectNode(node)) {
55
55
  return;
56
56
  }
57
- node.setSelected([...selected, selection.value]);
57
+ if (hasMultipleAnswers) {
58
+ node.setSelected([...selected, selection.value]);
59
+ }
60
+ else {
61
+ node.setSelected([selection.value]);
62
+ }
58
63
  });
59
64
  }
60
65
  }, fullWidth: true }, index)))] }));
@@ -99,6 +99,7 @@ function getQuizContextOptions(editor, theme) {
99
99
  },
100
100
  ],
101
101
  selected: [],
102
+ hasMultipleAnswers: false,
102
103
  });
103
104
  },
104
105
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@team-monolith/cds",
3
- "version": "1.11.3",
3
+ "version": "1.12.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,