@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.
Files changed (177) hide show
  1. package/dist/cjs/{PrivateRoute-074c584e.js → PrivateRoute-f97245ce.js} +18 -30
  2. package/dist/cjs/{feed.service-b4f09441.js → appdata.service-c8d71e05.js} +4 -56
  3. package/dist/cjs/{assets.service-0c759d51.js → assets.service-bfa75092.js} +1 -1
  4. package/dist/cjs/assignment.service-690fb59c.js +19 -0
  5. package/dist/cjs/{environment-config.service-0e02b049.js → environment-config.service-c8ff1f3d.js} +0 -1
  6. package/dist/cjs/{facilitator.service-9e990274.js → facilitator.service-ff0e1659.js} +1 -1
  7. package/dist/cjs/feed.service-8eca4de6.js +57 -0
  8. package/dist/cjs/header-mobile-collapse_61.cjs.entry.js +76 -87
  9. package/dist/cjs/{httpService-7211d93b.js → httpService-d2e7bf8f.js} +13 -11
  10. package/dist/cjs/index.cjs.js +5 -4
  11. package/dist/cjs/{ion-action-sheet_4.cjs.entry.js → ion-action-sheet_7.cjs.entry.js} +728 -0
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/media.service-8a1b9bc5.js +40 -0
  14. package/dist/cjs/{signalR.service-5672eebc.js → signalR.service-bd6b42f9.js} +18 -20
  15. package/dist/cjs/sparkle-animation-player.cjs.entry.js +1 -1
  16. package/dist/cjs/sparkle-assignment.cjs.entry.js +110 -0
  17. package/dist/cjs/sparkle-character-intro.cjs.entry.js +2 -2
  18. package/dist/cjs/sparkle-core.cjs.js +1 -1
  19. package/dist/cjs/sparkle-discussion-questions_2.cjs.entry.js +20 -11
  20. package/dist/cjs/sparkle-discussion.cjs.entry.js +6 -4
  21. package/dist/cjs/sparkle-facilitator-notes-form.cjs.entry.js +5 -3
  22. package/dist/cjs/sparkle-feed-post.cjs.entry.js +116 -0
  23. package/dist/cjs/sparkle-feedback.cjs.entry.js +5 -3
  24. package/dist/cjs/sparkle-file-upload.cjs.entry.js +53 -0
  25. package/dist/cjs/sparkle-goal-form.cjs.entry.js +11 -8
  26. package/dist/cjs/sparkle-input.cjs.entry.js +56 -0
  27. package/dist/cjs/sparkle-quiz-container.cjs.entry.js +1 -1
  28. package/dist/cjs/sparkle-quiz-old.cjs.entry.js +120 -0
  29. package/dist/cjs/sparkle-quiz.cjs.entry.js +31 -48
  30. package/dist/cjs/{student.service-2e58f237.js → student.service-7e5385be.js} +1 -1
  31. package/dist/cjs/token.service-7a41953d.js +97 -0
  32. package/dist/cjs/{util-d383acb8.js → util-47e320b2.js} +2 -2
  33. package/dist/collection/PrivateRoute.js +2 -2
  34. package/dist/collection/collection-manifest.json +5 -2
  35. package/dist/collection/components/layout/facilitator/facilitator-page.js +2 -3
  36. package/dist/collection/components/layout/page/page.css +4 -0
  37. package/dist/collection/components/layout/page/page.js +39 -26
  38. package/dist/collection/components/sparkle-assignment/sparkle-assignment.css +30 -0
  39. package/dist/collection/components/sparkle-assignment/sparkle-assignment.js +159 -0
  40. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.css +8 -1
  41. package/dist/collection/components/sparkle-character-intro/sparkle-character-intro.js +10 -6
  42. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +13 -2
  43. package/dist/collection/components/sparkle-discussion/sparkle-discussion-questions/sparkle-discussion-questions.js +4 -2
  44. package/dist/collection/components/sparkle-discussion/sparkle-discussion-results/sparkle-discussion-results.js +15 -9
  45. package/dist/collection/components/sparkle-discussion/sparkle-discussion.css +5 -0
  46. package/dist/collection/components/sparkle-discussion/sparkle-discussion.js +5 -3
  47. package/dist/collection/components/sparkle-feed-post/sparkle-feed-post.js +54 -75
  48. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.css +0 -0
  49. package/dist/collection/components/sparkle-file-upload/sparkle-file-upload.js +105 -0
  50. package/dist/collection/components/sparkle-input/sparkle-input.css +0 -0
  51. package/dist/collection/components/sparkle-input/sparkle-input.js +212 -0
  52. package/dist/collection/components/sparkle-login/sparkle-login.js +2 -1
  53. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.css → sparkle-quiz-old/sparkle-quiz-old.css} +1 -1
  54. package/dist/collection/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.js → sparkle-quiz-old/sparkle-quiz-old.js} +4 -4
  55. package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.js → sparkle-quiz.js} +23 -25
  56. package/dist/collection/components/sparkle-quiz-container/sparkle-quiz-container.js +1 -1
  57. package/dist/collection/components/sparkle-root/sparkle-root.js +12 -10
  58. package/dist/collection/services/assignment.service.js +14 -0
  59. package/dist/collection/services/auth/auth.service.js +15 -14
  60. package/dist/collection/services/environment/environment-config.js +1 -1
  61. package/dist/collection/services/environment/environment-config.service.js +0 -1
  62. package/dist/collection/services/httpService.js +12 -10
  63. package/dist/collection/services/signalR.service.js +17 -19
  64. package/dist/collection/services/token.service.js +79 -0
  65. package/dist/collection/util.js +5 -2
  66. package/dist/esm/{PrivateRoute-c5441f35.js → PrivateRoute-90ac95b8.js} +17 -29
  67. package/dist/esm/{feed.service-8fbe4ce3.js → appdata.service-2e84e167.js} +5 -55
  68. package/dist/esm/{assets.service-66e848b8.js → assets.service-def1d63c.js} +1 -1
  69. package/dist/esm/assignment.service-8d31f141.js +17 -0
  70. package/dist/esm/{environment-config.service-2b5d692b.js → environment-config.service-b191f276.js} +0 -1
  71. package/dist/esm/{facilitator.service-b0292f7f.js → facilitator.service-18c47bdf.js} +1 -1
  72. package/dist/esm/feed.service-b4f3cae4.js +54 -0
  73. package/dist/esm/header-mobile-collapse_61.entry.js +71 -82
  74. package/dist/esm/{httpService-7b75b095.js → httpService-7986aeed.js} +14 -12
  75. package/dist/esm/index.js +6 -5
  76. package/dist/esm/{ion-action-sheet_4.entry.js → ion-action-sheet_7.entry.js} +729 -4
  77. package/dist/esm/ion-loading.entry.js +1 -1
  78. package/dist/esm/ion-menu.entry.js +1 -1
  79. package/dist/esm/ion-modal.entry.js +1 -1
  80. package/dist/esm/ion-picker.entry.js +1 -1
  81. package/dist/esm/ion-toast.entry.js +1 -1
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/media.service-6e90bc41.js +37 -0
  84. package/dist/esm/{overlays-3b4dca92.js → overlays-4233a39d.js} +1 -1
  85. package/dist/esm/{signalR.service-9d5b9f36.js → signalR.service-c33fba50.js} +18 -20
  86. package/dist/esm/sparkle-animation-player.entry.js +1 -1
  87. package/dist/esm/sparkle-assignment.entry.js +106 -0
  88. package/dist/esm/sparkle-character-intro.entry.js +3 -3
  89. package/dist/esm/sparkle-core.js +1 -1
  90. package/dist/esm/sparkle-discussion-questions_2.entry.js +20 -11
  91. package/dist/esm/sparkle-discussion.entry.js +6 -4
  92. package/dist/esm/sparkle-facilitator-notes-form.entry.js +6 -4
  93. package/dist/esm/sparkle-feed-post.entry.js +112 -0
  94. package/dist/esm/sparkle-feedback.entry.js +6 -4
  95. package/dist/esm/sparkle-file-upload.entry.js +49 -0
  96. package/dist/esm/sparkle-goal-form.entry.js +9 -6
  97. package/dist/esm/sparkle-input.entry.js +52 -0
  98. package/dist/esm/sparkle-quiz-container.entry.js +1 -1
  99. package/dist/esm/sparkle-quiz-old.entry.js +116 -0
  100. package/dist/esm/sparkle-quiz.entry.js +31 -48
  101. package/dist/esm/{student.service-0746418b.js → student.service-08af124f.js} +1 -1
  102. package/dist/esm/token.service-71a5d33f.js +94 -0
  103. package/dist/esm/{util-6ef753e9.js → util-57cc8006.js} +2 -2
  104. package/dist/sparkle-core/index.esm.js +1 -1
  105. package/dist/sparkle-core/p-08420531.entry.js +1 -0
  106. package/dist/sparkle-core/p-08cca80d.entry.js +1 -0
  107. package/dist/sparkle-core/p-0e8e539f.entry.js +1 -0
  108. package/dist/sparkle-core/p-13ec39db.entry.js +1 -0
  109. package/dist/sparkle-core/p-1adc98f6.js +1 -0
  110. package/dist/sparkle-core/p-38c842d5.entry.js +1 -0
  111. package/dist/sparkle-core/{p-fbccd30c.js → p-39a31e43.js} +1 -1
  112. package/dist/sparkle-core/{p-0a5d7c4f.entry.js → p-3daf2915.entry.js} +26 -26
  113. package/dist/sparkle-core/{p-9a443f51.js → p-408176ba.js} +1 -1
  114. package/dist/sparkle-core/p-42ed7d5f.entry.js +1 -0
  115. package/dist/sparkle-core/p-4b4a8703.js +1 -0
  116. package/dist/sparkle-core/p-4d1cfcbe.entry.js +1 -0
  117. package/dist/sparkle-core/p-4fba3e4c.js +1 -0
  118. package/dist/sparkle-core/{p-54dd894f.entry.js → p-6bde0192.entry.js} +1 -1
  119. package/dist/sparkle-core/{p-6faa194c.entry.js → p-6d2f4093.entry.js} +1 -1
  120. package/dist/sparkle-core/{p-162bff1a.entry.js → p-72053ae0.entry.js} +1 -1
  121. package/dist/sparkle-core/p-7dae0f0e.js +1 -0
  122. package/dist/sparkle-core/{p-18cdd458.entry.js → p-85d4cd5c.entry.js} +1 -1
  123. package/dist/sparkle-core/p-973fe404.entry.js +22 -0
  124. package/dist/sparkle-core/{p-ff0e0d4e.entry.js → p-98daeddb.entry.js} +1 -1
  125. package/dist/sparkle-core/p-b06e2bef.js +1 -0
  126. package/dist/sparkle-core/{p-e863bf1d.entry.js → p-b6fec622.entry.js} +1 -1
  127. package/dist/sparkle-core/p-b8d71ff4.js +1 -0
  128. package/dist/sparkle-core/p-bd90903e.js +1 -0
  129. package/dist/sparkle-core/{p-a49ab4e8.entry.js → p-c64a34cd.entry.js} +1 -1
  130. package/dist/sparkle-core/{p-5efc6566.js → p-c9f753a4.js} +1 -1
  131. package/dist/sparkle-core/p-da391f3f.js +1 -0
  132. package/dist/sparkle-core/p-e0cad1bb.js +1 -0
  133. package/dist/sparkle-core/{p-ce4b22f7.entry.js → p-f196c124.entry.js} +1 -1
  134. package/dist/sparkle-core/p-f47fe1fe.entry.js +1 -0
  135. package/dist/sparkle-core/p-f714f77a.entry.js +1 -0
  136. package/dist/sparkle-core/p-f891c79a.entry.js +1 -0
  137. package/dist/sparkle-core/{p-377b04c2.entry.js → p-ff080f82.entry.js} +1 -1
  138. package/dist/sparkle-core/{p-2ff67662.js → p-ff7a8a71.js} +1 -1
  139. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  140. package/dist/types/components/layout/page/page.d.ts +2 -0
  141. package/dist/types/components/sparkle-assignment/sparkle-assignment.d.ts +16 -0
  142. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  143. package/dist/types/components/sparkle-feed-post/sparkle-feed-post.d.ts +4 -3
  144. package/dist/types/components/sparkle-file-upload/sparkle-file-upload.d.ts +15 -0
  145. package/dist/types/components/sparkle-input/sparkle-input.d.ts +23 -0
  146. package/dist/types/components/sparkle-quiz/{sparkle-quiz/sparkle-quiz.d.ts → sparkle-quiz-old/sparkle-quiz-old.d.ts} +1 -1
  147. package/dist/types/components/sparkle-quiz/{sparkle-quiz-v1.d.ts → sparkle-quiz.d.ts} +1 -1
  148. package/dist/types/components.d.ts +111 -36
  149. package/dist/types/models/class.model.d.ts +4 -0
  150. package/dist/types/services/assignment.service.d.ts +8 -0
  151. package/dist/types/services/auth/auth.service.d.ts +1 -1
  152. package/dist/types/services/environment/environment-config.d.ts +3 -0
  153. package/dist/types/services/token.service.d.ts +13 -0
  154. package/dist/types/util.d.ts +1 -0
  155. package/package.json +1 -1
  156. package/dist/cjs/ion-select_3.cjs.entry.js +0 -618
  157. package/dist/cjs/ion-textarea.cjs.entry.js +0 -248
  158. package/dist/cjs/sparkle-quiz-v1.cjs.entry.js +0 -105
  159. package/dist/esm/ion-select_3.entry.js +0 -612
  160. package/dist/esm/ion-textarea.entry.js +0 -244
  161. package/dist/esm/sparkle-quiz-v1.entry.js +0 -101
  162. package/dist/sparkle-core/p-0f1c5899.entry.js +0 -18
  163. package/dist/sparkle-core/p-1d4c7c11.js +0 -1
  164. package/dist/sparkle-core/p-30767c1c.entry.js +0 -1
  165. package/dist/sparkle-core/p-3265ed87.entry.js +0 -1
  166. package/dist/sparkle-core/p-370609ba.entry.js +0 -1
  167. package/dist/sparkle-core/p-44334ef3.entry.js +0 -4
  168. package/dist/sparkle-core/p-462bffba.js +0 -1
  169. package/dist/sparkle-core/p-4c9f994f.js +0 -1
  170. package/dist/sparkle-core/p-58e4bbe5.entry.js +0 -1
  171. package/dist/sparkle-core/p-600cf6a3.js +0 -1
  172. package/dist/sparkle-core/p-641bfc92.entry.js +0 -1
  173. package/dist/sparkle-core/p-80d6b0e6.entry.js +0 -1
  174. package/dist/sparkle-core/p-af3cc111.entry.js +0 -1
  175. package/dist/sparkle-core/p-b226f54d.js +0 -1
  176. /package/dist/collection/components/sparkle-quiz/{sparkle-quiz-v1.css → sparkle-quiz.css} +0 -0
  177. /package/dist/sparkle-core/{p-935e7cfc.js → p-8b56f734.js} +0 -0
