@project-sunbird/sunbird-questionset-editor-web-component-react 0.1.15 → 0.1.16

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.
@@ -23,6 +23,15 @@ export interface SparkMetaFormProps {
23
23
  * undefined (i.e. the "Details" tab).
24
24
  */
25
25
  section?: string;
26
+ /**
27
+ * Bypasses the `section` tab logic entirely — every visible field is
28
+ * rendered regardless of its own `section`. For a caller with no tabs at
29
+ * all (the question editor's Details form, the read-only question meta
30
+ * view): omitting `section` there would otherwise mean "show only the
31
+ * untabbed fields" (root's Details-tab meaning), silently dropping any
32
+ * framework-driven category field tagged 'Audience & Curriculum'.
33
+ */
34
+ showAllSections?: boolean;
26
35
  /**
27
36
  * Framework terms keyed by sourceCategory (e.g. "board", "medium",
28
37
  * "gradeLevel", "subject"). When provided, fields whose `sourceCategory`
@@ -33,6 +42,13 @@ export interface SparkMetaFormProps {
33
42
  * — `identifier` is used as the option value, `name` as the visible label.
34
43
  */
35
44
  frameworkTerms?: Map<string, FrameworkTerm[]>;
45
+ /**
46
+ * Category codes in framework order (ascending `index`), from the same
47
+ * `useFramework()` call that produced `frameworkTerms` — see
48
+ * `adaptFieldsForFramework`'s single-vs-multi-select rule below. Only
49
+ * meaningful together with `isRoot`; omit for section/question forms.
50
+ */
51
+ categoryOrder?: string[];
36
52
  /**
37
53
  * True for the root (questionset-level) form only. The "framework" field
38
54
  * (code: 'framework') is special-cased to live-update which framework's
@@ -44,8 +60,12 @@ export interface SparkMetaFormProps {
44
60
  }
45
61
  /** Exported so callers (e.g. ContextualEditor's tab bar) can check whether a
46
62
  * given tab's section has any required field, using the exact same
47
- * matching rule the tab's own <SparkMetaForm section="..."/> render uses. */
48
- export declare function fieldMatchesSection(field: ICategoryField, section?: string): boolean;
63
+ * matching rule the tab's own <SparkMetaForm section="..."/> render uses.
64
+ * `showAllSections` bypasses the tab logic entirely — for a caller with no
65
+ * tabs at all (the question editor's Details form, the read-only question
66
+ * meta view), where "undefined section" must mean "show everything",
67
+ * not "show only the untabbed fields" (root's actual meaning for it). */
68
+ export declare function fieldMatchesSection(field: ICategoryField, section?: string, showAllSections?: boolean): boolean;
49
69
  export declare function findMissingRequiredFields(fields: ICategoryField[], values: Record<string, unknown>): ICategoryField[];
50
70
  export interface SelectOption {
51
71
  value: string;
@@ -1,8 +1,26 @@
1
1
  import { IFramework, ITerm } from '../types/framework';
2
- export declare function useFramework(): {
2
+ /**
3
+ * @param overrideFrameworkId - Resolves categories against this framework
4
+ * instead of the root/live one, fully locally to the caller — e.g. a
5
+ * question that picked its own Framework in its Details form. Does not
6
+ * touch editor.store's contentFramework or affect any other caller; target
7
+ * frameworks still come from root (questions have no targetFWIds concept of
8
+ * their own). Omit for the existing root-level behaviour, unchanged.
9
+ */
10
+ export declare function useFramework(overrideFrameworkId?: string): {
3
11
  orgFramework: NoInfer<IFramework> | undefined;
4
12
  targetFrameworks: IFramework[];
5
13
  isLoading: boolean;
6
14
  targetFrameworkIds: string[];
7
15
  frameworkTerms: Map<string, ITerm[]>;
16
+ categoryOrder: string[];
8
17
  };
18
+ /**
19
+ * Same target-framework precedence useFramework() applies internally
20
+ * (rootMeta.targetFWIds wins over the host-supplied config) — extracted for
21
+ * plain, non-hook code that needs to resolve the same ids without
22
+ * subscribing to store changes (useSaveQuestion.ts, reading straight out of
23
+ * getState() at save time to sweep target frameworks' categories into the
24
+ * taxonomy payload, same as this hook's frameworkTerms merge does).
25
+ */
26
+ export declare function resolveTargetFrameworkIds(): string[];