@pie-element/charting 2.7.3-next.137 → 2.7.3-next.1370
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/CHANGELOG.md +287 -0
- package/configure/CHANGELOG.md +240 -0
- package/configure/lib/charting-config.js +123 -19
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/configure.js +131 -64
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +182 -44
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +46 -5
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +24 -4
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/utils.js +95 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +6 -5
- package/controller/CHANGELOG.md +62 -0
- package/controller/lib/index.js +40 -21
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +193 -0
- package/docs/config-schema.json.md +151 -1
- package/docs/demo/generate.js +7 -26
- package/docs/demo/session.js +3 -9
- package/docs/pie-schema.json +114 -48
- package/docs/pie-schema.json.md +82 -9
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib/main.js +12 -23
- package/lib/main.js.map +1 -1
- package/package.json +6 -6
- package/configure/lib/chart-type.js +0 -72
- package/configure/lib/chart-type.js.map +0 -1
package/docs/pie-schema.json.md
CHANGED
|
@@ -69,10 +69,6 @@ Label step value
|
|
|
69
69
|
|
|
70
70
|
Axis Label
|
|
71
71
|
|
|
72
|
-
# `editCategoryEnabled` (boolean, required)
|
|
73
|
-
|
|
74
|
-
Indicates if user can edit default categories
|
|
75
|
-
|
|
76
72
|
# `graph` (object, required)
|
|
77
73
|
|
|
78
74
|
Properties of the `graph` object:
|
|
@@ -142,10 +138,26 @@ Indicates teacher instructions
|
|
|
142
138
|
|
|
143
139
|
Indicates chart title
|
|
144
140
|
|
|
141
|
+
# `placeholderMessages` (object)
|
|
142
|
+
|
|
143
|
+
Properties of the `placeholderMessages` object:
|
|
144
|
+
|
|
145
|
+
## `title` (string, required)
|
|
146
|
+
|
|
147
|
+
Indicates placeholder message if title is not defined
|
|
148
|
+
|
|
149
|
+
## `labels` (string, required)
|
|
150
|
+
|
|
151
|
+
Indicates placeholder message if labels for range or domain are not defined
|
|
152
|
+
|
|
145
153
|
# `rationaleEnabled` (boolean, required)
|
|
146
154
|
|
|
147
155
|
Indicates if Rationale are enabled
|
|
148
156
|
|
|
157
|
+
# `spellCheckEnabled` (boolean, required)
|
|
158
|
+
|
|
159
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
160
|
+
|
|
149
161
|
# `studentInstructionsEnabled` (boolean, required)
|
|
150
162
|
|
|
151
163
|
Indicates if Student Instructions are enabled
|
|
@@ -154,6 +166,10 @@ Indicates if Student Instructions are enabled
|
|
|
154
166
|
|
|
155
167
|
Indicates if Teacher Instructions are enabled
|
|
156
168
|
|
|
169
|
+
# `rubricEnabled` (boolean, required)
|
|
170
|
+
|
|
171
|
+
Indicates if Rubric is enabled
|
|
172
|
+
|
|
157
173
|
# `id` (string, required)
|
|
158
174
|
|
|
159
175
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -180,6 +196,39 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
180
196
|
|
|
181
197
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
182
198
|
|
|
199
|
+
## `LabelsPlaceholderConfigProp` (object)
|
|
200
|
+
|
|
201
|
+
Properties of the `LabelsPlaceholderConfigProp` object:
|
|
202
|
+
|
|
203
|
+
### `top` (string)
|
|
204
|
+
|
|
205
|
+
This value is empty for charting. The property exist in order to be consistent with graphing configuration.
|
|
206
|
+
|
|
207
|
+
### `right` (string)
|
|
208
|
+
|
|
209
|
+
This value is empty for charting. The property exist in order to be consistent with graphing configuration.
|
|
210
|
+
|
|
211
|
+
### `bottom` (string)
|
|
212
|
+
|
|
213
|
+
Indicates the placeholder for the bottom label
|
|
214
|
+
|
|
215
|
+
### `left` (string)
|
|
216
|
+
|
|
217
|
+
Indicates the placeholder for the left label
|
|
218
|
+
|
|
219
|
+
### `settings` (boolean)
|
|
220
|
+
|
|
221
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
222
|
+
|
|
223
|
+
### `label` (string)
|
|
224
|
+
|
|
225
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
226
|
+
|
|
227
|
+
### `enabled` (boolean)
|
|
228
|
+
|
|
229
|
+
Indicates the value of the item if it affects config-ui
|
|
230
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
231
|
+
|
|
183
232
|
## `ConfigurePropWithEnabled` (object)
|
|
184
233
|
|
|
185
234
|
Properties of the `ConfigurePropWithEnabled` object:
|
|
@@ -197,6 +246,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
197
246
|
Indicates the value of the item if it affects config-ui
|
|
198
247
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
199
248
|
|
|
249
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
250
|
+
|
|
251
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
252
|
+
|
|
253
|
+
### `teacherInstructions` (number)
|
|
254
|
+
|
|
255
|
+
Indicates the max dimension for images in teacher instructions
|
|
256
|
+
|
|
257
|
+
### `prompt` (number)
|
|
258
|
+
|
|
259
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
260
|
+
|
|
261
|
+
### `rationale` (number)
|
|
262
|
+
|
|
263
|
+
Indicates the max dimension for images in rationale
|
|
264
|
+
|
|
200
265
|
## `Answer` (object)
|
|
201
266
|
|
|
202
267
|
Properties of the `Answer` object:
|
|
@@ -225,10 +290,6 @@ Indicates category label
|
|
|
225
290
|
|
|
226
291
|
Indicates category value
|
|
227
292
|
|
|
228
|
-
### `initial` (boolean, required)
|
|
229
|
-
|
|
230
|
-
Indicates if category is default category
|
|
231
|
-
|
|
232
293
|
### `interactive` (boolean, required)
|
|
233
294
|
|
|
234
295
|
Indicates if category label & value are interactive
|
|
@@ -295,4 +356,16 @@ Width for chart representation
|
|
|
295
356
|
|
|
296
357
|
### `height` (number, required)
|
|
297
358
|
|
|
298
|
-
Height for chart representation
|
|
359
|
+
Height for chart representation
|
|
360
|
+
|
|
361
|
+
## `Placeholder` (object)
|
|
362
|
+
|
|
363
|
+
Properties of the `Placeholder` object:
|
|
364
|
+
|
|
365
|
+
### `title` (string, required)
|
|
366
|
+
|
|
367
|
+
Indicates placeholder message if title is not defined
|
|
368
|
+
|
|
369
|
+
### `labels` (string, required)
|
|
370
|
+
|
|
371
|
+
Indicates placeholder message if labels for range or domain are not defined
|
package/lib/index.js
CHANGED
|
@@ -41,7 +41,7 @@ var _mathRendering = require("@pie-lib/math-rendering");
|
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
43
|
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
44
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
45
|
|
|
46
46
|
var Graphing = /*#__PURE__*/function (_HTMLElement) {
|
|
47
47
|
(0, _inherits2["default"])(Graphing, _HTMLElement);
|
|
@@ -75,6 +75,9 @@ var Graphing = /*#__PURE__*/function (_HTMLElement) {
|
|
|
75
75
|
}
|
|
76
76
|
}, {
|
|
77
77
|
key: "session",
|
|
78
|
+
get: function get() {
|
|
79
|
+
return this._session;
|
|
80
|
+
},
|
|
78
81
|
set: function set(s) {
|
|
79
82
|
this._session = s;
|
|
80
83
|
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","categories","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["Graphing","answer","Array","isArray","length","_session","dispatchEvent","SessionChangedEvent","tagName","toLowerCase","isComplete","_render","m","_model","s","el","React","createElement","Main","model","categories","onAnswersChange","changeAnswers","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;IAIqBA,Q;;;;;AACnB,sBAAc;AAAA;;AAAA;AACZ;AADY,mGAsBD,UAAAC,MAAM;AAAA,aAAIC,KAAK,CAACC,OAAN,CAAcF,MAAd,KAAyBA,MAAM,CAACG,MAAP,GAAgB,CAA7C;AAAA,KAtBL;AAAA,sGAwBE,UAAAH,MAAM,EAAI;AACxB,YAAKI,QAAL,CAAcJ,MAAd,GAAuBA,MAAvB;;AAEA,YAAKK,aAAL,CACE,IAAIC,oCAAJ,CACE,MAAKC,OAAL,CAAaC,WAAb,EADF,EAEE,MAAKC,UAAL,CAAgB,MAAKL,QAAL,CAAcJ,MAA9B,CAFF,CADF;;AAOA,YAAKU,OAAL;AACD,KAnCa;AAAA;AAEb;;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKC,MAAL,GAAcD,CAAd;;AACA,WAAKD,OAAL;AACD;;;SAOD,eAAc;AACZ,aAAO,KAAKN,QAAZ;AACD,K;SAPD,aAAYS,CAAZ,EAAe;AACb,WAAKT,QAAL,GAAgBS,CAAhB;;AACA,WAAKH,OAAL;AACD;;;WAMD,6BAAoB;AAClB,WAAKA,OAAL;AACD;;;WAiBD,mBAAU;AAAA;;AACR,UAAI,CAAC,KAAKE,MAAN,IAAgB,CAAC,KAAKR,QAA1B,EAAoC;AAClC;AACD;;AAED,UAAMU,EAAE,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACnCC,QAAAA,KAAK,EAAE,KAAKN,MADuB;AAEnCO,QAAAA,UAAU,EAAE,KAAKf,QAAL,CAAcJ,MAFS;AAGnCoB,QAAAA,eAAe,EAAE,KAAKC;AAHa,OAA1B,CAAX;;AAMAC,2BAASC,MAAT,CAAgBT,EAAhB,EAAoB,IAApB,EAA0B,YAAM;AAC9B,uCAAW,MAAX;AACD,OAFD;AAGD;;;kDApDmCU,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport Main from './main';\nimport { SessionChangedEvent } from '@pie-framework/pie-player-events';\nimport { renderMath } from '@pie-lib/math-rendering';\n\nexport { Main as Component };\n\nexport default class Graphing extends HTMLElement {\n constructor() {\n super();\n }\n\n set model(m) {\n this._model = m;\n this._render();\n }\n\n set session(s) {\n this._session = s;\n this._render();\n }\n\n get session() {\n return this._session;\n }\n\n connectedCallback() {\n this._render();\n }\n\n isComplete = answer => Array.isArray(answer) && answer.length > 0;\n\n changeAnswers = answer => {\n this._session.answer = answer;\n\n this.dispatchEvent(\n new SessionChangedEvent(\n this.tagName.toLowerCase(),\n this.isComplete(this._session.answer)\n )\n );\n\n this._render();\n };\n\n _render() {\n if (!this._model || !this._session) {\n return;\n }\n\n const el = React.createElement(Main, {\n model: this._model,\n categories: this._session.answer,\n onAnswersChange: this.changeAnswers\n });\n\n ReactDOM.render(el, this, () => {\n renderMath(this);\n });\n }\n}\n"],"file":"index.js"}
|
package/lib/main.js
CHANGED
|
@@ -35,13 +35,13 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
|
35
35
|
|
|
36
36
|
var _correctAnswerToggle = _interopRequireDefault(require("@pie-lib/correct-answer-toggle"));
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
43
|
|
|
44
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
44
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
45
|
|
|
46
46
|
var Main = /*#__PURE__*/function (_React$Component) {
|
|
47
47
|
(0, _inherits2["default"])(Main, _React$Component);
|
|
@@ -106,7 +106,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
106
106
|
domain = model.domain,
|
|
107
107
|
range = model.range,
|
|
108
108
|
title = model.title,
|
|
109
|
-
editCategoryEnabled = model.editCategoryEnabled,
|
|
110
109
|
addCategoryEnabled = model.addCategoryEnabled,
|
|
111
110
|
categoryDefaultLabel = model.categoryDefaultLabel,
|
|
112
111
|
rationale = model.rationale,
|
|
@@ -130,15 +129,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
130
129
|
hidden: 'Show Teacher Instructions',
|
|
131
130
|
visible: 'Hide Teacher Instructions'
|
|
132
131
|
}
|
|
133
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
className: classes.prompt,
|
|
139
|
-
dangerouslySetInnerHTML: {
|
|
140
|
-
__html: prompt
|
|
141
|
-
}
|
|
132
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
133
|
+
prompt: teacherInstructions
|
|
134
|
+
})), /*#__PURE__*/_react["default"].createElement("br", null)), prompt && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
135
|
+
className: "prompt",
|
|
136
|
+
prompt: prompt
|
|
142
137
|
}), /*#__PURE__*/_react["default"].createElement("br", null)), showingCorrect && showToggle ? /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
143
138
|
chartType: chartType,
|
|
144
139
|
size: size,
|
|
@@ -148,7 +143,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
148
143
|
data: correctData || categories,
|
|
149
144
|
title: title,
|
|
150
145
|
onDataChange: this.changeData,
|
|
151
|
-
editCategoryEnabled: false,
|
|
152
146
|
addCategoryEnabled: false,
|
|
153
147
|
categoryDefaultLabel: categoryDefaultLabel
|
|
154
148
|
}) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
@@ -160,7 +154,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
160
154
|
data: correctedAnswer || categories,
|
|
161
155
|
title: title,
|
|
162
156
|
onDataChange: this.changeData,
|
|
163
|
-
editCategoryEnabled: editCategoryEnabled,
|
|
164
157
|
addCategoryEnabled: addCategoryEnabled,
|
|
165
158
|
categoryDefaultLabel: categoryDefaultLabel
|
|
166
159
|
}), /*#__PURE__*/_react["default"].createElement("br", null), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
|
@@ -168,10 +161,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
168
161
|
hidden: 'Show Rationale',
|
|
169
162
|
visible: 'Hide Rationale'
|
|
170
163
|
}
|
|
171
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
172
|
-
|
|
173
|
-
__html: rationale
|
|
174
|
-
}
|
|
164
|
+
}, /*#__PURE__*/_react["default"].createElement(_renderUi.PreviewPrompt, {
|
|
165
|
+
prompt: rationale
|
|
175
166
|
})));
|
|
176
167
|
}
|
|
177
168
|
}]);
|
|
@@ -194,10 +185,8 @@ var styles = function styles(theme) {
|
|
|
194
185
|
mainContainer: {
|
|
195
186
|
padding: theme.spacing.unit,
|
|
196
187
|
color: _renderUi.color.text(),
|
|
197
|
-
backgroundColor: _renderUi.color.background()
|
|
198
|
-
|
|
199
|
-
prompt: {
|
|
200
|
-
verticalAlign: 'middle'
|
|
188
|
+
backgroundColor: _renderUi.color.background(),
|
|
189
|
+
overflow: 'hidden'
|
|
201
190
|
}
|
|
202
191
|
};
|
|
203
192
|
};
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","toggleCorrect","hidden","visible","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","React","Component","PropTypes","object","isRequired","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,mGAkBN,UAACC,IAAD;AAAA,aACX,MAAKC,QAAL,CACE;AACEC,QAAAA,UAAU,EAAEF;AADd,OADF,EAIE;AAAA,eAAM,MAAKD,KAAL,CAAWI,eAAX,CAA2BH,IAA3B,CAAN;AAAA,OAJF,CADW;AAAA,KAlBM;AAAA,sGA0BH,UAACI,cAAD;AAAA,aAAoB,MAAKH,QAAL,CAAc;AAAEG,QAAAA,cAAc,EAAdA;AAAF,OAAd,CAApB;AAAA,KA1BG;AAGjB,UAAKC,KAAL,GAAa;AACXH,MAAAA,UAAU,EAAEH,KAAK,CAACG,UAAN,IAAoBH,KAAK,CAACO,KAAN,CAAYN,IADjC;AAEXI,MAAAA,cAAc,EAAE;AAFL,KAAb;AAHiB;AAOlB;;;;W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RhD,I,kBAQW;AAAEW,EAAAA,OAAO,EAAE;AAAX,C;;AAiJxB,IAAMsC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBpB,IAAAA,aAAa,EAAE;AACbqB,MAAAA,OAAO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAHJ;AAIbC,MAAAA,QAAQ,EAAE;AAJG;AADU,GAAZ;AAAA,CAAf;;eASe,wBAAWT,MAAX,EAAmBjD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport { Chart, chartTypes } from '@pie-lib/charting';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func,\n categories: PropTypes.array,\n };\n\n static defaultProps = { classes: {} };\n\n constructor(props) {\n super(props);\n\n this.state = {\n categories: props.categories || props.model.data,\n showingCorrect: false,\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: { data: nextData = [] } = {} } = nextProps;\n const { model: { data = [] } = {} } = this.props;\n\n if (!isEqual(nextData, data)) {\n this.setState({ categories: nextData });\n }\n }\n\n changeData = (data) =>\n this.setState(\n {\n categories: data,\n },\n () => this.props.onAnswersChange(data)\n );\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n render() {\n const { categories, showingCorrect } = this.state;\n const { model, classes } = this.props;\n const {\n teacherInstructions,\n prompt,\n chartType,\n size,\n domain,\n range,\n title,\n addCategoryEnabled,\n categoryDefaultLabel,\n rationale,\n correctedAnswer,\n correctAnswer,\n } = model;\n \n const correctData =\n correctAnswer && correctAnswer.data\n ? correctAnswer.data.map((data) => {\n return {\n ...data,\n interactive: false,\n editable: false,\n };\n })\n : [];\n\n const showToggle = correctData && correctData.length > 0;\n\n return (\n <div className={classes.mainContainer}>\n <CorrectAnswerToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n />\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt className=\"prompt\" prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n\n {showingCorrect && showToggle ? (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctData || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={false}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n ) : (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctedAnswer || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={addCategoryEnabled}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n )}\n\n <br />\n {rationale && hasText(rationale) && (\n <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background(),\n overflow: 'hidden'\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "2.7.3-next.
|
|
7
|
+
"version": "2.7.3-next.1370+0162bc57f",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@material-ui/core": "^3.9.2",
|
|
15
15
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/charting": "^
|
|
17
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
18
|
-
"@pie-lib/math-rendering": "^2.
|
|
19
|
-
"@pie-lib/render-ui": "^4.
|
|
16
|
+
"@pie-lib/charting": "^5.3.0",
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "^2.3.46",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.5.0",
|
|
19
|
+
"@pie-lib/render-ui": "^4.13.6",
|
|
20
20
|
"classnames": "^2.2.5",
|
|
21
21
|
"debug": "^4.1.1",
|
|
22
22
|
"lodash": "^4.17.15",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "0162bc57f92a6d09e409c993a5b7005e4fdf56b4",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _styles = require("@material-ui/core/styles");
|
|
13
|
-
|
|
14
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
15
|
-
|
|
16
|
-
var _FormControl = _interopRequireDefault(require("@material-ui/core/FormControl"));
|
|
17
|
-
|
|
18
|
-
var _InputLabel = _interopRequireDefault(require("@material-ui/core/InputLabel"));
|
|
19
|
-
|
|
20
|
-
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
21
|
-
|
|
22
|
-
var _OutlinedInput = _interopRequireDefault(require("@material-ui/core/OutlinedInput"));
|
|
23
|
-
|
|
24
|
-
var ChartType = (0, _styles.withStyles)(function (theme) {
|
|
25
|
-
return {
|
|
26
|
-
formControl: {
|
|
27
|
-
width: '100%'
|
|
28
|
-
},
|
|
29
|
-
chartType: {
|
|
30
|
-
paddingTop: theme.spacing.unit * 2,
|
|
31
|
-
paddingBottom: theme.spacing.unit * 2
|
|
32
|
-
},
|
|
33
|
-
chartTypeLabel: {
|
|
34
|
-
transform: 'translate(0px, -16px) scale(0.75) !important'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
})(function (_ref) {
|
|
38
|
-
var onChange = _ref.onChange,
|
|
39
|
-
value = _ref.value,
|
|
40
|
-
classes = _ref.classes;
|
|
41
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
42
|
-
className: classes.chartType
|
|
43
|
-
}, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
44
|
-
variant: "outlined",
|
|
45
|
-
className: classes.formControl
|
|
46
|
-
}, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
|
|
47
|
-
htmlFor: "type-helper",
|
|
48
|
-
className: classes.chartTypeLabel
|
|
49
|
-
}, "ChartType"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
50
|
-
value: value,
|
|
51
|
-
onChange: onChange,
|
|
52
|
-
input: /*#__PURE__*/_react["default"].createElement(_OutlinedInput["default"], {
|
|
53
|
-
name: "type",
|
|
54
|
-
id: "type-helper"
|
|
55
|
-
})
|
|
56
|
-
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
57
|
-
value: 'histogram'
|
|
58
|
-
}, "Histogram"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
59
|
-
value: 'bar'
|
|
60
|
-
}, "Bar"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
61
|
-
value: 'lineDot'
|
|
62
|
-
}, "Line Dot"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
63
|
-
value: 'lineCross'
|
|
64
|
-
}, "Line Cross"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
65
|
-
value: 'dotPlot'
|
|
66
|
-
}, "Dot Plot"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
67
|
-
value: 'linePlot'
|
|
68
|
-
}, "Line Plot"))));
|
|
69
|
-
});
|
|
70
|
-
var _default = ChartType;
|
|
71
|
-
exports["default"] = _default;
|
|
72
|
-
//# sourceMappingURL=chart-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chart-type.js"],"names":["ChartType","theme","formControl","width","chartType","paddingTop","spacing","unit","paddingBottom","chartTypeLabel","transform","onChange","value","classes"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,SAAS,GAAG,wBAAW,UAAAC,KAAK;AAAA,SAAK;AACrCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,KAAK,EAAE;AADI,KADwB;AAIrCC,IAAAA,SAAS,EAAE;AACTC,MAAAA,UAAU,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CADxB;AAETC,MAAAA,aAAa,EAAEP,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;AAF3B,KAJ0B;AAQrCE,IAAAA,cAAc,EAAE;AACdC,MAAAA,SAAS,EAAE;AADG;AARqB,GAAL;AAAA,CAAhB,EAWd,gBAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArBC,KAAqB,QAArBA,KAAqB;AAAA,MAAdC,OAAc,QAAdA,OAAc;AACpC,sBACE;AAAK,IAAA,SAAS,EAAEA,OAAO,CAACT;AAAxB,kBACE,gCAAC,uBAAD;AAAa,IAAA,OAAO,EAAC,UAArB;AAAgC,IAAA,SAAS,EAAES,OAAO,CAACX;AAAnD,kBACE,gCAAC,sBAAD;AAAY,IAAA,OAAO,EAAC,aAApB;AAAkC,IAAA,SAAS,EAAEW,OAAO,CAACJ;AAArD,iBADF,eAGE,gCAAC,kBAAD;AACE,IAAA,KAAK,EAAEG,KADT;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,KAAK,eAAE,gCAAC,yBAAD;AAAe,MAAA,IAAI,EAAC,MAApB;AAA2B,MAAA,EAAE,EAAC;AAA9B;AAHT,kBAKE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,iBALF,eAME,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,WANF,eAOE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,gBAPF,eAQE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,kBARF,eASE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,gBATF,eAUE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,iBAVF,CAHF,CADF,CADF;AAoBD,CAhCiB,CAAlB;eAkCeX,S","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\n\nconst ChartType = withStyles(theme => ({\n formControl: {\n width: '100%'\n },\n chartType: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n chartTypeLabel: {\n transform: 'translate(0px, -16px) scale(0.75) !important'\n }\n}))(({ onChange, value, classes }) => {\n return (\n <div className={classes.chartType}>\n <FormControl variant=\"outlined\" className={classes.formControl}>\n <InputLabel htmlFor=\"type-helper\" className={classes.chartTypeLabel}>ChartType</InputLabel>\n\n <Select\n value={value}\n onChange={onChange}\n input={<OutlinedInput name=\"type\" id=\"type-helper\" />}\n >\n <MenuItem value={'histogram'}>Histogram</MenuItem>\n <MenuItem value={'bar'}>Bar</MenuItem>\n <MenuItem value={'lineDot'}>Line Dot</MenuItem>\n <MenuItem value={'lineCross'}>Line Cross</MenuItem>\n <MenuItem value={'dotPlot'}>Dot Plot</MenuItem>\n <MenuItem value={'linePlot'}>Line Plot</MenuItem>\n </Select>\n </FormControl>\n </div>\n );\n});\n\nexport default ChartType;\n"],"file":"chart-type.js"}
|