@project-sunbird/sunbird-questionset-editor-web-component-react 0.1.21 → 0.1.22-alpha

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.
@@ -0,0 +1,15 @@
1
+ import { CompetencyCategoryWire } from '../utils/competencyLeaves';
2
+ export interface ICompetencyFrameworkSummary {
3
+ identifier: string;
4
+ name: string;
5
+ }
6
+ /**
7
+ * Live skill (competency) frameworks of the channel - `CompetencyFramework` objects, which never
8
+ * appear in the curriculum Framework list. Filtered by channel, as the course and content editors do:
9
+ * the X-Channel-Id header alone doesn't narrow the search, so other channels' frameworks would show.
10
+ */
11
+ export declare function listCompetencyFrameworks(channel?: string): Promise<ICompetencyFrameworkSummary[]>;
12
+ /** A skill framework with its categories and terms. */
13
+ export declare function getCompetencyFramework(frameworkId: string): Promise<{
14
+ categories?: CompetencyCategoryWire[];
15
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,6 @@
1
1
  import { IContent } from '../types/content';
2
+ /** Fields the library asks search for by default. */
3
+ export declare const DEFAULT_SEARCH_FIELDS: string[];
2
4
  export declare function compositeSearch(params: {
3
5
  filters?: Record<string, unknown>;
4
6
  query?: string;
@@ -39,6 +39,10 @@ export declare const URLS: {
39
39
  readonly composite: {
40
40
  readonly search: "composite/v3/search";
41
41
  };
42
+ /** Skill (competency) frameworks: `CompetencyFramework` objects, which `framework/v1/read` 404s on. */
43
+ readonly competencyFramework: {
44
+ readonly read: "competency-framework/v3/read";
45
+ };
42
46
  readonly framework: {
43
47
  readonly read: "framework/v1/read";
44
48
  readonly termRead: "framework/v1/term/read";
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { IContent } from '../../types/content';
3
+ /**
4
+ * A library question's skills under the set's skill framework, the set's own skills first and
5
+ * highlighted. Renders nothing when the question carries none of that framework's skills.
6
+ */
7
+ export declare const SkillChips: React.FC<{
8
+ item: IContent;
9
+ cap?: number;
10
+ className?: string;
11
+ }>;
12
+ export default SkillChips;
@@ -0,0 +1,22 @@
1
+ import { default as React } from 'react';
2
+ export interface SkillFrameworkFieldsProps {
3
+ /** The chosen skill framework id (`competencyFramework`). */
4
+ frameworkId: string | undefined;
5
+ /**
6
+ * Called with the new framework id. Omit it to show the framework read-only - a question follows
7
+ * its question set's skill framework.
8
+ */
9
+ onFrameworkChange?: (frameworkId: string) => void;
10
+ /** Metadata of the node being edited, to read its current skills from the framework's field. */
11
+ values: Record<string, unknown>;
12
+ /** Called with the framework's skill field (`skill`, `cuisine`, ...) and the picked skill codes. */
13
+ onSkillsChange: (skillField: string, codes: string[]) => void;
14
+ readOnly?: boolean;
15
+ idPrefix: string;
16
+ }
17
+ /**
18
+ * "Skill framework" + "Skills": tags a question set or question with a skill framework's skills,
19
+ * saved as codes under that framework's own field (its last category's code), as lern reads them.
20
+ */
21
+ export declare const SkillFrameworkFields: React.FC<SkillFrameworkFieldsProps>;
22
+ export default SkillFrameworkFields;
@@ -74,6 +74,16 @@ export interface SelectOption {
74
74
  label: string;
75
75
  }
76
76
  export declare function adaptFieldsForFramework(fields: ICategoryField[], frameworkTerms: Map<string, FrameworkTerm[]> | undefined, categoryOrder: string[] | undefined, isRoot: boolean, isDynamicAssess: boolean): ICategoryField[];
77
+ interface MultiSelectSearchProps {
78
+ fieldId: string;
79
+ value: string[];
80
+ options: SelectOption[];
81
+ onChange: (v: string[]) => void;
82
+ readOnly?: boolean;
83
+ placeholder?: string;
84
+ hasError?: boolean;
85
+ }
86
+ export declare const MultiSelectSearch: React.FC<MultiSelectSearchProps>;
77
87
  export interface SingleSelectDropdownProps {
78
88
  fieldId: string;
79
89
  value: string;
@@ -1,4 +1,35 @@
1
1
  import { LibraryFilters } from '../store/library.store';
2
+ import { IContent } from '../types/content';
3
+ /**
4
+ * Filters for the questions that teach the set's skills: the set's skill framework, and at least
5
+ * one of its skills under the framework's own field (a list means "any of").
6
+ */
7
+ export declare function buildSetLibraryFilters(frameworkId: string, skillField: string, skills: string[]): Record<string, unknown>;
8
+ /**
9
+ * The "Other questions" list: everything the plain browse found except what carries one of the
10
+ * set's skills, which is exactly what the matching list shows.
11
+ */
12
+ export declare function selectOtherQuestions(others: IContent[], frameworkId: string, skillField: string, skills: string[]): IContent[];
13
+ /**
14
+ * How many "Other questions" there are: the plain browse's count less the matching ones, which the
15
+ * plain browse also finds (it is the same search without the skill filter).
16
+ *
17
+ * Not done server-side: composite search can exclude the skill codes (`{ [skillField]: { '!=': codes } }`),
18
+ * but not "this framework AND these codes" together, and the skill field (`skill`) is shared with
19
+ * curriculum frameworks, so another framework's question carrying the same code would vanish too.
20
+ */
21
+ export declare function otherQuestionsTotal(otherCount: number, matchedCount: number): number;
22
+ /**
23
+ * Fields each library search asks for: the defaults plus the skill framework and its skill field
24
+ * once the set's framework is known, so rows can show their skills and "Other questions" can drop
25
+ * the matching ones.
26
+ */
27
+ export declare function librarySearchFields(skillField: string | undefined): string[] | undefined;
28
+ /** The hint above the library: ask for the set's skills when it has none yet and the channel offers frameworks. */
29
+ export declare function setLibraryHint(opts: {
30
+ ready: boolean;
31
+ hasFrameworks: boolean;
32
+ }): 'pickSkills' | null;
2
33
  /**
3
34
  * Re-run the library search with whatever query/filter is currently active —
4
35
  * e.g. after a new standalone question is created, so it shows up without
@@ -7,7 +38,16 @@ import { LibraryFilters } from '../store/library.store';
7
38
  */
8
39
  export declare function refreshLibrary(): void;
9
40
  export declare function useLibrary(): {
10
- content: import('../types/content').IContent[];
41
+ content: IContent[];
42
+ /** The main list holds the questions tagged with the set's skills. */
43
+ skillMatched: boolean;
44
+ otherContent: IContent[];
45
+ /** All "Other questions", not just the loaded ones. */
46
+ otherTotal: number;
47
+ hasMoreOther: boolean;
48
+ otherLoading: boolean;
49
+ loadMoreOther: () => void;
50
+ hint: "pickSkills" | null;
11
51
  isLoading: boolean;
12
52
  totalCount: number;
13
53
  activeFilter: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,10 @@
1
+ /**
2
+ * A category value as the question API stores it. Categories are lists, except `board`: the
3
+ * Question schema keeps it as one string, and a non-empty list there makes question/v2/create and
4
+ * update hang until the gateway times out (a 500 after 30s, with no error from the service). An
5
+ * empty list still clears it, so a stale board is cleared the same way as the other categories.
6
+ */
7
+ export declare function toQuestionCategoryValue(field: string, v: unknown): unknown;
1
8
  export declare function buildLiveQuestionMeta(): {
2
9
  questionName: string;
3
10
  questionMeta: Record<string, unknown>;
@@ -0,0 +1,55 @@
1
+ import { ICompetencyFrameworkSummary } from '../api/competencyFramework';
2
+ import { CompetencySkill } from '../utils/competencyLeaves';
3
+ /** The metadata field a question set / question names its skill framework in (as lern reads it). */
4
+ export declare const SKILL_FRAMEWORK_FIELD = "competencyFramework";
5
+ /** The channel's Live skill frameworks - options for "Skill framework". */
6
+ export declare function useSkillFrameworkOptions(): ICompetencyFrameworkSummary[];
7
+ /**
8
+ * One skill framework's skills (its last category's terms) and `skillField`, the field they are
9
+ * saved in (that category's code: `skill`, `cuisine`, ...) - the rule lern reads them by.
10
+ */
11
+ export declare function useSkillFrameworkSkills(frameworkId: string | undefined): {
12
+ skills: CompetencySkill[];
13
+ skillField: string | undefined;
14
+ };
15
+ /**
16
+ * The skill field of a skill framework already in the query cache. The cache drops a framework no
17
+ * component has used for a while, so code that writes data calls `loadSkillFramework` first.
18
+ */
19
+ export declare function cachedSkillField(frameworkId: string | undefined): string | undefined;
20
+ /**
21
+ * Loads a skill framework into the query cache if it isn't there, so `cachedSkillField` can answer.
22
+ * Resolves false when it can't be read; callers then leave the skill field alone rather than guess.
23
+ */
24
+ export declare function loadSkillFramework(frameworkId: string | undefined): Promise<boolean>;
25
+ /**
26
+ * Editor-only key on a question's unsaved metadata: the skill framework it was re-tagged away from, so the save can
27
+ * clear that framework's skills. Never sent to the server (the question payload only takes known fields).
28
+ */
29
+ export declare const MOVED_FROM_SKILL_FRAMEWORK = "_movedFromSkillFramework";
30
+ /** A stored skill value as a list of codes (a field may hold one code or a list). */
31
+ export declare const asCodes: (v: unknown) => string[];
32
+ type RootNode = {
33
+ identifier: string;
34
+ metadata?: Record<string, unknown>;
35
+ };
36
+ /** The question set's skill framework; every question follows it. */
37
+ export declare function useSetSkillFramework(): string | undefined;
38
+ /** The question set's skill framework, its skill field and the skills chosen on it. */
39
+ export interface SetSkills {
40
+ frameworkId?: string;
41
+ skillField?: string;
42
+ skills: string[];
43
+ /** A framework whose skills have loaded, and at least one skill chosen: the library can match on it. */
44
+ ready: boolean;
45
+ }
46
+ /**
47
+ * The set's skills from its root node, edits first then saved metadata. `skillFieldOf` gives a
48
+ * framework's skill field, undefined until the framework loads.
49
+ */
50
+ export declare function resolveSetSkills(root: RootNode | undefined, treeCache: Record<string, Record<string, unknown> | undefined>, skillFieldOf: (frameworkId: string) => string | undefined): SetSkills;
51
+ /** The set's skills right now, for code outside React (the library search). */
52
+ export declare function currentSetSkills(): SetSkills;
53
+ /** The set's skills, kept current; also loads the set's framework so its skill field is known. */
54
+ export declare function useSetSkills(): SetSkills;
55
+ export {};
@@ -0,0 +1 @@
1
+ export {};