@@ -1,618 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-51e8292e.js');
6
- const ionicGlobal = require('./ionic-global-2cde9d3a.js');
7
- const helpers = require('./helpers-c2496722.js');
8
- const overlays = require('./overlays-32df265a.js');
9
- const theme = require('./theme-b0b295c1.js');
10
- const environmentConfig_service = require('./environment-config.service-0e02b049.js');
11
- require('./auth.store-1e630a7d.js');
12
- require('./hardware-back-button-92d97ff8.js');
13
-
14
- /*!
15
- * (C) Ionic http://ionicframework.com - MIT License
16
- */
17
- const watchForOptions = (containerEl, tagName, onChange) => {
18
- if (typeof MutationObserver === 'undefined') {
19
- return;
20
- }
21
- const mutation = new MutationObserver((mutationList) => {
22
- onChange(getSelectedOption(mutationList, tagName));
23
- });
24
- mutation.observe(containerEl, {
25
- childList: true,
26
- subtree: true,
27
- });
28
- return mutation;
29
- };
30
- const getSelectedOption = (mutationList, tagName) => {
31
- let newOption;
32
- mutationList.forEach((mut) => {
33
- // eslint-disable-next-line @typescript-eslint/prefer-for-of
34
- for (let i = 0; i < mut.addedNodes.length; i++) {
35
- newOption = findCheckedOption(mut.addedNodes[i], tagName) || newOption;
36
- }
37
- });
38
- return newOption;
39
- };
40
- const findCheckedOption = (el, tagName) => {
41
- if (el.nodeType !== 1) {
42
- return undefined;
43
- }
44
- const options = el.tagName === tagName.toUpperCase() ? [el] : Array.from(el.querySelectorAll(tagName));
45
- return options.find((o) => o.value === el.value);
46
- };
47
-
48
- const selectIosCss = ":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative}.select-text{flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:20px}.select-icon{width:12px;height:18px;opacity:0.33}";
49
-
50
- const selectMdCss = ":host{--placeholder-color:currentColor;--placeholder-opacity:0.33;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:flex;position:relative;align-items:center;font-family:var(--ion-font-family, inherit);overflow:hidden;z-index:2}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:0.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:var(--placeholder-color);opacity:var(--placeholder-opacity)}label{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;appearance:none;outline:none;display:flex;align-items:center;opacity:0}[dir=rtl] label,:host-context([dir=rtl]) label{left:unset;right:unset;right:0}label::-moz-focus-inner{border:0}button{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.select-icon{position:relative}.select-text{flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-2px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;pointer-events:none}[dir=rtl] .select-icon-inner,:host-context([dir=rtl]) .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:0;--padding-bottom:10px;--padding-start:16px}.select-icon{width:19px;height:19px;transition:transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);opacity:0.55}:host-context(.item-label-stacked) .select-icon,:host-context(.item-label-floating:not(.item-fill-outline)) .select-icon,:host-context(.item-label-floating.item-fill-outline){transform:translate3d(0, -9px, 0)}:host-context(.item-has-focus) .select-icon{transform:rotate(180deg)}:host-context(.item-has-focus.item-label-stacked) .select-icon,:host-context(.item-has-focus.item-label-floating:not(.item-fill-outline)) .select-icon{transform:translate3d(0, -9px, 0) rotate(180deg)}:host-context(ion-item.ion-focused) .select-icon,:host-context(.item-has-focus) .select-icon{color:var(--highlight-color-focused);opacity:1}";
51
-
52
- const Select = class {
53
- constructor(hostRef) {
54
- index.registerInstance(this, hostRef);
55
- this.ionChange = index.createEvent(this, "ionChange", 7);
56
- this.ionCancel = index.createEvent(this, "ionCancel", 7);
57
- this.ionDismiss = index.createEvent(this, "ionDismiss", 7);
58
- this.ionFocus = index.createEvent(this, "ionFocus", 7);
59
- this.ionBlur = index.createEvent(this, "ionBlur", 7);
60
- this.ionStyle = index.createEvent(this, "ionStyle", 7);
61
- this.inputId = `ion-sel-${selectIds++}`;
62
- this.didInit = false;
63
- this.isExpanded = false;
64
- /**
65
- * If `true`, the user cannot interact with the select.
66
- */
67
- this.disabled = false;
68
- /**
69
- * The text to display on the cancel button.
70
- */
71
- this.cancelText = 'Cancel';
72
- /**
73
- * The text to display on the ok button.
74
- */
75
- this.okText = 'OK';
76
- /**
77
- * The name of the control, which is submitted with the form data.
78
- */
79
- this.name = this.inputId;
80
- /**
81
- * If `true`, the select can accept multiple values.
82
- */
83
- this.multiple = false;
84
- /**
85
- * The interface the select should use: `action-sheet`, `popover` or `alert`.
86
- */
87
- this.interface = 'alert';
88
- /**
89
- * Any additional options that the `alert`, `action-sheet` or `popover` interface
90
- * can take. See the [ion-alert docs](./alert), the
91
- * [ion-action-sheet docs](./action-sheet) and the
92
- * [ion-popover docs](./popover) for the
93
- * create options for each interface.
94
- *
95
- * Note: `interfaceOptions` will not override `inputs` or `buttons` with the `alert` interface.
96
- */
97
- this.interfaceOptions = {};
98
- this.onClick = (ev) => {
99
- this.setFocus();
100
- this.open(ev);
101
- };
102
- this.onFocus = () => {
103
- this.ionFocus.emit();
104
- };
105
- this.onBlur = () => {
106
- this.ionBlur.emit();
107
- };
108
- }
109
- styleChanged() {
110
- this.emitStyle();
111
- }
112
- valueChanged() {
113
- this.emitStyle();
114
- // TODO: FW-1160 - Remove the `didInit` property when ionChange behavior is changed in v7.
115
- if (this.didInit) {
116
- this.ionChange.emit({
117
- value: this.value,
118
- });
119
- }
120
- }
121
- async connectedCallback() {
122
- this.updateOverlayOptions();
123
- this.emitStyle();
124
- this.mutationO = watchForOptions(this.el, 'ion-select-option', async () => {
125
- this.updateOverlayOptions();
126
- });
127
- }
128
- disconnectedCallback() {
129
- if (this.mutationO) {
130
- this.mutationO.disconnect();
131
- this.mutationO = undefined;
132
- }
133
- }
134
- componentDidLoad() {
135
- this.didInit = true;
136
- }
137
- /**
138
- * Open the select overlay. The overlay is either an alert, action sheet, or popover,
139
- * depending on the `interface` property on the `ion-select`.
140
- *
141
- * @param event The user interface event that called the open.
142
- */
143
- async open(event) {
144
- if (this.disabled || this.isExpanded) {
145
- return undefined;
146
- }
147
- this.isExpanded = true;
148
- const overlay = (this.overlay = await this.createOverlay(event));
149
- overlay.onDidDismiss().then(() => {
150
- this.overlay = undefined;
151
- this.isExpanded = false;
152
- this.ionDismiss.emit();
153
- this.setFocus();
154
- });
155
- await overlay.present();
156
- // focus selected option for popovers
157
- if (this.interface === 'popover') {
158
- let indexOfSelected = this.childOpts.map((o) => o.value).indexOf(this.value);
159
- indexOfSelected = indexOfSelected > -1 ? indexOfSelected : 0; // default to first option if nothing selected
160
- const selectedEl = overlay.querySelector(`.select-interface-option:nth-child(${indexOfSelected + 1})`);
161
- if (selectedEl) {
162
- helpers.focusElement(selectedEl);
163
- }
164
- }
165
- return overlay;
166
- }
167
- createOverlay(ev) {
168
- let selectInterface = this.interface;
169
- if (selectInterface === 'action-sheet' && this.multiple) {
170
- console.warn(`Select interface cannot be "${selectInterface}" with a multi-value select. Using the "alert" interface instead.`);
171
- selectInterface = 'alert';
172
- }
173
- if (selectInterface === 'popover' && !ev) {
174
- console.warn(`Select interface cannot be a "${selectInterface}" without passing an event. Using the "alert" interface instead.`);
175
- selectInterface = 'alert';
176
- }
177
- if (selectInterface === 'action-sheet') {
178
- return this.openActionSheet();
179
- }
180
- if (selectInterface === 'popover') {
181
- return this.openPopover(ev);
182
- }
183
- return this.openAlert();
184
- }
185
- updateOverlayOptions() {
186
- const overlay = this.overlay;
187
- if (!overlay) {
188
- return;
189
- }
190
- const childOpts = this.childOpts;
191
- const value = this.value;
192
- switch (this.interface) {
193
- case 'action-sheet':
194
- overlay.buttons = this.createActionSheetButtons(childOpts, value);
195
- break;
196
- case 'popover':
197
- const popover = overlay.querySelector('ion-select-popover');
198
- if (popover) {
199
- popover.options = this.createPopoverOptions(childOpts, value);
200
- }
201
- break;
202
- case 'alert':
203
- const inputType = this.multiple ? 'checkbox' : 'radio';
204
- overlay.inputs = this.createAlertInputs(childOpts, inputType, value);
205
- break;
206
- }
207
- }
208
- createActionSheetButtons(data, selectValue) {
209
- const actionSheetButtons = data.map((option) => {
210
- const value = getOptionValue(option);
211
- // Remove hydrated before copying over classes
212
- const copyClasses = Array.from(option.classList)
213
- .filter((cls) => cls !== 'hydrated')
214
- .join(' ');
215
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
216
- return {
217
- role: isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : '',
218
- text: option.textContent,
219
- cssClass: optClass,
220
- handler: () => {
221
- this.value = value;
222
- },
223
- };
224
- });
225
- // Add "cancel" button
226
- actionSheetButtons.push({
227
- text: this.cancelText,
228
- role: 'cancel',
229
- handler: () => {
230
- this.ionCancel.emit();
231
- },
232
- });
233
- return actionSheetButtons;
234
- }
235
- createAlertInputs(data, inputType, selectValue) {
236
- const alertInputs = data.map((option) => {
237
- const value = getOptionValue(option);
238
- // Remove hydrated before copying over classes
239
- const copyClasses = Array.from(option.classList)
240
- .filter((cls) => cls !== 'hydrated')
241
- .join(' ');
242
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
243
- return {
244
- type: inputType,
245
- cssClass: optClass,
246
- label: option.textContent || '',
247
- value,
248
- checked: isOptionSelected(selectValue, value, this.compareWith),
249
- disabled: option.disabled,
250
- };
251
- });
252
- return alertInputs;
253
- }
254
- createPopoverOptions(data, selectValue) {
255
- const popoverOptions = data.map((option) => {
256
- const value = getOptionValue(option);
257
- // Remove hydrated before copying over classes
258
- const copyClasses = Array.from(option.classList)
259
- .filter((cls) => cls !== 'hydrated')
260
- .join(' ');
261
- const optClass = `${OPTION_CLASS} ${copyClasses}`;
262
- return {
263
- text: option.textContent || '',
264
- cssClass: optClass,
265
- value,
266
- checked: isOptionSelected(selectValue, value, this.compareWith),
267
- disabled: option.disabled,
268
- handler: (selected) => {
269
- this.value = selected;
270
- if (!this.multiple) {
271
- this.close();
272
- }
273
- },
274
- };
275
- });
276
- return popoverOptions;
277
- }
278
- async openPopover(ev) {
279
- const interfaceOptions = this.interfaceOptions;
280
- const mode = ionicGlobal.getIonMode(this);
281
- const showBackdrop = mode === 'md' ? false : true;
282
- const multiple = this.multiple;
283
- const value = this.value;
284
- let event = ev;
285
- let size = 'auto';
286
- const item = this.el.closest('ion-item');
287
- // If the select is inside of an item containing a floating
288
- // or stacked label then the popover should take up the
289
- // full width of the item when it presents
290
- if (item && (item.classList.contains('item-label-floating') || item.classList.contains('item-label-stacked'))) {
291
- event = Object.assign(Object.assign({}, ev), { detail: {
292
- ionShadowTarget: item,
293
- } });
294
- size = 'cover';
295
- }
296
- const popoverOpts = Object.assign(Object.assign({ mode,
297
- event, alignment: 'center', size,
298
- showBackdrop }, interfaceOptions), { component: 'ion-select-popover', cssClass: ['select-popover', interfaceOptions.cssClass], componentProps: {
299
- header: interfaceOptions.header,
300
- subHeader: interfaceOptions.subHeader,
301
- message: interfaceOptions.message,
302
- multiple,
303
- value,
304
- options: this.createPopoverOptions(this.childOpts, value),
305
- } });
306
- return overlays.popoverController.create(popoverOpts);
307
- }
308
- async openActionSheet() {
309
- const mode = ionicGlobal.getIonMode(this);
310
- const interfaceOptions = this.interfaceOptions;
311
- const actionSheetOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { buttons: this.createActionSheetButtons(this.childOpts, this.value), cssClass: ['select-action-sheet', interfaceOptions.cssClass] });
312
- return overlays.actionSheetController.create(actionSheetOpts);
313
- }
314
- async openAlert() {
315
- const label = this.getLabel();
316
- const labelText = label ? label.textContent : null;
317
- const interfaceOptions = this.interfaceOptions;
318
- const inputType = this.multiple ? 'checkbox' : 'radio';
319
- const mode = ionicGlobal.getIonMode(this);
320
- const alertOpts = Object.assign(Object.assign({ mode }, interfaceOptions), { header: interfaceOptions.header ? interfaceOptions.header : labelText, inputs: this.createAlertInputs(this.childOpts, inputType, this.value), buttons: [
321
- {
322
- text: this.cancelText,
323
- role: 'cancel',
324
- handler: () => {
325
- this.ionCancel.emit();
326
- },
327
- },
328
- {
329
- text: this.okText,
330
- handler: (selectedValues) => {
331
- this.value = selectedValues;
332
- },
333
- },
334
- ], cssClass: [
335
- 'select-alert',
336
- interfaceOptions.cssClass,
337
- this.multiple ? 'multiple-select-alert' : 'single-select-alert',
338
- ] });
339
- return overlays.alertController.create(alertOpts);
340
- }
341
- /**
342
- * Close the select interface.
343
- */
344
- close() {
345
- // TODO check !this.overlay || !this.isFocus()
346
- if (!this.overlay) {
347
- return Promise.resolve(false);
348
- }
349
- return this.overlay.dismiss();
350
- }
351
- getLabel() {
352
- return helpers.findItemLabel(this.el);
353
- }
354
- hasValue() {
355
- return this.getText() !== '';
356
- }
357
- get childOpts() {
358
- return Array.from(this.el.querySelectorAll('ion-select-option'));
359
- }
360
- getText() {
361
- const selectedText = this.selectedText;
362
- if (selectedText != null && selectedText !== '') {
363
- return selectedText;
364
- }
365
- return generateText(this.childOpts, this.value, this.compareWith);
366
- }
367
- setFocus() {
368
- if (this.focusEl) {
369
- this.focusEl.focus();
370
- }
371
- }
372
- emitStyle() {
373
- this.ionStyle.emit({
374
- interactive: true,
375
- 'interactive-disabled': this.disabled,
376
- select: true,
377
- 'select-disabled': this.disabled,
378
- 'has-placeholder': this.placeholder !== undefined,
379
- 'has-value': this.hasValue(),
380
- 'has-focus': this.isExpanded,
381
- });
382
- }
383
- render() {
384
- const { disabled, el, inputId, isExpanded, name, placeholder, value } = this;
385
- const mode = ionicGlobal.getIonMode(this);
386
- const { labelText, labelId } = helpers.getAriaLabel(el, inputId);
387
- helpers.renderHiddenInput(true, el, name, parseValue(value), disabled);
388
- const displayValue = this.getText();
389
- let addPlaceholderClass = false;
390
- let selectText = displayValue;
391
- if (selectText === '' && placeholder !== undefined) {
392
- selectText = placeholder;
393
- addPlaceholderClass = true;
394
- }
395
- const selectTextClasses = {
396
- 'select-text': true,
397
- 'select-placeholder': addPlaceholderClass,
398
- };
399
- const textPart = addPlaceholderClass ? 'placeholder' : 'text';
400
- // If there is a label then we need to concatenate it with the
401
- // current value (or placeholder) and a comma so it separates
402
- // nicely when the screen reader announces it, otherwise just
403
- // announce the value / placeholder
404
- const displayLabel = labelText !== undefined ? (selectText !== '' ? `${selectText}, ${labelText}` : labelText) : selectText;
405
- return (index.h(index.Host, { onClick: this.onClick, role: "button", "aria-haspopup": "listbox", "aria-disabled": disabled ? 'true' : null, "aria-label": displayLabel, class: {
406
- [mode]: true,
407
- 'in-item': theme.hostContext('ion-item', el),
408
- 'select-disabled': disabled,
409
- 'select-expanded': isExpanded,
410
- } }, index.h("div", { "aria-hidden": "true", class: selectTextClasses, part: textPart }, selectText), index.h("div", { class: "select-icon", role: "presentation", part: "icon" }, index.h("div", { class: "select-icon-inner" })), index.h("label", { id: labelId }, displayLabel), index.h("button", { type: "button", disabled: disabled, id: inputId, "aria-labelledby": labelId, "aria-haspopup": "listbox", "aria-expanded": `${isExpanded}`, onFocus: this.onFocus, onBlur: this.onBlur, ref: (focusEl) => (this.focusEl = focusEl) })));
411
- }
412
- get el() { return index.getElement(this); }
413
- static get watchers() { return {
414
- "disabled": ["styleChanged"],
415
- "placeholder": ["styleChanged"],
416
- "isExpanded": ["styleChanged"],
417
- "value": ["valueChanged"]
418
- }; }
419
- };
420
- const isOptionSelected = (currentValue, compareValue, compareWith) => {
421
- if (currentValue === undefined) {
422
- return false;
423
- }
424
- if (Array.isArray(currentValue)) {
425
- return currentValue.some((val) => compareOptions(val, compareValue, compareWith));
426
- }
427
- else {
428
- return compareOptions(currentValue, compareValue, compareWith);
429
- }
430
- };
431
- const getOptionValue = (el) => {
432
- const value = el.value;
433
- return value === undefined ? el.textContent || '' : value;
434
- };
435
- const parseValue = (value) => {
436
- if (value == null) {
437
- return undefined;
438
- }
439
- if (Array.isArray(value)) {
440
- return value.join(',');
441
- }
442
- return value.toString();
443
- };
444
- const compareOptions = (currentValue, compareValue, compareWith) => {
445
- if (typeof compareWith === 'function') {
446
- return compareWith(currentValue, compareValue);
447
- }
448
- else if (typeof compareWith === 'string') {
449
- return currentValue[compareWith] === compareValue[compareWith];
450
- }
451
- else {
452
- return Array.isArray(compareValue) ? compareValue.includes(currentValue) : currentValue === compareValue;
453
- }
454
- };
455
- const generateText = (opts, value, compareWith) => {
456
- if (value === undefined) {
457
- return '';
458
- }
459
- if (Array.isArray(value)) {
460
- return value
461
- .map((v) => textForValue(opts, v, compareWith))
462
- .filter((opt) => opt !== null)
463
- .join(', ');
464
- }
465
- else {
466
- return textForValue(opts, value, compareWith) || '';
467
- }
468
- };
469
- const textForValue = (opts, value, compareWith) => {
470
- const selectOpt = opts.find((opt) => {
471
- return compareOptions(getOptionValue(opt), value, compareWith);
472
- });
473
- return selectOpt ? selectOpt.textContent : null;
474
- };
475
- let selectIds = 0;
476
- const OPTION_CLASS = 'select-interface-option';
477
- Select.style = {
478
- ios: selectIosCss,
479
- md: selectMdCss
480
- };
481
-
482
- const selectOptionCss = ":host{display:none}";
483
-
484
- const SelectOption = class {
485
- constructor(hostRef) {
486
- index.registerInstance(this, hostRef);
487
- this.inputId = `ion-selopt-${selectOptionIds++}`;
488
- /**
489
- * If `true`, the user cannot interact with the select option. This property does not apply when `interface="action-sheet"` as `ion-action-sheet` does not allow for disabled buttons.
490
- */
491
- this.disabled = false;
492
- }
493
- render() {
494
- return index.h(index.Host, { role: "option", id: this.inputId, class: ionicGlobal.getIonMode(this) });
495
- }
496
- get el() { return index.getElement(this); }
497
- };
498
- let selectOptionIds = 0;
499
- SelectOption.style = selectOptionCss;
500
-
501
- const sparkleFeedPostCss = ":host{display:block}.post-footer-container{display:flex;justify-content:flex-end}.post-footer{display:flex;justify-content:space-between;align-items:center}.error{color:red;margin-right:10px}.success{color:green;margin-right:10px}.uploaded-image{display:block;max-height:140px;width:auto !important}.public-post-toggle{display:flex;justify-content:flex-end;align-items:center}.assignment-name{display:none}";
502
-
503
- const SparkleFeedPost = class {
504
- constructor(hostRef) {
505
- index.registerInstance(this, hostRef);
506
- }
507
- // @Prop({ connect: 'ion-toast-controller' })
508
- // toastCtrl: HTMLIonToastControllerElement;
509
- componentDidLoad() {
510
- this.postText = this.textValue;
511
- if (this.ref && this.ref.innerText) {
512
- this.assignmentName = this.ref.innerText;
513
- console.log(this.assignmentName);
514
- }
515
- }
516
- setText(text) {
517
- this.postText = text;
518
- }
519
- // async postToFeed() {
520
- // const sparkleConfig: EnvironmentSparkleConfig = EnvironmentConfigService.getInstance().get('sparkle');
521
- // const tocData = await AssetsService.getInstance().loadJsonFile<ICourse>(sparkleConfig.tocPath);
522
- // var model = {
523
- // CourseId: tocData.id,
524
- // MiniAppId: SparkleGlobal.MY_GOALS_APP_ID,
525
- // PostText: MyGoalTemplate(this.name.value, this.goalUpdateText.value, this.progress),
526
- // PostTextJSON: MyGoalTemplateJSON(this.name.value, this.goalUpdateText.value, this.progress),
527
- // IsPublic: this.public,
528
- // ExternalResourceUrl: "",
529
- // }
530
- // const result = await FeedService.getInstance().createPost(model);
531
- // if (result.Succeeded) {
532
- // //show success toast
533
- // }
534
- // }
535
- isAuthenticated() {
536
- try {
537
- var sparkleConfig = environmentConfig_service.EnvironmentConfigService.getInstance().get('sparkle');
538
- if (!!sparkleConfig && !!sparkleConfig.auth && !!sparkleConfig.auth.getToken()) {
539
- return true;
540
- }
541
- }
542
- catch (_a) {
543
- return false;
544
- }
545
- }
546
- submitPost() {
547
- this.errorMessage = '';
548
- this.successMessage = '';
549
- //let formData = new FormData(this.el.querySelector("form")) as any;
550
- //var postText = this.el.getElementsByClassName("PostText")[0] as HTMLInputElement;
551
- this.el.getElementsByClassName('PostExternalUrl')[0];
552
- this.el.getElementsByClassName('IsPublic')[0];
553
- // this.dataSvc.saveData(data, '/api/class/feed').subscribe(
554
- // x => {
555
- // this.successMessage = 'Posted Successfully.';
556
- // // this.presentToast('Success');
557
- // },
558
- // error => {
559
- // this.errorMessage = 'There is an error while posting.';
560
- // // this.presentToast('There is an error');
561
- // },
562
- // );
563
- //TODO can we return data from the dataSvc so we know if it's successful and can update the form? (Perhaps replace it with the post itself?)
564
- // if (this.assignmentName) {
565
- // data.AssignmentData = JSON.stringify({ text: data.PostText, url: data.ExternalResourceUrl });
566
- // this.dataSvc.saveData(data, '/api/student/assignment-response').subscribe(
567
- // x => {
568
- // this.successMessage = 'Posted Successfully.';
569
- // // this.presentToast('Success');
570
- // },
571
- // error => {
572
- // this.errorMessage = 'There is an error while posting.';
573
- // // this.presentToast('There is an error');
574
- // },
575
- // );
576
- // }
577
- }
578
- uploadImage(evt) {
579
- // this.uploadImageLoading = true;
580
- // var files = evt.target.files;
581
- // this.dataSvc.uploadImage(files, '/api/mediaitems/upload').subscribe(
582
- // x => {
583
- // this.uploadImageLoading = false;
584
- // this.uploadedImage = x.length > 0 ? x[0].FullImageUrl : '';
585
- // this.externalResourceUrl = x.length > 0 ? x[0].FullImageUrl : '';
586
- // //this.successMessage = 'Posted Successfully.'
587
- // // this.presentToast('Success');
588
- // },
589
- // error => {
590
- // this.uploadImageLoading = false;
591
- // this.errorMessage = 'There is an error while uploading an image.';
592
- // },
593
- // );
594
- }
595
- selectFile() {
596
- var fileInput = document.getElementById('fileInput');
597
- fileInput.click();
598
- }
599
- renderUserInfo() {
600
- var tokenInfo = { Token: null, ProfileImageUrl: null };
601
- if (tokenInfo != null && tokenInfo.Token) {
602
- return (index.h("ion-avatar", { class: "header-avatar", slot: "end" }, index.h("img", { src: "/assets/img/avatar.png" })));
603
- }
604
- else {
605
- return (index.h("ion-button", { slot: "end", href: "/login" }, "Login to Post"));
606
- }
607
- }
608
- render() {
609
- const userInfo = this.renderUserInfo();
610
- return (index.h(index.Host, null, index.h("div", { class: "assignment-name", ref: el => (this.ref = el) }, index.h("slot", null)), index.h("ion-card", null, index.h("ion-item", { class: "header", lines: "full" }, userInfo), index.h("ion-card-content", null, index.h("form", null, index.h("ion-list", null, index.h("ion-item", { class: "padding" }, index.h("ion-textarea", { class: "PostText", required: true, placeholder: "Post Text", name: "PostText", value: this.postText })), index.h("ion-item", { class: "padding" }, index.h("ion-input", { class: "PostExternalUrl", required: true, type: "text", placeholder: "URL", name: "ExternalResourceUrl", value: this.externalResourceUrl })), this.uploadedImage ? (index.h("ion-item", { class: "padding" }, index.h("img", { class: "uploaded-image", src: this.uploadedImage }))) : (''), index.h("ion-item", { lines: "none" }, index.h("input", { type: "file", id: "fileInput", onChange: evt => this.uploadImage(evt), style: { display: 'none' }, accept: "image/*" }), this.uploadImageLoading ? index.h("ion-spinner", { color: "primary" }) : '', index.h("ion-button", { slot: "start", onClick: evt => this.selectFile() }, index.h("ion-icon", { name: "add" }), "Upload Image")), index.h("div", { class: "public-post-toggle" }, index.h("ion-toggle", { class: "IsPublic", color: "primary", name: "IsPublic" }), index.h("div", null, "Public Post")), index.h("div", { class: "post-footer-container" }, index.h("div", { class: "post-footer" }, index.h("div", null, index.h("div", { class: "error" }, this.errorMessage), index.h("div", { class: "success" }, this.successMessage)), index.h("ion-button", { slot: "end", size: "default", onClick: evt => this.submitPost(), disabled: !this.isAuthenticated() }, "Post")))))))));
611
- }
612
- get el() { return index.getElement(this); }
613
- };
614
- SparkleFeedPost.style = sparkleFeedPostCss;
615
-
616
- exports.ion_select = Select;
617
- exports.ion_select_option = SelectOption;
618
- exports.sparkle_feed_post = SparkleFeedPost;