commons-assessment 12.0.32 → 12.0.33
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.
- package/README.md +33 -15
- package/bundles/commons-assessment.umd.js +354 -116
- package/bundles/commons-assessment.umd.js.map +1 -1
- package/esm2015/lib/commons-assessment.module.js +6 -4
- package/esm2015/lib/modules/assessment-maker/assessment-maker.component.js +79 -13
- package/esm2015/lib/modules/assessment-maker/components/add-edit-section-introduction/add-edit-section-introduction.component.js +1 -1
- package/esm2015/lib/modules/assessment-maker/components/assessment-builder/assessment-builder.component.js +15 -4
- package/esm2015/lib/modules/assessment-maker/components/question-details/question-details.component.js +12 -2
- package/esm2015/lib/modules/assessment-maker/services/assessment-maker.service.js +27 -27
- package/esm2015/lib/modules/assessment-taker/assessment-taker.component.js +34 -5
- package/esm2015/lib/modules/assessment-taker/components/question-type-date-picker/question-type-date-picker.component.js +2 -3
- package/esm2015/lib/modules/assessment-taker/components/question-type-editor/question-type-editor.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/components/question-type-file-upload/question-type-file-upload.component.js +5 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-long/question-type-long.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/components/question-type-multiselect/question-type-multiselect.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-objective/question-type-objective.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-preference/question-type-preference.component.js +6 -2
- package/esm2015/lib/modules/assessment-taker/components/question-type-short/question-type-short.component.js +78 -8
- package/esm2015/lib/modules/assessment-taker/components/section-instructions/section-instructions.component.js +1 -1
- package/esm2015/lib/modules/assessment-taker/services/assessment-taker.service.js +27 -27
- package/esm2015/lib/shared/components/confirmation-dialog/confirmation-dialog.component.js +33 -0
- package/esm2015/lib/shared/components/skill-allocation/skill-allocation.component.js +5 -2
- package/esm2015/lib/shared/controllers.js +7 -2
- package/esm2015/lib/shared/material-modules.js +1 -16
- package/esm2015/lib/shared/shared.module.js +8 -3
- package/fesm2015/commons-assessment.js +331 -105
- package/fesm2015/commons-assessment.js.map +1 -1
- package/lib/commons-assessment.module.d.ts +1 -2
- package/lib/modules/assessment-maker/assessment-maker.component.d.ts +12 -1
- package/lib/modules/assessment-maker/components/assessment-builder/assessment-builder.component.d.ts +4 -0
- package/lib/modules/assessment-maker/components/question-details/question-details.component.d.ts +3 -0
- package/lib/modules/assessment-maker/services/assessment-maker.service.d.ts +4 -3
- package/lib/modules/assessment-taker/assessment-taker.component.d.ts +5 -0
- package/lib/modules/assessment-taker/components/question-type-file-upload/question-type-file-upload.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-multiselect/question-type-multiselect.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-objective/question-type-objective.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-preference/question-type-preference.component.d.ts +1 -0
- package/lib/modules/assessment-taker/components/question-type-short/question-type-short.component.d.ts +14 -2
- package/lib/modules/assessment-taker/services/assessment-taker.service.d.ts +4 -3
- package/lib/shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +22 -0
- package/lib/shared/components/skill-allocation/skill-allocation.component.d.ts +1 -0
- package/lib/shared/controllers.d.ts +4 -0
- package/lib/shared/material-modules.d.ts +5 -8
- package/lib/shared/shared.module.d.ts +6 -5
- package/package.json +1 -1
- package/src/lib/assets/json/labelConfig.json +4 -0
- package/src/lib/assets/theme/_theme.scss +226 -567
- package/esm2015/lib/configuration.js +0 -4
- package/lib/configuration.d.ts +0 -5
package/README.md
CHANGED
|
@@ -19,53 +19,70 @@ The library uses Bootstrap styles and requires the following modules to be impor
|
|
|
19
19
|
|
|
20
20
|
### 1. Import Modules
|
|
21
21
|
|
|
22
|
-
Import the
|
|
22
|
+
Import the `CommonsAssessmentModule.forRoot()` in your root `app.module.ts` once to register the singleton service providers. Other modules can then import the specific feature modules as needed:
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
25
|
import { CommonsAssessmentModule, AssessmentMakerModule, AssessmentTakerModule } from 'commons-assessment';
|
|
26
26
|
|
|
27
27
|
@NgModule({
|
|
28
28
|
imports: [
|
|
29
|
-
CommonsAssessmentModule.forRoot(
|
|
30
|
-
baseURL: 'https://dev.platformcommons.org', // Use your backend API base URL
|
|
31
|
-
}),
|
|
29
|
+
CommonsAssessmentModule.forRoot(), // Import once in root app.module
|
|
32
30
|
AssessmentMakerModule,
|
|
33
31
|
AssessmentTakerModule
|
|
34
32
|
]
|
|
35
33
|
})
|
|
36
34
|
```
|
|
37
35
|
|
|
38
|
-
### 2. Configure
|
|
36
|
+
### 2. Configure HTTP Interceptor (Decoupled base URL)
|
|
37
|
+
|
|
38
|
+
Since the library uses relative paths, you must configure an HTTP Interceptor in your application to detect library API requests (which carry the `X-Library-Source: commons-assessment` header), prepend your backend API base URL, and strip the header before forwarding the request.
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { Injectable } from '@angular/core';
|
|
42
|
+
import { HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
|
43
|
+
|
|
44
|
+
@Injectable()
|
|
45
|
+
export class ApiInterceptor implements HttpInterceptor {
|
|
46
|
+
intercept(req: HttpRequest<any>, next: HttpHandler) {
|
|
47
|
+
let headers = req.headers;
|
|
48
|
+
let url = req.url;
|
|
49
|
+
|
|
50
|
+
if (headers.has('X-Library-Source')) {
|
|
51
|
+
headers = headers.delete('X-Library-Source');
|
|
52
|
+
url = 'https://your-api-domain.org' + url; // Prepend your backend base URL
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
req = req.clone({ url, headers });
|
|
56
|
+
return next.handle(req);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Configure `angular.json`
|
|
39
62
|
|
|
40
63
|
Add the necessary assets and global styles in your `angular.json` file inside the `architect.build.options` block.
|
|
41
64
|
|
|
42
65
|
**Assets:**
|
|
43
|
-
Add the library assets
|
|
66
|
+
Add the library assets to the `assets` array.
|
|
44
67
|
```json
|
|
45
68
|
"assets": [
|
|
46
69
|
{
|
|
47
70
|
"glob": "**/*",
|
|
48
71
|
"input": "node_modules/commons-assessment/src/lib/assets",
|
|
49
72
|
"output": "assets/commons-assessment"
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"glob": "**/*",
|
|
53
|
-
"input": "node_modules/@kolkov/angular-editor/assets/icons",
|
|
54
|
-
"output": "assets/ae-icons/"
|
|
55
73
|
}
|
|
56
74
|
]
|
|
57
75
|
```
|
|
58
76
|
|
|
59
77
|
**Styles:**
|
|
60
|
-
Include the library's global styles
|
|
78
|
+
Include the library's global styles in the `styles` array.
|
|
61
79
|
```json
|
|
62
80
|
"styles": [
|
|
63
|
-
"src/styles.scss"
|
|
64
|
-
"node_modules/@kolkov/angular-editor/themes/default.scss"
|
|
81
|
+
"src/styles.scss"
|
|
65
82
|
]
|
|
66
83
|
```
|
|
67
84
|
|
|
68
|
-
###
|
|
85
|
+
### 4. Theming Setup (`styles.scss`)
|
|
69
86
|
|
|
70
87
|
The library provides a mixin to easily customize the theme, including fonts and color variables. Set this up in your application's global `styles.scss`:
|
|
71
88
|
|
|
@@ -142,6 +159,7 @@ export class Component {
|
|
|
142
159
|
| `[predefinedAssessmentInstance]` | `@Input` | `AssessmentInstance` | The default contextual configuration object for creating new assessment instances. |
|
|
143
160
|
| `[minimumRequiredSections]` | `@Input` | `number` | Minimum number of sections needed before assessment can be published. Default is 0. |
|
|
144
161
|
| `[assessmentContext]` | `@Input` | `AssessmentContext` | (Optional) Pre-loaded assessment context data to bypass the initial data load API call. |
|
|
162
|
+
| `[checkForResponses]` | `@Input` | `boolean` | If true, show a warning on deletion of sections and questions if any responses are linked to them. Default is false. |
|
|
145
163
|
| `(assessmentIdChange)` | `@Output` | `EventEmitter<number>` | Emits the new `assessmentId` when an assessment is successfully created. |
|
|
146
164
|
| `(assessmentInstanceIdChange)` | `@Output` | `EventEmitter<number>` | Emits the new instance ID integer when an assessment is published. |
|
|
147
165
|
| `(snackbarMessage)` | `@Output` | `EventEmitter<{ message: string, type: 'success' \| 'error' \| 'info' }>` | Emits message status updates representing errors and workflow successes from the service. |
|