@sparkle-learning/core 0.0.53 → 0.0.55
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/dist/cjs/{PrivateRoute-074c584e.js → PrivateRoute-f97245ce.js} +18 -30
- package/dist/cjs/{feed.service-b4f09441.js → appdata.service-c8d71e05.js} +4 -56
- package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
- package/dist/cjs/assignment.service-690fb59c.js +19 -0
- package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
- package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-ff0e1659.js} +1 -1
- package/dist/cjs/feed.service-8eca4de6.js +57 -0
- package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +76 -87
- package/dist/cjs/{httpService-7211d93b.js → httpService-d2e7bf8f.js} +13 -11
- package/dist/cjs/index.cjs.js +5 -4
- package/dist/cjs/{ion-action-sheet_4.cjs.entry.js → ion-action-sheet_7.cjs.entry.js} +728 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/media.service-8a1b9bc5.js +40 -0
- package/dist/cjs/{signalR.service-5672eebc.js → signalR.service-bd6b42f9.js} +18 -20
- package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-assignment.cjs.entry.js +110 -0
- package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
- package/dist/cjs/sparkle-core.cjs.js +1 -1
- package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +20 -11
- package/dist/cjs/sparkle-discussion.cjs.entry.js +6 -4
- package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
- package/dist/cjs/sparkle-feed-post.cjs.entry.js +116 -0
- package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
- package/dist/cjs/sparkle-file-upload.cjs.entry.js +53 -0
- package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
- package/dist/cjs/sparkle-input.cjs.entry.js +56 -0
- package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
- package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
- package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
- package/dist/cjs/{student.service-2e58f237.js → student.service-7e5385be.js} +1 -1
- package/dist/cjs/token.service-7a41953d.js +97 -0
- package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
- package/dist/collection/PrivateRoute.js +2 -2
- package/dist/collection/collection-manifest.json +5 -2
- package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
- package/dist/collection/components/layout/page/page.css +4 -0
- package/dist/collection/components/layout/page/page.js +39 -26
- package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +30 -0
- package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +159 -0
- package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
- package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
- package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +13 -2
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +4 -2
- package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +15 -9
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
- package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +5 -3
- package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -75
- package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.css +0 -0
- package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.js +105 -0
- package/dist/collection/components/sparkle-input/sparkle-input.css +0 -0
- package/dist/collection/components/sparkle-input/sparkle-input.js +212 -0
- package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
- package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
- package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
- package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
- package/dist/collection/services/assignment.service.js +14 -0
- package/dist/collection/services/auth/auth.service.js +15 -14
- package/dist/collection/services/environment/environment-config.js +1 -1
- package/dist/collection/services/environment/environment-config.service.js +0 -1
- package/dist/collection/services/httpService.js +12 -10
- package/dist/collection/services/signalR.service.js +17 -19
- package/dist/collection/services/token.service.js +79 -0
- package/dist/collection/util.js +5 -2
- package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-90ac95b8.js} +17 -29
- package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-2e84e167.js} +5 -55
- package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
- package/dist/esm/assignment.service-8d31f141.js +17 -0
- package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
- package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-18c47bdf.js} +1 -1
- package/dist/esm/feed.service-b4f3cae4.js +54 -0
- package/dist/esm/header-mobile-collapse_61.entry.js +71 -82
- package/dist/esm/{httpService-7b75b095.js → httpService-7986aeed.js} +14 -12
- package/dist/esm/index.js +6 -5
- package/dist/esm/{ion-action-sheet_4.entry.js → ion-action-sheet_7.entry.js} +729 -4
- package/dist/esm/ion-loading.entry.js +1 -1
- package/dist/esm/ion-menu.entry.js +1 -1
- package/dist/esm/ion-modal.entry.js +1 -1
- package/dist/esm/ion-picker.entry.js +1 -1
- package/dist/esm/ion-toast.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/media.service-6e90bc41.js +37 -0
- package/dist/esm/{overlays-3b4dca92.js → overlays-4233a39d.js} +1 -1
- package/dist/esm/{signalR.service-9d5b9f36.js → signalR.service-c33fba50.js} +18 -20
- package/dist/esm/sparkle-animation-player.entry.js +1 -1
- package/dist/esm/sparkle-assignment.entry.js +106 -0
- package/dist/esm/sparkle-character-intro.entry.js +3 -3
- package/dist/esm/sparkle-core.js +1 -1
- package/dist/esm/sparkle-discussion-questions_2.entry.js +20 -11
- package/dist/esm/sparkle-discussion.entry.js +6 -4
- package/dist/esm/sparkle-facilitator-notes-form.entry.js +6 -4
- package/dist/esm/sparkle-feed-post.entry.js +112 -0
- package/dist/esm/sparkle-feedback.entry.js +6 -4
- package/dist/esm/sparkle-file-upload.entry.js +49 -0
- package/dist/esm/sparkle-goal-form.entry.js +9 -6
- package/dist/esm/sparkle-input.entry.js +52 -0
- package/dist/esm/sparkle-quiz-container.entry.js +1 -1
- package/dist/esm/sparkle-quiz-old.entry.js +116 -0
- package/dist/esm/sparkle-quiz.entry.js +31 -48
- package/dist/esm/{student.service-0746418b.js → student.service-08af124f.js} +1 -1
- package/dist/esm/token.service-71a5d33f.js +94 -0
- package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
- package/dist/sparkle-core/index.esm.js +1 -1
- package/dist/sparkle-core/p-08420531.entry.js +1 -0
- package/dist/sparkle-core/p-08cca80d.entry.js +1 -0
- package/dist/sparkle-core/p-0e8e539f.entry.js +1 -0
- package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
- package/dist/sparkle-core/p-1adc98f6.js +1 -0
- package/dist/sparkle-core/p-38c842d5.entry.js +1 -0
- package/dist/sparkle-core/{p-fbccd30c.js → p-39a31e43.js} +1 -1
- package/dist/sparkle-core/{p-0a5d7c4f.entry.js → p-3daf2915.entry.js} +26 -26
- package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
- package/dist/sparkle-core/p-42ed7d5f.entry.js +1 -0
- package/dist/sparkle-core/p-4b4a8703.js +1 -0
- package/dist/sparkle-core/p-4d1cfcbe.entry.js +1 -0
- package/dist/sparkle-core/p-4fba3e4c.js +1 -0
- package/dist/sparkle-core/{p-54dd894f.entry.js → p-6bde0192.entry.js} +1 -1
- package/dist/sparkle-core/{p-6faa194c.entry.js → p-6d2f4093.entry.js} +1 -1
- package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
- package/dist/sparkle-core/p-7dae0f0e.js +1 -0
- package/dist/sparkle-core/{p-18cdd458.entry.js → p-85d4cd5c.entry.js} +1 -1
- package/dist/sparkle-core/p-973fe404.entry.js +22 -0
- package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
- package/dist/sparkle-core/p-b06e2bef.js +1 -0
- package/dist/sparkle-core/{p-e863bf1d.entry.js → p-b6fec622.entry.js} +1 -1
- package/dist/sparkle-core/p-b8d71ff4.js +1 -0
- package/dist/sparkle-core/p-bd90903e.js +1 -0
- package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
- package/dist/sparkle-core/{p-5efc6566.js → p-c9f753a4.js} +1 -1
- package/dist/sparkle-core/p-da391f3f.js +1 -0
- package/dist/sparkle-core/p-e0cad1bb.js +1 -0
- package/dist/sparkle-core/{p-ce4b22f7.entry.js → p-f196c124.entry.js} +1 -1
- package/dist/sparkle-core/p-f47fe1fe.entry.js +1 -0
- package/dist/sparkle-core/p-f714f77a.entry.js +1 -0
- package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
- package/dist/sparkle-core/{p-377b04c2.entry.js → p-ff080f82.entry.js} +1 -1
- package/dist/sparkle-core/{p-2ff67662.js → p-ff7a8a71.js} +1 -1
- package/dist/sparkle-core/sparkle-core.esm.js +1 -1
- package/dist/types/components/layout/page/page.d.ts +2 -0
- package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +16 -0
- package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
- package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +4 -3
- package/dist/types/components/sparkle-file-upload/sparkle-file-upload.d.ts +15 -0
- package/dist/types/components/sparkle-input/sparkle-input.d.ts +23 -0
- package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
- package/dist/types/components/sparkle-quiz/{sparkle-quiz-v1.d.ts → sparkle-quiz.d.ts} +1 -1
- package/dist/types/components.d.ts +111 -36
- package/dist/types/models/class.model.d.ts +4 -0
- package/dist/types/services/assignment.service.d.ts +8 -0
- package/dist/types/services/auth/auth.service.d.ts +1 -1
- package/dist/types/services/environment/environment-config.d.ts +3 -0
- package/dist/types/services/token.service.d.ts +13 -0
- package/dist/types/util.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +0 -618
- package/dist/cjs/ion-textarea.cjs.entry.js +0 -248
- package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
- package/dist/esm/ion-select_3.entry.js +0 -612
- package/dist/esm/ion-textarea.entry.js +0 -244
- package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
- package/dist/sparkle-core/p-0f1c5899.entry.js +0 -18
- package/dist/sparkle-core/p-1d4c7c11.js +0 -1
- package/dist/sparkle-core/p-30767c1c.entry.js +0 -1
- package/dist/sparkle-core/p-3265ed87.entry.js +0 -1
- package/dist/sparkle-core/p-370609ba.entry.js +0 -1
- package/dist/sparkle-core/p-44334ef3.entry.js +0 -4
- package/dist/sparkle-core/p-462bffba.js +0 -1
- package/dist/sparkle-core/p-4c9f994f.js +0 -1
- package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
- package/dist/sparkle-core/p-600cf6a3.js +0 -1
- package/dist/sparkle-core/p-641bfc92.entry.js +0 -1
- package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
- package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
- package/dist/sparkle-core/p-b226f54d.js +0 -1
- /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
- /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -1,5 +1,9 @@
|
|
1
1
|
import { Component, Element, State, Prop, Method, h, Host } from '@stencil/core';
|
2
|
-
import {
|
2
|
+
import { AssignmentService } from '../../services/assignment.service';
|
3
|
+
import { FeedService } from '../../services/feed.service';
|
4
|
+
import { MediaService } from '../../services/media.service';
|
5
|
+
import { TokenService } from '../../services/token.service';
|
6
|
+
import { SparkleGlobal } from '../../util';
|
3
7
|
export class SparkleFeedPost {
|
4
8
|
// @Prop({ connect: 'ion-toast-controller' })
|
5
9
|
// toastCtrl: HTMLIonToastControllerElement;
|
@@ -13,34 +17,11 @@ export class SparkleFeedPost {
|
|
13
17
|
setText(text) {
|
14
18
|
this.postText = text;
|
15
19
|
}
|
16
|
-
// async postToFeed() {
|
17
|
-
// const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
18
|
-
// const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
|
19
|
-
// var model = {
|
20
|
-
// CourseId: tocData.id,
|
21
|
-
// MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
22
|
-
// PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
|
23
|
-
// PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
|
24
|
-
// IsPublic: this.public,
|
25
|
-
// ExternalResourceUrl: "",
|
26
|
-
// }
|
27
|
-
// const result = await FeedService.getInstance().createPost(model);
|
28
|
-
// if (result.Succeeded) {
|
29
|
-
// //show success toast
|
30
|
-
// }
|
31
|
-
// }
|
32
20
|
isAuthenticated() {
|
33
|
-
|
34
|
-
var sparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
|
35
|
-
if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
|
36
|
-
return true;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
catch (_a) {
|
40
|
-
return false;
|
41
|
-
}
|
21
|
+
return TokenService.getInstance().isAuthenticated();
|
42
22
|
}
|
43
|
-
submitPost() {
|
23
|
+
async submitPost() {
|
24
|
+
this.postLoading = true;
|
44
25
|
this.errorMessage = '';
|
45
26
|
this.successMessage = '';
|
46
27
|
//let formData = new FormData(this.el.querySelector("form")) as any;
|
@@ -51,60 +32,56 @@ export class SparkleFeedPost {
|
|
51
32
|
PostText: this.postText,
|
52
33
|
IsPublic: isPublic.checked,
|
53
34
|
ExternalResourceUrl: postExternalUrl.value,
|
54
|
-
MiniAppId:
|
35
|
+
MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
|
55
36
|
AssignmentName: this.assignmentName,
|
56
37
|
AssignmentData: '',
|
38
|
+
PostTextJSON: null,
|
57
39
|
};
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
// // this.presentToast('There is an error');
|
79
|
-
// },
|
80
|
-
// );
|
81
|
-
// }
|
40
|
+
const result = await FeedService.getInstance().createPost(data);
|
41
|
+
if (result.Succeeded) {
|
42
|
+
this.postLoading = false;
|
43
|
+
//show success toast
|
44
|
+
this.successMessage = 'Posted Successfully.';
|
45
|
+
this.postText = '';
|
46
|
+
this.externalResourceUrl = '';
|
47
|
+
this.uploadedImage = '';
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
this.postLoading = false;
|
51
|
+
this.errorMessage = 'There is an error while posting to feed.';
|
52
|
+
}
|
53
|
+
if (this.assignmentName) {
|
54
|
+
var assignmentModel = {
|
55
|
+
AssignmentData: JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl }),
|
56
|
+
AssignmentName: this.assignmentName,
|
57
|
+
};
|
58
|
+
await AssignmentService.getInstance().createAssignment(assignmentModel);
|
59
|
+
}
|
82
60
|
}
|
83
|
-
uploadImage(evt) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
// },
|
98
|
-
// );
|
61
|
+
async uploadImage(evt) {
|
62
|
+
this.uploadImageLoading = true;
|
63
|
+
var files = evt.target.files;
|
64
|
+
let result = await MediaService.getInstance().uploadImage(files);
|
65
|
+
if (result.Succeeded) {
|
66
|
+
console.log(result);
|
67
|
+
this.uploadImageLoading = false;
|
68
|
+
this.uploadedImage = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
|
69
|
+
this.externalResourceUrl = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
|
70
|
+
}
|
71
|
+
else {
|
72
|
+
this.uploadImageLoading = false;
|
73
|
+
this.errorMessage = 'There is an error while uploading an image.';
|
74
|
+
}
|
99
75
|
}
|
100
76
|
selectFile() {
|
101
|
-
var fileInput =
|
77
|
+
var fileInput = this.el.querySelector('#fileInput');
|
102
78
|
fileInput.click();
|
103
79
|
}
|
104
80
|
renderUserInfo() {
|
105
|
-
|
106
|
-
|
107
|
-
|
81
|
+
let authUser = TokenService.getInstance().getAuthUserSync();
|
82
|
+
//var tokenInfo = { Token: null, ProfileImageUrl: null };
|
83
|
+
if (authUser && authUser.JWToken) {
|
84
|
+
return (h("ion-avatar", { class: "header-avatar", slot: "end" }, authUser.PhotoUrl ? h("img", { src: authUser.PhotoUrl }) : h("img", { src: "/assets/img/user.png" })));
|
108
85
|
}
|
109
86
|
else {
|
110
87
|
return (h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
|
@@ -124,7 +101,7 @@ export class SparkleFeedPost {
|
|
124
101
|
h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })),
|
125
102
|
h("ion-item", { class: "padding" },
|
126
103
|
h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })),
|
127
|
-
this.uploadedImage ? (h("ion-item", { class: "padding" },
|
104
|
+
this.uploadedImage ? (h("ion-item", { class: "ion-padding", lines: "none" },
|
128
105
|
h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''),
|
129
106
|
h("ion-item", { lines: "none" },
|
130
107
|
h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }),
|
@@ -140,7 +117,8 @@ export class SparkleFeedPost {
|
|
140
117
|
h("div", null,
|
141
118
|
h("div", { class: "error" }, this.errorMessage),
|
142
119
|
h("div", { class: "success" }, this.successMessage)),
|
143
|
-
h("
|
120
|
+
h("div", null, this.postLoading ? h("ion-spinner", { color: "primary" }) : ''),
|
121
|
+
h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: this.postLoading || !this.isAuthenticated() }, "Post")))))))));
|
144
122
|
}
|
145
123
|
static get is() { return "sparkle-feed-post"; }
|
146
124
|
static get originalStyleUrls() { return {
|
@@ -191,7 +169,8 @@ export class SparkleFeedPost {
|
|
191
169
|
"uploadedImage": {},
|
192
170
|
"successMessage": {},
|
193
171
|
"externalResourceUrl": {},
|
194
|
-
"uploadImageLoading": {}
|
172
|
+
"uploadImageLoading": {},
|
173
|
+
"postLoading": {}
|
195
174
|
}; }
|
196
175
|
static get methods() { return {
|
197
176
|
"setText": {
|
File without changes
|
@@ -0,0 +1,105 @@
|
|
1
|
+
import { Component, Element, Event, State, Prop, h, Host } from '@stencil/core';
|
2
|
+
import { MediaService } from '../../services/media.service';
|
3
|
+
export class SparkleFileUpload {
|
4
|
+
constructor() {
|
5
|
+
this.uploadImageLoading = false;
|
6
|
+
}
|
7
|
+
componentDidLoad() { }
|
8
|
+
async uploadImage(evt) {
|
9
|
+
this.uploadImageLoading = true;
|
10
|
+
var files = evt.target.files;
|
11
|
+
let result = await MediaService.getInstance().uploadImage(files);
|
12
|
+
if (result.Succeeded) {
|
13
|
+
console.log(result);
|
14
|
+
this.uploadImageLoading = false;
|
15
|
+
this.uploadedImage = result.Data.length > 0 ? result.Data[0].FullImageUrl : '';
|
16
|
+
this.value = this.uploadedImage;
|
17
|
+
this.fileUploaded.emit(this.uploadedImage);
|
18
|
+
}
|
19
|
+
else {
|
20
|
+
this.uploadImageLoading = false;
|
21
|
+
this.errorMessage = 'There is an error while uploading an image.';
|
22
|
+
}
|
23
|
+
}
|
24
|
+
selectFile() {
|
25
|
+
var fileInput = this.el.shadowRoot.querySelector('#fileInput');
|
26
|
+
fileInput.click();
|
27
|
+
}
|
28
|
+
render() {
|
29
|
+
return (h(Host, null,
|
30
|
+
this.uploadedImage ? (h("ion-item", { class: "ion-padding", lines: "none" },
|
31
|
+
h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''),
|
32
|
+
h("ion-item", { lines: "none" },
|
33
|
+
h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*,application/pdf,application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint,text/plain" }),
|
34
|
+
this.uploadImageLoading ? h("ion-spinner", { color: "primary" }) : '',
|
35
|
+
h("ion-button", { slot: "start", onClick: evt => this.selectFile() },
|
36
|
+
h("ion-icon", { name: "add" }),
|
37
|
+
"Upload Image"))));
|
38
|
+
}
|
39
|
+
static get is() { return "sparkle-file-upload"; }
|
40
|
+
static get encapsulation() { return "shadow"; }
|
41
|
+
static get originalStyleUrls() { return {
|
42
|
+
"$": ["sparkle-file-upload.scss"]
|
43
|
+
}; }
|
44
|
+
static get styleUrls() { return {
|
45
|
+
"$": ["sparkle-file-upload.css"]
|
46
|
+
}; }
|
47
|
+
static get properties() { return {
|
48
|
+
"value": {
|
49
|
+
"type": "string",
|
50
|
+
"mutable": true,
|
51
|
+
"complexType": {
|
52
|
+
"original": "string",
|
53
|
+
"resolved": "string",
|
54
|
+
"references": {}
|
55
|
+
},
|
56
|
+
"required": false,
|
57
|
+
"optional": false,
|
58
|
+
"docs": {
|
59
|
+
"tags": [],
|
60
|
+
"text": ""
|
61
|
+
},
|
62
|
+
"attribute": "value",
|
63
|
+
"reflect": false
|
64
|
+
},
|
65
|
+
"name": {
|
66
|
+
"type": "string",
|
67
|
+
"mutable": true,
|
68
|
+
"complexType": {
|
69
|
+
"original": "string",
|
70
|
+
"resolved": "string",
|
71
|
+
"references": {}
|
72
|
+
},
|
73
|
+
"required": false,
|
74
|
+
"optional": false,
|
75
|
+
"docs": {
|
76
|
+
"tags": [],
|
77
|
+
"text": ""
|
78
|
+
},
|
79
|
+
"attribute": "name",
|
80
|
+
"reflect": false
|
81
|
+
}
|
82
|
+
}; }
|
83
|
+
static get states() { return {
|
84
|
+
"errorMessage": {},
|
85
|
+
"uploadedImage": {},
|
86
|
+
"uploadImageLoading": {}
|
87
|
+
}; }
|
88
|
+
static get events() { return [{
|
89
|
+
"method": "fileUploaded",
|
90
|
+
"name": "fileUploaded",
|
91
|
+
"bubbles": true,
|
92
|
+
"cancelable": true,
|
93
|
+
"composed": true,
|
94
|
+
"docs": {
|
95
|
+
"tags": [],
|
96
|
+
"text": ""
|
97
|
+
},
|
98
|
+
"complexType": {
|
99
|
+
"original": "any",
|
100
|
+
"resolved": "any",
|
101
|
+
"references": {}
|
102
|
+
}
|
103
|
+
}]; }
|
104
|
+
static get elementRef() { return "el"; }
|
105
|
+
}
|
File without changes
|
@@ -0,0 +1,212 @@
|
|
1
|
+
import { Component, h, Event, Prop, Watch } from '@stencil/core';
|
2
|
+
export class SparkleInput {
|
3
|
+
arrayDataWatcher(newValue) {
|
4
|
+
if (typeof newValue === 'string') {
|
5
|
+
this._options = JSON.parse(newValue);
|
6
|
+
}
|
7
|
+
else {
|
8
|
+
this._options = newValue;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
componentWillLoad() {
|
12
|
+
if (this.type == 'select') {
|
13
|
+
this.arrayDataWatcher(this.options);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
handleChange(event) {
|
17
|
+
const value = this.type === 'checkbox' ? event.target.checked : event.target.value;
|
18
|
+
this.value = value;
|
19
|
+
this.valueChanged.emit(value);
|
20
|
+
if (this.type === 'checkbox') {
|
21
|
+
this.checkedChanged.emit(value);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
render() {
|
25
|
+
switch (this.type) {
|
26
|
+
case 'text' || 'email' || 'number' || 'tel' || 'url':
|
27
|
+
return (h("div", null,
|
28
|
+
h("ion-item", null,
|
29
|
+
h("ion-label", null, this.label),
|
30
|
+
h("ion-input", { type: this.type, value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
|
31
|
+
case 'textarea':
|
32
|
+
return (h("div", null,
|
33
|
+
h("ion-item", null,
|
34
|
+
h("ion-label", null, this.label),
|
35
|
+
h("ion-textarea", { value: this.value, placeholder: this.placeholder, onInput: (event) => this.handleChange(event), required: true }))));
|
36
|
+
case 'checkbox':
|
37
|
+
return (h("div", null,
|
38
|
+
h("ion-item", null,
|
39
|
+
h("ion-checkbox", { slot: "start", checked: this.checked, onChange: (event) => this.handleChange(event) }),
|
40
|
+
h("ion-label", null, this.label))));
|
41
|
+
case 'select':
|
42
|
+
return (h("div", null,
|
43
|
+
h("ion-item", null,
|
44
|
+
h("ion-select", { value: this.value, placeholder: this.label, onIonChange: event => this.handleChange(event) }, this._options.map(option => (h("ion-select-option", { key: option.value, value: option.value }, option.label)))))));
|
45
|
+
default:
|
46
|
+
return null;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
static get is() { return "sparkle-input"; }
|
50
|
+
static get originalStyleUrls() { return {
|
51
|
+
"$": ["sparkle-input.scss"]
|
52
|
+
}; }
|
53
|
+
static get styleUrls() { return {
|
54
|
+
"$": ["sparkle-input.css"]
|
55
|
+
}; }
|
56
|
+
static get properties() { return {
|
57
|
+
"type": {
|
58
|
+
"type": "string",
|
59
|
+
"mutable": false,
|
60
|
+
"complexType": {
|
61
|
+
"original": "'text' | 'textarea' | 'checkbox' | 'select'",
|
62
|
+
"resolved": "\"checkbox\" | \"select\" | \"text\" | \"textarea\"",
|
63
|
+
"references": {}
|
64
|
+
},
|
65
|
+
"required": false,
|
66
|
+
"optional": false,
|
67
|
+
"docs": {
|
68
|
+
"tags": [],
|
69
|
+
"text": ""
|
70
|
+
},
|
71
|
+
"attribute": "type",
|
72
|
+
"reflect": false
|
73
|
+
},
|
74
|
+
"value": {
|
75
|
+
"type": "any",
|
76
|
+
"mutable": true,
|
77
|
+
"complexType": {
|
78
|
+
"original": "string | boolean",
|
79
|
+
"resolved": "boolean | string",
|
80
|
+
"references": {}
|
81
|
+
},
|
82
|
+
"required": false,
|
83
|
+
"optional": false,
|
84
|
+
"docs": {
|
85
|
+
"tags": [],
|
86
|
+
"text": ""
|
87
|
+
},
|
88
|
+
"attribute": "value",
|
89
|
+
"reflect": false
|
90
|
+
},
|
91
|
+
"label": {
|
92
|
+
"type": "string",
|
93
|
+
"mutable": false,
|
94
|
+
"complexType": {
|
95
|
+
"original": "string",
|
96
|
+
"resolved": "string",
|
97
|
+
"references": {}
|
98
|
+
},
|
99
|
+
"required": false,
|
100
|
+
"optional": false,
|
101
|
+
"docs": {
|
102
|
+
"tags": [],
|
103
|
+
"text": ""
|
104
|
+
},
|
105
|
+
"attribute": "label",
|
106
|
+
"reflect": false
|
107
|
+
},
|
108
|
+
"name": {
|
109
|
+
"type": "string",
|
110
|
+
"mutable": false,
|
111
|
+
"complexType": {
|
112
|
+
"original": "string",
|
113
|
+
"resolved": "string",
|
114
|
+
"references": {}
|
115
|
+
},
|
116
|
+
"required": false,
|
117
|
+
"optional": false,
|
118
|
+
"docs": {
|
119
|
+
"tags": [],
|
120
|
+
"text": ""
|
121
|
+
},
|
122
|
+
"attribute": "name",
|
123
|
+
"reflect": false
|
124
|
+
},
|
125
|
+
"placeholder": {
|
126
|
+
"type": "string",
|
127
|
+
"mutable": false,
|
128
|
+
"complexType": {
|
129
|
+
"original": "string",
|
130
|
+
"resolved": "string",
|
131
|
+
"references": {}
|
132
|
+
},
|
133
|
+
"required": false,
|
134
|
+
"optional": false,
|
135
|
+
"docs": {
|
136
|
+
"tags": [],
|
137
|
+
"text": ""
|
138
|
+
},
|
139
|
+
"attribute": "placeholder",
|
140
|
+
"reflect": false
|
141
|
+
},
|
142
|
+
"checked": {
|
143
|
+
"type": "boolean",
|
144
|
+
"mutable": false,
|
145
|
+
"complexType": {
|
146
|
+
"original": "boolean",
|
147
|
+
"resolved": "boolean",
|
148
|
+
"references": {}
|
149
|
+
},
|
150
|
+
"required": false,
|
151
|
+
"optional": false,
|
152
|
+
"docs": {
|
153
|
+
"tags": [],
|
154
|
+
"text": ""
|
155
|
+
},
|
156
|
+
"attribute": "checked",
|
157
|
+
"reflect": false
|
158
|
+
},
|
159
|
+
"options": {
|
160
|
+
"type": "string",
|
161
|
+
"mutable": false,
|
162
|
+
"complexType": {
|
163
|
+
"original": "{ value: string; label: string }[] | string",
|
164
|
+
"resolved": "string | { value: string; label: string; }[]",
|
165
|
+
"references": {}
|
166
|
+
},
|
167
|
+
"required": false,
|
168
|
+
"optional": false,
|
169
|
+
"docs": {
|
170
|
+
"tags": [],
|
171
|
+
"text": ""
|
172
|
+
},
|
173
|
+
"attribute": "options",
|
174
|
+
"reflect": false
|
175
|
+
}
|
176
|
+
}; }
|
177
|
+
static get events() { return [{
|
178
|
+
"method": "valueChanged",
|
179
|
+
"name": "valueChanged",
|
180
|
+
"bubbles": true,
|
181
|
+
"cancelable": true,
|
182
|
+
"composed": true,
|
183
|
+
"docs": {
|
184
|
+
"tags": [],
|
185
|
+
"text": ""
|
186
|
+
},
|
187
|
+
"complexType": {
|
188
|
+
"original": "string | boolean",
|
189
|
+
"resolved": "boolean | string",
|
190
|
+
"references": {}
|
191
|
+
}
|
192
|
+
}, {
|
193
|
+
"method": "checkedChanged",
|
194
|
+
"name": "checkedChanged",
|
195
|
+
"bubbles": true,
|
196
|
+
"cancelable": true,
|
197
|
+
"composed": true,
|
198
|
+
"docs": {
|
199
|
+
"tags": [],
|
200
|
+
"text": ""
|
201
|
+
},
|
202
|
+
"complexType": {
|
203
|
+
"original": "boolean",
|
204
|
+
"resolved": "boolean",
|
205
|
+
"references": {}
|
206
|
+
}
|
207
|
+
}]; }
|
208
|
+
static get watchers() { return [{
|
209
|
+
"propName": "options",
|
210
|
+
"methodName": "arrayDataWatcher"
|
211
|
+
}]; }
|
212
|
+
}
|
@@ -69,7 +69,8 @@ export class PageLogin {
|
|
69
69
|
Password: this.password.value,
|
70
70
|
RememberClient: this.rememberMe.value
|
71
71
|
});
|
72
|
-
|
72
|
+
console.log(result);
|
73
|
+
//sessionStorage.setItem('rememberMe', this.rememberMe.value == true ? '1' : '0');
|
73
74
|
this.userDidLogIn.emit({ loginStatus: true });
|
74
75
|
}
|
75
76
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Component, Prop, Listen, State, Event, Element, h } from '@stencil/core';
|
2
|
-
export class
|
2
|
+
export class SparkleQuizOld {
|
3
3
|
constructor() {
|
4
4
|
this.type = 'TEXT';
|
5
5
|
this.scale = 'FIVE-POINTS';
|
@@ -110,12 +110,12 @@ export class SparkleQuiz {
|
|
110
110
|
return h("p", null, "No question found.");
|
111
111
|
}
|
112
112
|
}
|
113
|
-
static get is() { return "sparkle-quiz"; }
|
113
|
+
static get is() { return "sparkle-quiz-old"; }
|
114
114
|
static get originalStyleUrls() { return {
|
115
|
-
"$": ["sparkle-quiz.scss"]
|
115
|
+
"$": ["sparkle-quiz-old.scss"]
|
116
116
|
}; }
|
117
117
|
static get styleUrls() { return {
|
118
|
-
"$": ["sparkle-quiz.css"]
|
118
|
+
"$": ["sparkle-quiz-old.css"]
|
119
119
|
}; }
|
120
120
|
static get properties() { return {
|
121
121
|
"questionId": {
|
@@ -1,53 +1,52 @@
|
|
1
1
|
import { Component, Prop, Watch, Listen, State, Event, Element, h } from '@stencil/core';
|
2
2
|
import { AssetsService } from '../../services/core/assets.service';
|
3
|
-
import { EnvironmentConfigService } from
|
4
|
-
export class
|
3
|
+
import { EnvironmentConfigService } from '../../services/environment/environment-config.service';
|
4
|
+
export class SparkleQuiz {
|
5
5
|
async loadQuestion() {
|
6
6
|
if (this.quizData) {
|
7
7
|
this.question = this.quizData[+this.questionId];
|
8
8
|
}
|
9
9
|
}
|
10
|
-
async componentWillLoad() {
|
11
|
-
}
|
10
|
+
async componentWillLoad() { }
|
12
11
|
async componentDidLoad() {
|
13
12
|
const config = EnvironmentConfigService.getInstance().get('sparkle');
|
14
13
|
this.quizData = await AssetsService.getInstance().loadJsonFile(config.quizPath);
|
15
14
|
await this.loadQuestion();
|
16
15
|
this.quizAnswerChanged.emit({
|
17
16
|
question: null,
|
18
|
-
answer:
|
17
|
+
answer: '1',
|
19
18
|
});
|
20
19
|
}
|
21
20
|
quizInputChangeHandler(event) {
|
22
21
|
this.quizAnswerChanged.emit({
|
23
22
|
question: event.detail.question,
|
24
|
-
answer: event.detail.value
|
23
|
+
answer: event.detail.value,
|
25
24
|
});
|
26
25
|
}
|
27
26
|
quizFeedbackChangeHandler(event) {
|
28
27
|
this.quizAnswerChanged.emit({
|
29
28
|
question: event.detail.question,
|
30
|
-
answer: event.detail.value
|
29
|
+
answer: event.detail.value,
|
31
30
|
});
|
32
31
|
}
|
33
32
|
quizSelectChangeHandler(event) {
|
34
33
|
this.quizAnswerChanged.emit({
|
35
34
|
question: event.detail.question,
|
36
|
-
answer: event.detail.value
|
35
|
+
answer: event.detail.value,
|
37
36
|
});
|
38
37
|
}
|
39
38
|
quizOpinionChangeHandler(event) {
|
40
39
|
this.quizAnswerChanged.emit({
|
41
40
|
question: event.detail.question,
|
42
|
-
answer: event.detail.value
|
41
|
+
answer: event.detail.value,
|
43
42
|
});
|
44
43
|
}
|
45
44
|
getQuestionFeedback() {
|
46
|
-
if (this.question.questionType ==
|
45
|
+
if (this.question.questionType == 'MULTIPLE-CHOICE') {
|
47
46
|
const feedbacks = this.question.options.filter(x => x.correct == true).map(x => x.feedback);
|
48
47
|
return feedbacks.length > 0 && feedbacks.map(feedback => h("small", null, feedback));
|
49
48
|
}
|
50
|
-
else if (this.question.questionType ==
|
49
|
+
else if (this.question.questionType == 'FEEDBACK' || this.question.questionType == 'TEXT') {
|
51
50
|
return this.question.feedback && h("small", null,
|
52
51
|
" ",
|
53
52
|
this.question.feedback);
|
@@ -57,43 +56,42 @@ export class SparkleQuizV1 {
|
|
57
56
|
return h("div", null, this.correct ? h("strong", null, "Good job!") : h("strong", null, "Incorrect answer, please try again."));
|
58
57
|
}
|
59
58
|
renderQuestion() {
|
60
|
-
if (this.question.questionType ==
|
59
|
+
if (this.question.questionType == 'MULTIPLE-CHOICE') {
|
61
60
|
return h("sparkle-quiz-select", { question: this.question, allowMultiple: true });
|
62
61
|
}
|
63
|
-
else if (this.question.questionType ==
|
62
|
+
else if (this.question.questionType == 'FEEDBACK') {
|
64
63
|
return h("sparkle-quiz-feedback", { question: this.question });
|
65
64
|
}
|
66
|
-
else if (this.question.questionType ==
|
65
|
+
else if (this.question.questionType == 'TEXT') {
|
67
66
|
return h("sparkle-quiz-input", { question: this.question });
|
68
67
|
}
|
69
|
-
else if (this.question.questionType ==
|
68
|
+
else if (this.question.questionType == 'OPINION') {
|
70
69
|
return h("sparkle-quiz-opinion", { question: this.question });
|
71
70
|
}
|
72
|
-
else if (this.question.questionType ==
|
71
|
+
else if (this.question.questionType == 'POLL') {
|
73
72
|
return h("sparkle-quiz-poll", { question: this.question });
|
74
73
|
}
|
75
74
|
}
|
76
75
|
render() {
|
77
76
|
if (this.question) {
|
78
77
|
let classes = {
|
79
|
-
|
80
|
-
|
78
|
+
correct: this.submitted && this.correct,
|
79
|
+
incorrect: this.submitted && !this.correct,
|
81
80
|
};
|
82
|
-
return h("div", { class: classes },
|
81
|
+
return (h("div", { class: classes },
|
83
82
|
this.renderQuestion(),
|
84
|
-
this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(),
|
85
|
-
this.getQuestionFeedback()]));
|
83
|
+
this.submitted && this.showInstantResult && h("div", { class: "feedback-container" }, [this.showAnswerStatus(), this.getQuestionFeedback()])));
|
86
84
|
}
|
87
85
|
else {
|
88
86
|
return h("p", null, "No question found.");
|
89
87
|
}
|
90
88
|
}
|
91
|
-
static get is() { return "sparkle-quiz
|
89
|
+
static get is() { return "sparkle-quiz"; }
|
92
90
|
static get originalStyleUrls() { return {
|
93
|
-
"$": ["sparkle-quiz
|
91
|
+
"$": ["sparkle-quiz.scss"]
|
94
92
|
}; }
|
95
93
|
static get styleUrls() { return {
|
96
|
-
"$": ["sparkle-quiz
|
94
|
+
"$": ["sparkle-quiz.css"]
|
97
95
|
}; }
|
98
96
|
static get properties() { return {
|
99
97
|
"questionId": {
|
@@ -180,7 +178,7 @@ export class SparkleQuizV1 {
|
|
180
178
|
"text": ""
|
181
179
|
},
|
182
180
|
"complexType": {
|
183
|
-
"original": "{ answer: any
|
181
|
+
"original": "{ answer: any; question: SparkleQuizQuestion }",
|
184
182
|
"resolved": "{ answer: any; question: SparkleQuizQuestion; }",
|
185
183
|
"references": {
|
186
184
|
"SparkleQuizQuestion": {
|