@pie-element/charting 3.0.0 → 4.0.0
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 +17 -0
- package/configure/CHANGELOG.md +17 -0
- package/configure/lib/charting-config.js +7 -2
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/configure.js +21 -13
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +159 -14
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +10 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +4 -4
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/demo/generate.js +3 -9
- package/docs/pie-schema.json +21 -0
- package/docs/pie-schema.json.md +16 -0
- package/package.json +3 -3
- package/configure/lib/chart-type.js +0 -72
- package/configure/lib/chart-type.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@3.0.0...@pie-element/charting@4.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [3.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.30...@pie-element/charting@3.0.0) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@3.0.0...@pie-element/charting-configure@4.0.0) (2022-06-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### chore
|
|
10
|
+
|
|
11
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Image percent buttons were removed from toolbar.
|
|
17
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [3.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.49...@pie-element/charting-configure@3.0.0) (2022-06-13)
|
|
7
24
|
|
|
8
25
|
|
|
@@ -112,8 +112,13 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
112
112
|
size: model.graph,
|
|
113
113
|
domain: model.domain,
|
|
114
114
|
range: model.range,
|
|
115
|
-
charts: charts
|
|
116
|
-
|
|
115
|
+
charts: charts // index is a property used for setting the correct answer data; it's needed in order to remove categories from other data sets from the same index it was removed from the initial data
|
|
116
|
+
,
|
|
117
|
+
data: model.data.map(function (category, index) {
|
|
118
|
+
return _objectSpread(_objectSpread({}, category), {}, {
|
|
119
|
+
index: index
|
|
120
|
+
});
|
|
121
|
+
}),
|
|
117
122
|
title: model.title,
|
|
118
123
|
onDataChange: this.changeData,
|
|
119
124
|
addCategoryEnabled: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","value","addCategoryEnabled","classes","charts","chartType","graph","domain","range","title","changeData","categoryDefaultLabel","e","changeAddRemoveEnabled","target","checked","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYaE,c;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI;AAAA,aAAI,MAAKC,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CH,QAAAA,IAAI,EAAJA;AAA3C,SAAJ;AAAA,K;+GAEQ,UAAAI,KAAK;AAAA,aAAI,MAAKH,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CE,QAAAA,kBAAkB,EAAED;AAA/D,SAAJ;AAAA,K;;;;;;WAE9B,kBAAS;AAAA;;AACP,wBAAmC,KAAKH,KAAxC;AAAA,UAAQK,OAAR,eAAQA,OAAR;AAAA,UAAiBH,KAAjB,eAAiBA,KAAjB;AAAA,UAAwBI,MAAxB,eAAwBA,MAAxB;AAEA,0BACE,yEAGE;AAAK,QAAA,SAAS,EAAED,OAAO,CAACf;AAAxB,sBACE;AAAK,QAAA,SAAS,EAAEe,OAAO,CAACR,MAAxB;AAAgC,QAAA,GAAG,EAAC;AAApC,sBACE,oBAAC,sBAAD;AAAY,QAAA,SAAS,EAAC,KAAtB;AAA4B,QAAA,IAAI,EAAC;AAAjC,sBACE,iFADF,CADF,eAKE,oBAAC,eAAD;AACE,QAAA,WAAW,EAAE,IADf;AAEE,QAAA,SAAS,EAAEK,KAAK,CAACK,SAFnB;AAGE,QAAA,IAAI,EAAEL,KAAK,CAACM,KAHd;AAIE,QAAA,MAAM,EAAEN,KAAK,CAACO,MAJhB;AAKE,QAAA,KAAK,EAAEP,KAAK,CAACQ,KALf;AAME,QAAA,MAAM,EAAEJ,MANV;
|
|
1
|
+
{"version":3,"sources":["../src/charting-config.jsx"],"names":["styles","theme","container","marginTop","spacing","unit","marginBottom","display","flex","column","ChartingConfig","data","props","onChange","model","value","addCategoryEnabled","classes","charts","chartType","graph","domain","range","map","category","index","title","changeData","categoryDefaultLabel","e","changeAddRemoveEnabled","target","checked","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,SAAS,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CADvB;AAETC,MAAAA,YAAY,EAAEL,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,CAF1B;AAGTE,MAAAA,OAAO,EAAE,MAHA;AAITC,MAAAA,IAAI,EAAE;AAJG,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACND,MAAAA,IAAI,EAAE;AADA;AAPe,GAAL;AAAA,CAApB;;IAYaE,c;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI;AAAA,aAAI,MAAKC,KAAL,CAAWC,QAAX,iCAAyB,MAAKD,KAAL,CAAWE,KAApC;AAA2CH,QAAAA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,EAAEd,KAAK,CAACE,kBADjB;AAEE,QAAA,QAAQ,EAAE,kBAACa,CAAD,EAAO;AACf,UAAA,MAAI,CAACC,sBAAL,CAA4BD,CAAC,CAACE,MAAF,CAASC,OAArC;AACD;AAJH,QADD,+BAnBH,CADF,CAHF,CADF;AAsCD;;;EArDiCC,KAAK,CAACC,S;;;iCAA7BxB,c,eACQ;AACjBO,EAAAA,OAAO,EAAEkB,sBAAUC,MAAV,CAAiBC,UADT;AAEjBvB,EAAAA,KAAK,EAAEqB,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBxB,EAAAA,QAAQ,EAAEsB,sBAAUG,IAAV,CAAeD,UAHR;AAIjBnB,EAAAA,MAAM,EAAEiB,sBAAUI;AAJD,C;;eAuDN,wBAAWvC,MAAX,EAAmBU,cAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nimport Typography from '@material-ui/core/Typography';\n\nconst styles = theme => ({\n container: {\n marginTop: theme.spacing.unit * 3,\n marginBottom: theme.spacing.unit * 3,\n display: 'flex',\n flex: 1,\n },\n column: {\n flex: 1\n }\n});\n\nexport class ChartingConfig extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array\n };\n\n changeData = data => this.props.onChange({ ...this.props.model, data });\n\n changeAddRemoveEnabled = value => this.props.onChange({ ...this.props.model, addCategoryEnabled: value });\n\n render() {\n const { classes, model, charts } = this.props;\n\n return (\n <div>\n Define Graph Attributes\n\n <div className={classes.container}>\n <div className={classes.column} key=\"graph\">\n <Typography component=\"div\" type=\"body1\">\n <span>Use the tools below to set background shapes</span>\n </Typography>\n\n <Chart\n defineChart={true}\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n // index is a property used for setting the correct answer data; it's needed in order to remove categories from other data sets from the same index it was removed from the initial data\n data={model.data.map((category, index) => ({ ...category, index: index }))}\n title={model.title}\n onDataChange={this.changeData}\n addCategoryEnabled={true}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n <div>\n <Checkbox\n checked={model.addCategoryEnabled}\n onChange={(e) => {\n this.changeAddRemoveEnabled(e.target.checked)\n }}\n />\n Student can add categories\n </div>\n </div>\n\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(ChartingConfig);\n"],"file":"charting-config.js"}
|
|
@@ -41,8 +41,6 @@ var _chartingConfig = _interopRequireDefault(require("./charting-config"));
|
|
|
41
41
|
|
|
42
42
|
var _correctResponse = _interopRequireDefault(require("./correct-response"));
|
|
43
43
|
|
|
44
|
-
var _chartType = _interopRequireDefault(require("./chart-type"));
|
|
45
|
-
|
|
46
44
|
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; }
|
|
47
45
|
|
|
48
46
|
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; }
|
|
@@ -124,8 +122,6 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
124
122
|
(0, _createClass2["default"])(Configure, [{
|
|
125
123
|
key: "render",
|
|
126
124
|
value: function render() {
|
|
127
|
-
var _this2 = this;
|
|
128
|
-
|
|
129
125
|
var _this$props = this.props,
|
|
130
126
|
classes = _this$props.classes,
|
|
131
127
|
model = _this$props.model,
|
|
@@ -150,7 +146,11 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
150
146
|
_ref$prompt = _ref.prompt,
|
|
151
147
|
prompt = _ref$prompt === void 0 ? {} : _ref$prompt,
|
|
152
148
|
_ref$spellCheck = _ref.spellCheck,
|
|
153
|
-
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck
|
|
149
|
+
spellCheck = _ref$spellCheck === void 0 ? {} : _ref$spellCheck,
|
|
150
|
+
_ref$maxImageWidth = _ref.maxImageWidth,
|
|
151
|
+
maxImageWidth = _ref$maxImageWidth === void 0 ? {} : _ref$maxImageWidth,
|
|
152
|
+
_ref$maxImageHeight = _ref.maxImageHeight,
|
|
153
|
+
maxImageHeight = _ref$maxImageHeight === void 0 ? {} : _ref$maxImageHeight;
|
|
154
154
|
|
|
155
155
|
var _ref2 = model || {},
|
|
156
156
|
teacherInstructionsEnabled = _ref2.teacherInstructionsEnabled,
|
|
@@ -158,6 +158,8 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
158
158
|
rationaleEnabled = _ref2.rationaleEnabled,
|
|
159
159
|
spellCheckEnabled = _ref2.spellCheckEnabled;
|
|
160
160
|
|
|
161
|
+
var defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
162
|
+
var defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
161
163
|
return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
|
|
162
164
|
settings: /*#__PURE__*/_react["default"].createElement(Panel, {
|
|
163
165
|
model: model,
|
|
@@ -206,7 +208,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
206
208
|
onChange: this.onTeacherInstructionsChange,
|
|
207
209
|
imageSupport: imageSupport,
|
|
208
210
|
nonEmpty: false,
|
|
209
|
-
spellCheck: spellCheckEnabled
|
|
211
|
+
spellCheck: spellCheckEnabled,
|
|
212
|
+
maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
|
|
213
|
+
maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight
|
|
210
214
|
})), promptEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
211
215
|
label: prompt.label,
|
|
212
216
|
className: classes.promptHolder
|
|
@@ -217,7 +221,9 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
217
221
|
imageSupport: imageSupport,
|
|
218
222
|
nonEmpty: false,
|
|
219
223
|
spellCheck: spellCheckEnabled,
|
|
220
|
-
disableUnderline: true
|
|
224
|
+
disableUnderline: true,
|
|
225
|
+
maxImageWidth: defaultImageMaxWidth,
|
|
226
|
+
maxImageHeight: defaultImageMaxHeight
|
|
221
227
|
})), rationaleEnabled && /*#__PURE__*/_react["default"].createElement(_configUi.InputContainer, {
|
|
222
228
|
label: rationale.label || 'Rationale',
|
|
223
229
|
className: classes.promptHolder
|
|
@@ -226,12 +232,14 @@ var Configure = /*#__PURE__*/function (_React$Component) {
|
|
|
226
232
|
markup: model.rationale || '',
|
|
227
233
|
onChange: this.onRationaleChange,
|
|
228
234
|
imageSupport: imageSupport,
|
|
229
|
-
spellCheck: spellCheckEnabled
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
spellCheck: spellCheckEnabled,
|
|
236
|
+
maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
|
|
237
|
+
maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight
|
|
238
|
+
})), /*#__PURE__*/_react["default"].createElement(_charting.ConfigureChartPanel, {
|
|
239
|
+
config: graph,
|
|
240
|
+
model: model,
|
|
241
|
+
onChange: this.props.onModelChanged,
|
|
242
|
+
charts: charts
|
|
235
243
|
}), /*#__PURE__*/_react["default"].createElement(_chartingConfig["default"], {
|
|
236
244
|
config: graph,
|
|
237
245
|
model: model,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","numberFields","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","content","promptHolder","width","paddingBottom","prompt","paddingTop","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","rationale","props","onModelChanged","model","teacherInstructions","chartType","classes","configuration","onConfigurationChanged","imageSupport","graph","scoringType","studentInstructions","spellCheck","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","label","suffix","min","max","height","Properties","studentInstructionsEnabled","onTeacherInstructionsChange","onPromptChange","onRationaleChange","e","onChartTypeChange","target","value","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ;AACA,IAAQC,KAAR,GAA+CC,kBAA/C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA+CD,kBAA/C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA+CF,kBAA/C,CAAuBE,KAAvB;AAAA,IAA8BC,YAA9B,GAA+CH,kBAA/C,CAA8BG,YAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,QADL;AAELC,MAAAA,OAAO,EAAE,OAFJ;AAGLC,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAH3B;AAILC,MAAAA,YAAY,EAAEP,KAAK,CAACK,OAAN,CAAcC;AAJvB,KADkB;AAOzBE,IAAAA,OAAO,EAAE;AACPJ,MAAAA,SAAS,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;AADzB,KAPgB;AAUzBG,IAAAA,YAAY,EAAE;AACZC,MA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AAC,qBAAD;AACE,QAAA,KAAK,EAAEd,KAAK,CAACE,SADf;AAEE,QAAA,QAAQ,EAAE,kBAACuB,CAAD;AAAA,iBAAO,MAAI,CAACC,iBAAL,CAAuBD,CAAC,CAACE,MAAF,CAASC,KAAhC,CAAP;AAAA;AAFZ,QA1DF,eA+DE,gCAAC,0BAAD;AACE,QAAA,MAAM,EAAErB,KADV;AAEE,QAAA,KAAK,EAAEP,KAFT;AAGE,QAAA,QAAQ,EAAED,cAHZ;AAIE,QAAA,MAAM,EAAEX;AAJV,QA/DF,eAsEE,gCAAC,2BAAD;AACE,QAAA,MAAM,EAAEmB,KADV;AAEE,QAAA,KAAK,EAAEP,KAFT;AAGE,QAAA,QAAQ,EAAED,cAHZ;AAIE,QAAA,MAAM,EAAEX;AAJV,QAtEF,CA/CF,CADF;AA+HD;;;EA9K4ByC,kBAAMC,S;;;iCAAxBlC,S,eACQ;AACjBG,EAAAA,cAAc,EAAEgC,sBAAUC,IADT;AAEjB3B,EAAAA,sBAAsB,EAAE0B,sBAAUC,IAFjB;AAGjB7B,EAAAA,OAAO,EAAE4B,sBAAUE,MAHF;AAIjB3B,EAAAA,YAAY,EAAEyB,sBAAUE,MAJP;AAKjBjC,EAAAA,KAAK,EAAE+B,sBAAUE,MAAV,CAAiBC,UALP;AAMjB9B,EAAAA,aAAa,EAAE2B,sBAAUE,MAAV,CAAiBC;AANf,C;iCADRtC,S,kBAUW;AAAEO,EAAAA,OAAO,EAAE;AAAX,C;;eAuKT,wBAAW9B,MAAX,EAAmBuB,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes } from '@pie-lib/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\nimport ChartType from './chart-type';\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, numberFields } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n content: {\n marginTop: theme.spacing.unit * 2,\n },\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n marginTop: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n };\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) =>\n this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) =>\n this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) =>\n this.props.onModelChanged({ ...this.props.model, chartType });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n onModelChanged,\n imageSupport,\n } = this.props;\n log('[render] model', model);\n const { graph } = model;\n const {\n title = {},\n rationale = {},\n scoringType = {},\n studentInstructions = {},\n teacherInstructions = {},\n prompt = {},\n spellCheck = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled } =\n model || {};\n\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Item Type': {\n 'title.enabled': title.settings && toggle(title.label, true),\n graph: numberFields('Graph Display Size', {\n width: {\n label: 'Width',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n height: {\n label: 'Height',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n }),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, [\n 'all or nothing',\n 'partial scoring',\n ]),\n },\n }}\n />\n }\n >\n <div className={classes.content}>\n <Typography component=\"div\" type=\"body1\">\n <span>\n This interaction asks a student to draw a chart that meets\n specific criteria. The student will draw a category on the chart\n by clicking Add Category and dragging the top part of the\n category.\n </span>\n </Typography>\n\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n disableUnderline\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label || 'Rationale'}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n spellCheck={spellCheckEnabled}\n />\n </InputContainer>\n )}\n\n <ChartType\n value={model.chartType}\n onChange={(e) => this.onChartTypeChange(e.target.value)}\n />\n\n <ChartingConfig\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
|
|
1
|
+
{"version":3,"sources":["../src/configure.jsx"],"names":["log","Panel","settings","toggle","radio","numberFields","styles","theme","title","fontSize","display","marginTop","spacing","unit","marginBottom","content","promptHolder","width","paddingBottom","prompt","paddingTop","charts","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","Configure","rationale","props","onModelChanged","model","teacherInstructions","chartType","classes","configuration","onConfigurationChanged","imageSupport","graph","scoringType","studentInstructions","spellCheck","maxImageWidth","maxImageHeight","teacherInstructionsEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","defaultImageMaxWidth","defaultImageMaxHeight","label","suffix","min","max","height","Properties","studentInstructionsEnabled","onTeacherInstructionsChange","onPromptChange","onRationaleChange","React","Component","PropTypes","func","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAGA,IAAMA,GAAG,GAAG,uBAAM,iCAAN,CAAZ;AACA,IAAQC,KAAR,GAA+CC,kBAA/C,CAAQD,KAAR;AAAA,IAAeE,MAAf,GAA+CD,kBAA/C,CAAeC,MAAf;AAAA,IAAuBC,KAAvB,GAA+CF,kBAA/C,CAAuBE,KAAvB;AAAA,IAA8BC,YAA9B,GAA+CH,kBAA/C,CAA8BG,YAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,QADL;AAELC,MAAAA,OAAO,EAAE,OAFJ;AAGLC,MAAAA,SAAS,EAAEJ,KA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AEP,KAFT;AAGE,QAAA,QAAQ,EAAED,cAHZ;AAIE,QAAA,MAAM,EAAEX;AAJV,QA9EF,CA/CF,CADF;AAuID;;;EA3L4ByC,kBAAMC,S;;;iCAAxBlC,S,eACQ;AACjBG,EAAAA,cAAc,EAAEgC,sBAAUC,IADT;AAEjB3B,EAAAA,sBAAsB,EAAE0B,sBAAUC,IAFjB;AAGjB7B,EAAAA,OAAO,EAAE4B,sBAAUE,MAHF;AAIjB3B,EAAAA,YAAY,EAAEyB,sBAAUE,MAJP;AAKjBjC,EAAAA,KAAK,EAAE+B,sBAAUE,MAAV,CAAiBC,UALP;AAMjB9B,EAAAA,aAAa,EAAE2B,sBAAUE,MAAV,CAAiBC;AANf,C;iCADRtC,S,kBAUW;AAAEO,EAAAA,OAAO,EAAE;AAAX,C;;eAoLT,wBAAW9B,MAAX,EAAmBuB,SAAnB,C","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport { chartTypes, ConfigureChartPanel } from '@pie-lib/charting';\nimport { settings, layout, InputContainer } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport Typography from '@material-ui/core/Typography';\nimport EditableHtml from '@pie-lib/editable-html';\n\nimport ChartingConfig from './charting-config';\nimport CorrectResponse from './correct-response';\n\n\nconst log = debug('@pie-element:graphing:configure');\nconst { Panel, toggle, radio, numberFields } = settings;\n\nconst styles = (theme) => ({\n title: {\n fontSize: '1.1rem',\n display: 'block',\n marginTop: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit,\n },\n content: {\n marginTop: theme.spacing.unit * 2,\n },\n promptHolder: {\n width: '100%',\n paddingBottom: theme.spacing.unit * 2,\n marginBottom: theme.spacing.unit * 2,\n marginTop: theme.spacing.unit * 2,\n },\n prompt: {\n paddingTop: theme.spacing.unit * 2,\n width: '100%',\n },\n});\n\nconst charts = [\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n];\n\nexport class Configure extends React.Component {\n static propTypes = {\n onModelChanged: PropTypes.func,\n onConfigurationChanged: PropTypes.func,\n classes: PropTypes.object,\n imageSupport: PropTypes.object,\n model: PropTypes.object.isRequired,\n configuration: PropTypes.object.isRequired,\n };\n\n static defaultProps = { classes: {} };\n\n onRationaleChange = (rationale) =>\n this.props.onModelChanged({ ...this.props.model, rationale });\n\n onPromptChange = (prompt) =>\n this.props.onModelChanged({ ...this.props.model, prompt });\n\n onTeacherInstructionsChange = (teacherInstructions) =>\n this.props.onModelChanged({ ...this.props.model, teacherInstructions });\n\n onChartTypeChange = (chartType) =>\n this.props.onModelChanged({ ...this.props.model, chartType });\n\n render() {\n const {\n classes,\n model,\n configuration,\n onConfigurationChanged,\n onModelChanged,\n imageSupport,\n } = this.props;\n log('[render] model', model);\n const { graph } = model;\n const {\n title = {},\n rationale = {},\n scoringType = {},\n studentInstructions = {},\n teacherInstructions = {},\n prompt = {},\n spellCheck = {},\n maxImageWidth = {},\n maxImageHeight = {}\n } = configuration || {};\n const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled } =\n model || {};\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n return (\n <layout.ConfigLayout\n settings={\n <Panel\n model={model}\n configuration={configuration}\n onChangeModel={onModelChanged}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n 'Item Type': {\n 'title.enabled': title.settings && toggle(title.label, true),\n graph: numberFields('Graph Display Size', {\n width: {\n label: 'Width',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n height: {\n label: 'Height',\n suffix: 'px',\n min: 400,\n max: 700,\n },\n }),\n },\n Properties: {\n teacherInstructionsEnabled:\n teacherInstructions.settings &&\n toggle(teacherInstructions.label),\n studentInstructionsEnabled:\n studentInstructions.settings &&\n toggle(studentInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled:\n spellCheck.settings && toggle(spellCheck.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n scoringType:\n scoringType.settings &&\n radio(scoringType.label, [\n 'all or nothing',\n 'partial scoring',\n ]),\n },\n }}\n />\n }\n >\n <div className={classes.content}>\n <Typography component=\"div\" type=\"body1\">\n <span>\n This interaction asks a student to draw a chart that meets\n specific criteria. The student will draw a category on the chart\n by clicking Add Category and dragging the top part of the\n category.\n </span>\n </Typography>\n\n {teacherInstructionsEnabled && (\n <InputContainer\n label={teacherInstructions.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.teacherInstructions || ''}\n onChange={this.onTeacherInstructionsChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n {promptEnabled && (\n <InputContainer\n label={prompt.label}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.prompt}\n onChange={this.onPromptChange}\n imageSupport={imageSupport}\n nonEmpty={false}\n spellCheck={spellCheckEnabled}\n disableUnderline\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n {rationaleEnabled && (\n <InputContainer\n label={rationale.label || 'Rationale'}\n className={classes.promptHolder}\n >\n <EditableHtml\n className={classes.prompt}\n markup={model.rationale || ''}\n onChange={this.onRationaleChange}\n imageSupport={imageSupport}\n spellCheck={spellCheckEnabled}\n maxImageWidth={maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth}\n maxImageHeight={maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight}\n />\n </InputContainer>\n )}\n\n <ConfigureChartPanel\n config={graph}\n model={model}\n onChange={this.props.onModelChanged}\n charts={charts}\n />\n\n <ChartingConfig\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n\n <CorrectResponse\n config={graph}\n model={model}\n onChange={onModelChanged}\n charts={charts}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Configure);\n"],"file":"configure.js"}
|
|
@@ -21,6 +21,10 @@ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime
|
|
|
21
21
|
|
|
22
22
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
23
|
|
|
24
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
25
|
+
|
|
26
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
27
|
+
|
|
24
28
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
29
|
|
|
26
30
|
var React = _interopRequireWildcard(require("react"));
|
|
@@ -31,18 +35,25 @@ var _styles = require("@material-ui/core/styles");
|
|
|
31
35
|
|
|
32
36
|
var _charting = require("@pie-lib/charting");
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
var _excluded = ["editable", "interactive", "deletable"],
|
|
43
|
+
_excluded2 = ["interactive", "editable", "index"];
|
|
39
44
|
|
|
40
|
-
function
|
|
45
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
46
|
+
|
|
47
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
48
|
|
|
42
49
|
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
50
|
|
|
44
51
|
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
52
|
|
|
53
|
+
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; }
|
|
54
|
+
|
|
55
|
+
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; }
|
|
56
|
+
|
|
46
57
|
var styles = function styles(theme) {
|
|
47
58
|
return {
|
|
48
59
|
container: {
|
|
@@ -62,21 +73,74 @@ var styles = function styles(theme) {
|
|
|
62
73
|
};
|
|
63
74
|
};
|
|
64
75
|
|
|
76
|
+
var addCategoryProps = function addCategoryProps(correctAnswer, data) {
|
|
77
|
+
return correctAnswer.map(function (correct, index) {
|
|
78
|
+
return _objectSpread(_objectSpread({}, correct), {}, {
|
|
79
|
+
editable: index < data.length ? data[index].editable : true,
|
|
80
|
+
interactive: index < data.length ? data[index].interactive : true,
|
|
81
|
+
deletable: index >= data.length ? true : false
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var updateCorrectResponseData = function updateCorrectResponseData(correctAnswer, data) {
|
|
87
|
+
if (!correctAnswer) {
|
|
88
|
+
return data;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
|
|
92
|
+
var correctResponseDefinition = [];
|
|
93
|
+
data.forEach(function (category, currentIndex) {
|
|
94
|
+
var _correctAnswer$curren, _correctAnswer$curren2;
|
|
95
|
+
|
|
96
|
+
var editable = category.editable;
|
|
97
|
+
var interactive = category.interactive;
|
|
98
|
+
var label = editable && (_correctAnswer$curren = correctAnswer[currentIndex]) !== null && _correctAnswer$curren !== void 0 && _correctAnswer$curren.label ? correctAnswer[currentIndex].label : category.label;
|
|
99
|
+
var value = interactive && (_correctAnswer$curren2 = correctAnswer[currentIndex]) !== null && _correctAnswer$curren2 !== void 0 && _correctAnswer$curren2.value ? correctAnswer[currentIndex].value : category.value;
|
|
100
|
+
correctResponseDefinition[currentIndex] = {
|
|
101
|
+
label: label,
|
|
102
|
+
value: value,
|
|
103
|
+
editable: category.editable,
|
|
104
|
+
interactive: category.interactive
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (correctResponseDefinition.length < correctAnswer.length) {
|
|
109
|
+
var missingCategories = correctAnswerData.slice(correctResponseDefinition.length, correctAnswer.length);
|
|
110
|
+
return addCategoryProps(correctResponseDefinition.concat(missingCategories), data);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return correctResponseDefinition;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var insertCategory = function insertCategory(correctAnswer, data) {
|
|
117
|
+
var positionToInsert = data.length - 1;
|
|
118
|
+
var _data = data[data.length - 1],
|
|
119
|
+
editable = _data.editable,
|
|
120
|
+
interactive = _data.interactive,
|
|
121
|
+
deletable = _data.deletable,
|
|
122
|
+
categoryToInsert = (0, _objectWithoutProperties2["default"])(_data, _excluded);
|
|
123
|
+
correctAnswer.splice(positionToInsert, 0, categoryToInsert);
|
|
124
|
+
var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
|
|
125
|
+
return addCategoryProps(correctAnswerData, data);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var removeCategory = function removeCategory(correctAnswer, data, positionToRemove) {
|
|
129
|
+
correctAnswer.splice(positionToRemove, 1);
|
|
130
|
+
var correctAnswerData = (0, _toConsumableArray2["default"])(correctAnswer);
|
|
131
|
+
return addCategoryProps(correctAnswerData, data);
|
|
132
|
+
};
|
|
133
|
+
|
|
65
134
|
var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
66
135
|
(0, _inherits2["default"])(CorrectResponse, _React$Component);
|
|
67
136
|
|
|
68
137
|
var _super = _createSuper(CorrectResponse);
|
|
69
138
|
|
|
70
|
-
function CorrectResponse() {
|
|
139
|
+
function CorrectResponse(props) {
|
|
71
140
|
var _this;
|
|
72
141
|
|
|
73
142
|
(0, _classCallCheck2["default"])(this, CorrectResponse);
|
|
74
|
-
|
|
75
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
76
|
-
args[_key] = arguments[_key];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
143
|
+
_this = _super.call(this, props);
|
|
80
144
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeData", function (data) {
|
|
81
145
|
var _this$props = _this.props,
|
|
82
146
|
model = _this$props.model,
|
|
@@ -87,22 +151,103 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
|
87
151
|
|
|
88
152
|
onChange(_objectSpread(_objectSpread({}, model), {}, {
|
|
89
153
|
correctAnswer: _objectSpread(_objectSpread({}, correctAnswer), {}, {
|
|
90
|
-
data: data
|
|
154
|
+
data: data.map(function (_ref2) {
|
|
155
|
+
var interactive = _ref2.interactive,
|
|
156
|
+
editable = _ref2.editable,
|
|
157
|
+
index = _ref2.index,
|
|
158
|
+
keepAttrs = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
159
|
+
return keepAttrs;
|
|
160
|
+
})
|
|
91
161
|
})
|
|
92
162
|
}));
|
|
93
163
|
});
|
|
164
|
+
_this.state = {
|
|
165
|
+
categories: updateCorrectResponseData(props.model.correctAnswer.data, props.model.data)
|
|
166
|
+
};
|
|
94
167
|
return _this;
|
|
95
168
|
}
|
|
96
169
|
|
|
97
170
|
(0, _createClass2["default"])(CorrectResponse, [{
|
|
171
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
172
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
173
|
+
var _nextProps$model = nextProps.model;
|
|
174
|
+
_nextProps$model = _nextProps$model === void 0 ? {} : _nextProps$model;
|
|
175
|
+
var _nextProps$model$data = _nextProps$model.data,
|
|
176
|
+
nextData = _nextProps$model$data === void 0 ? [] : _nextProps$model$data,
|
|
177
|
+
_nextProps$model$corr = _nextProps$model.correctAnswer.data,
|
|
178
|
+
nextCorrectAnswerData = _nextProps$model$corr === void 0 ? [] : _nextProps$model$corr;
|
|
179
|
+
var _this$props$model = this.props.model;
|
|
180
|
+
_this$props$model = _this$props$model === void 0 ? {} : _this$props$model;
|
|
181
|
+
var _this$props$model$dat = _this$props$model.data,
|
|
182
|
+
data = _this$props$model$dat === void 0 ? [] : _this$props$model$dat;
|
|
183
|
+
var categories = this.state.categories;
|
|
184
|
+
var nextCategories = [];
|
|
185
|
+
|
|
186
|
+
if (nextData.length > data.length && nextCorrectAnswerData.length > data.length) {
|
|
187
|
+
nextCategories = insertCategory(nextCorrectAnswerData, nextData);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (nextData.length < data.length) {
|
|
191
|
+
var removedIndex = nextData.length; // we need to remove the category from the correct answer data and categories, from the same index it was removed from the data
|
|
192
|
+
// index is a property of the nextData category
|
|
193
|
+
|
|
194
|
+
for (var index = 0; index < nextData.length; index++) {
|
|
195
|
+
if (nextData[index].index !== index) {
|
|
196
|
+
removedIndex = index;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
this.props.model.correctAnswer.data.splice(removedIndex, 1);
|
|
202
|
+
nextCategories = removeCategory(categories, nextData, removedIndex);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (!(0, _isEqual["default"])(nextCorrectAnswerData, this.props.model.correctAnswer.data)) {
|
|
206
|
+
nextCategories = nextCorrectAnswerData.map(function (correct, index) {
|
|
207
|
+
return _objectSpread(_objectSpread({}, correct), {}, {
|
|
208
|
+
editable: index < data.length ? data[index].editable : true,
|
|
209
|
+
interactive: index < data.length ? data[index].interactive : true
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
} else if ((0, _isEmpty["default"])(nextCategories)) {
|
|
213
|
+
nextCategories = updateCorrectResponseData(nextCorrectAnswerData, nextData);
|
|
214
|
+
nextCorrectAnswerData.map(function (answer, currentIndex) {
|
|
215
|
+
var dataExists = currentIndex < nextData.length;
|
|
216
|
+
var label;
|
|
217
|
+
var value;
|
|
218
|
+
var deletable;
|
|
219
|
+
|
|
220
|
+
if (dataExists) {
|
|
221
|
+
label = nextData[currentIndex].editable ? answer.label : nextData[currentIndex].label;
|
|
222
|
+
value = nextData[currentIndex].interactive ? answer.value : nextData[currentIndex].value;
|
|
223
|
+
} else {
|
|
224
|
+
label = answer.label;
|
|
225
|
+
value = answer.value;
|
|
226
|
+
deletable = true;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
nextCorrectAnswerData[currentIndex] = {
|
|
230
|
+
label: label,
|
|
231
|
+
value: value
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (!(0, _isEqual["default"])(nextCategories, data)) {
|
|
237
|
+
this.setState({
|
|
238
|
+
categories: nextCategories
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}, {
|
|
98
243
|
key: "render",
|
|
99
244
|
value: function render() {
|
|
100
245
|
var _this2 = this;
|
|
101
246
|
|
|
102
247
|
var _this$props2 = this.props,
|
|
103
|
-
classes = _this$props2.classes,
|
|
104
248
|
model = _this$props2.model,
|
|
105
249
|
charts = _this$props2.charts;
|
|
250
|
+
var categories = this.state.categories;
|
|
106
251
|
return /*#__PURE__*/React.createElement("div", null, "Define Correct Response", /*#__PURE__*/React.createElement("div", {
|
|
107
252
|
key: "correct-response-graph-".concat(model.correctAnswer.name)
|
|
108
253
|
}, /*#__PURE__*/React.createElement("p", null, model.correctAnswer.name), /*#__PURE__*/React.createElement(_charting.Chart, {
|
|
@@ -111,7 +256,7 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
|
111
256
|
domain: model.domain,
|
|
112
257
|
range: model.range,
|
|
113
258
|
charts: charts,
|
|
114
|
-
data:
|
|
259
|
+
data: categories,
|
|
115
260
|
title: model.title,
|
|
116
261
|
onDataChange: function onDataChange(data) {
|
|
117
262
|
return _this2.changeData(data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/correct-response.jsx"],"names":["styles","theme","container","border","borderRadius","padding","spacing","unit","background","button","marginTop","cursor","width","CorrectResponse","data","props","model","onChange","correctAnswer","classes","charts","name","chartType","graph","domain","range","title","changeData","addCategoryEnabled","categoryDefaultLabel","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACvBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,MAAM,EAAE,mBADC;AAETC,MAAAA,YAAY,EAAE,KAFL;AAGTC,MAAAA,OAAO,YAAKJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAA1B,gBAAiCN,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAAtD,OAHE;AAITC,MAAAA,UAAU,EAAE;AAJH,KADY;AAOvBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,SAAS,EAAET,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAD1B;AAENI,MAAAA,MAAM,EAAE,SAFF;AAGNH,MAAAA,UAAU,EAAE,MAHN;AAINH,MAAAA,OAAO,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAJxB;AAKNK,MAAAA,KAAK,EAAE,aALD;AAMNR,MAAAA,YAAY,EAAE;AANR;AAPe,GAAL;AAAA,CAApB;;IAiBaS,e;;;;;;;;;;;;;;;mGAQE,UAAAC,IAAI,EAAI;AACnB,wBAA4B,MAAKC,KAAjC;AAAA,UAAQC,KAAR,eAAQA,KAAR;AAAA,UAAeC,QAAf,eAAeA,QAAf;;AACA,iBAA0BD,KAAK,IAAI,EAAnC;AAAA,UAAQE,aAAR,QAAQA,aAAR;;AAEAD,MAAAA,QAAQ,iCACHD,KADG;AAENE,QAAAA,aAAa,kCACRA,aADQ;AAEXJ,UAAAA,IAAI,EAAJA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Types from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\n\nconst styles = theme => ({\n container: {\n border: '2px solid #ababab',\n borderRadius: '4px',\n padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 4}px`,\n background: '#fafafa'\n },\n button: {\n marginTop: theme.spacing.unit * 3,\n cursor: 'pointer',\n background: '#eee',\n padding: theme.spacing.unit * 2,\n width: 'fit-content',\n borderRadius: '4px'\n }\n});\n\nexport class CorrectResponse extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array\n };\n\n changeData = data => {\n const { model, onChange } = this.props;\n const { correctAnswer } = model || {};\n\n onChange({\n ...model,\n correctAnswer: {\n ...correctAnswer,\n data\n }\n });\n };\n\n render() {\n const { classes, model, charts } = this.props;\n\n return (\n <div>\n Define Correct Response\n <div key={`correct-response-graph-${model.correctAnswer.name}`}>\n <p>{model.correctAnswer.name}</p>\n <Chart\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n data={model.correctAnswer.data || []}\n title={model.title}\n onDataChange={(data) => this.changeData(data)}\n addCategoryEnabled={model.addCategoryEnabled}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(CorrectResponse);\n"],"file":"correct-response.js"}
|
|
1
|
+
{"version":3,"sources":["../src/correct-response.jsx"],"names":["styles","theme","container","border","borderRadius","padding","spacing","unit","background","button","marginTop","cursor","width","addCategoryProps","correctAnswer","data","map","correct","index","editable","length","interactive","deletable","updateCorrectResponseData","correctAnswerData","correctResponseDefinition","forEach","category","currentIndex","label","value","missingCategories","slice","concat","insertCategory","positionToInsert","categoryToInsert","splice","removeCategory","positionToRemove","CorrectResponse","props","model","onChange","keepAttrs","state","categories","nextProps","nextData","nextCorrectAnswerData","nextCategories","removedIndex","answer","dataExists","setState","charts","name","chartType","graph","domain","range","title","changeData","addCategoryEnabled","categoryDefaultLabel","React","Component","classes","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,SAAS,EAAE;AACTC,MAAAA,MAAM,EAAE,mBADC;AAETC,MAAAA,YAAY,EAAE,KAFL;AAGTC,MAAAA,OAAO,YAAKJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAA1B,gBAAiCN,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAAtD,OAHE;AAITC,MAAAA,UAAU,EAAE;AAJH,KADc;AAOzBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,SAAS,EAAET,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAD1B;AAENI,MAAAA,MAAM,EAAE,SAFF;AAGNH,MAAAA,UAAU,EAAE,MAHN;AAINH,MAAAA,OAAO,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CAJxB;AAKNK,MAAAA,KAAK,EAAE,aALD;AAMNR,MAAAA,YAAY,EAAE;AANR;AAPiB,GAAZ;AAAA,CAAf;;AAiBA,IAAMS,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,aAAD,EAAgBC,IAAhB;AAAA,SAAyBD,aAAa,CAACE,GAAd,CAAkB,UAACC,OAAD,EAAUC,KAAV;AAAA,2CAA0BD,OAA1B;AAAmCE,MAAAA,QAAQ,EAAED,KAAK,GAAGH,IAAI,CAACK,MAAb,GAAsBL,IAAI,CAACG,KAAD,CAAJ,CAAYC,QAAlC,GAA6C,IAA1F;AAAgGE,MAAAA,WAAW,EAAEH,KAAK,GAAGH,IAAI,CAACK,MAAb,GAAsBL,IAAI,CAACG,KAAD,CAAJ,CAAYG,WAAlC,GAAgD,IAA7J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;AAEE,QAAA,IAAI,EAAEf,KAAK,CAACgB,KAFd;AAGE,QAAA,MAAM,EAAEhB,KAAK,CAACiB,MAHhB;AAIE,QAAA,KAAK,EAAEjB,KAAK,CAACkB,KAJf;AAKE,QAAA,MAAM,EAAEL,MALV;AAME,QAAA,IAAI,EAAET,UANR;AAOE,QAAA,KAAK,EAAEJ,KAAK,CAACmB,KAPf;AAQE,QAAA,YAAY,EAAE,sBAAC9C,IAAD;AAAA,iBAAU,MAAI,CAAC+C,UAAL,CAAgB/C,IAAhB,CAAV;AAAA,SARhB;AASE,QAAA,kBAAkB,EAAE2B,KAAK,CAACqB,kBAT5B;AAUE,QAAA,oBAAoB,EAAErB,KAAK,CAACsB;AAV9B,QAFF,CAFF,CADF;AAoBD;;;EA/HkCC,KAAK,CAACC,S;;;iCAA9B1B,e,eACQ;AACjB2B,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADT;AAEjB5B,EAAAA,KAAK,EAAE0B,sBAAUC,MAAV,CAAiBC,UAFP;AAGjB3B,EAAAA,QAAQ,EAAEyB,sBAAUG,IAAV,CAAeD,UAHR;AAIjBf,EAAAA,MAAM,EAAEa,sBAAUI;AAJD,C;;eAiIN,wBAAWxE,MAAX,EAAmBwC,eAAnB,C","sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Chart } from '@pie-lib/charting';\nimport isEqual from 'lodash/isEqual';\nimport isEmpty from 'lodash/isEmpty';\n\nconst styles = (theme) => ({\n container: {\n border: '2px solid #ababab',\n borderRadius: '4px',\n padding: `${theme.spacing.unit * 2}px ${theme.spacing.unit * 4}px`,\n background: '#fafafa',\n },\n button: {\n marginTop: theme.spacing.unit * 3,\n cursor: 'pointer',\n background: '#eee',\n padding: theme.spacing.unit * 2,\n width: 'fit-content',\n borderRadius: '4px',\n },\n});\n\nconst addCategoryProps = (correctAnswer, data) => correctAnswer.map((correct, index) => ({ ...correct, editable: index < data.length ? data[index].editable : true, interactive: index < data.length ? data[index].interactive : true, deletable: index >= data.length ? true : false }));\n\nconst updateCorrectResponseData = (correctAnswer, data) => {\n if (!correctAnswer) {\n return data;\n }\n\n const correctAnswerData = [...correctAnswer];\n\n let correctResponseDefinition = [];\n\n data.forEach((category, currentIndex) => {\n const editable = category.editable;\n const interactive = category.interactive;\n\n const label = (editable && correctAnswer[currentIndex]?.label)\n ? correctAnswer[currentIndex].label\n : category.label\n\n const value = (interactive && correctAnswer[currentIndex]?.value)\n ? correctAnswer[currentIndex].value\n : category.value\n\n correctResponseDefinition[currentIndex] = {\n label: label,\n value: value,\n editable: category.editable,\n interactive: category.interactive,\n };\n });\n\n if (correctResponseDefinition.length < correctAnswer.length) {\n const missingCategories = correctAnswerData.slice(correctResponseDefinition.length, correctAnswer.length)\n\n return addCategoryProps(correctResponseDefinition.concat(missingCategories), data);\n }\n\n return correctResponseDefinition;\n};\n\nconst insertCategory = (correctAnswer, data) => {\n const positionToInsert = data.length - 1;\n const { editable, interactive, deletable, ...categoryToInsert } = data[data.length - 1];\n\n correctAnswer.splice(positionToInsert, 0, categoryToInsert);\n const correctAnswerData = [...correctAnswer];\n\n return addCategoryProps(correctAnswerData, data);\n}\n\nconst removeCategory = (correctAnswer, data, positionToRemove) => {\n correctAnswer.splice(positionToRemove, 1);\n\n const correctAnswerData = [...correctAnswer];\n\n return addCategoryProps(correctAnswerData, data);\n}\nexport class CorrectResponse extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n charts: PropTypes.array,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n categories: updateCorrectResponseData(\n props.model.correctAnswer.data,\n props.model.data\n )\n };\n }\n\n changeData = (data) => {\n const { model, onChange } = this.props;\n const { correctAnswer } = model || {};\n\n onChange({\n ...model,\n correctAnswer: {\n ...correctAnswer,\n data: data.map(({ interactive, editable, index, ...keepAttrs }) => keepAttrs),\n },\n });\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const {\n model: {\n data: nextData = [],\n correctAnswer: { data: nextCorrectAnswerData = [] },\n } = {},\n } = nextProps;\n\n const {\n model: {\n data = [],\n } = {},\n } = this.props;\n\n const { categories } = this.state;\n let nextCategories = [];\n\n if (nextData.length > data.length && nextCorrectAnswerData.length > data.length) {\n nextCategories = insertCategory(nextCorrectAnswerData, nextData);\n }\n\n if (nextData.length < data.length) {\n let removedIndex = nextData.length;\n\n // we need to remove the category from the correct answer data and categories, from the same index it was removed from the data\n // index is a property of the nextData category\n for (let index = 0; index < nextData.length; index++) {\n if (nextData[index].index !== index) {\n removedIndex = index;\n break;\n }\n }\n\n this.props.model.correctAnswer.data.splice(removedIndex, 1);\n nextCategories = removeCategory(categories, nextData, removedIndex);\n }\n\n if (!isEqual(nextCorrectAnswerData, this.props.model.correctAnswer.data)) {\n nextCategories = nextCorrectAnswerData.map((correct, index) => ({ ...correct, editable: index < data.length ? data[index].editable : true, interactive: index < data.length ? data[index].interactive : true }));\n }else if (isEmpty(nextCategories)) {\n nextCategories = updateCorrectResponseData(\n nextCorrectAnswerData,\n nextData\n );\n\n nextCorrectAnswerData.map((answer, currentIndex) => {\n const dataExists = currentIndex < nextData.length;\n let label;\n let value;\n let deletable;\n\n if (dataExists) {\n label = nextData[currentIndex].editable ? answer.label : nextData[currentIndex].label;\n value = nextData[currentIndex].interactive ? answer.value : nextData[currentIndex].value;\n } else {\n label = answer.label;\n value = answer.value;\n deletable = true;\n }\n\n nextCorrectAnswerData[currentIndex] = {\n label: label,\n value: value,\n };\n });\n }\n\n if (!isEqual(nextCategories, data)) {\n this.setState({ categories: nextCategories });\n }\n }\n\n render() {\n const { model, charts } = this.props;\n const { categories } = this.state;\n\n return (\n <div>\n Define Correct Response\n <div key={`correct-response-graph-${model.correctAnswer.name}`}>\n <p>{model.correctAnswer.name}</p>\n <Chart\n chartType={model.chartType}\n size={model.graph}\n domain={model.domain}\n range={model.range}\n charts={charts}\n data={categories}\n title={model.title}\n onDataChange={(data) => this.changeData(data)}\n addCategoryEnabled={model.addCategoryEnabled}\n categoryDefaultLabel={model.categoryDefaultLabel}\n />\n </div>\n </div>\n );\n }\n}\n\nexport default withStyles(styles)(CorrectResponse);\n"],"file":"correct-response.js"}
|
|
@@ -73,6 +73,16 @@ var _default = {
|
|
|
73
73
|
title: {
|
|
74
74
|
settings: false,
|
|
75
75
|
label: 'Graph Title'
|
|
76
|
+
},
|
|
77
|
+
maxImageWidth: {
|
|
78
|
+
teacherInstructions: 300,
|
|
79
|
+
prompt: 300,
|
|
80
|
+
rationale: 300
|
|
81
|
+
},
|
|
82
|
+
maxImageHeight: {
|
|
83
|
+
teacherInstructions: 300,
|
|
84
|
+
prompt: 300,
|
|
85
|
+
rationale: 300
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","categoryDefaultLabel","chartType","correctAnswer","data","domain","label","graph","width","height","prompt","promptEnabled","rationale","range","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","spellCheck","settings","enabled","studentInstructions","teacherInstructions"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,kBAAkB,EAAE,IADf;AAELC,IAAAA,oBAAoB,EAAE,UAFjB;AAGLC,IAAAA,SAAS,EAAE,WAHN;AAILC,IAAAA,aAAa,EAAE,EAJV;AAKLC,IAAAA,IAAI,EAAE,EALD;AAMLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE;AADD,KANH;AASLC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,GADF;AAELC,MAAAA,MAAM,EAAE;AAFH,KATF;AAaLC,IAAAA,MAAM,EAAE,sBAbH;AAcLC,IAAAA,aAAa,EAAE,IAdV;AAeLC,IAAAA,SAAS,EAAE,sBAfN;AAgBLC,IAAAA,KAAK,EAAE;AACLP,MAAAA,KAAK,EAAE,QADF;AAELQ,MAAAA,GAAG,EAAE,GAFA;AAGLC,MAAAA,GAAG,EAAE;AAHA,KAhBF;AAqBLC,IAAAA,WAAW,EAAE,gBArBR;AAsBLC,IAAAA,KAAK,EAAE,kBAtBF;AAuBLC,IAAAA,gBAAgB,EAAE,IAvBb;AAwBLC,IAAAA,0BAA0B,EAAE,IAxBvB;AAyBLC,IAAAA,0BAA0B,EAAE;AAzBvB,GADM;AA4BbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVhB,MAAAA,KAAK,EAAE,YADG;AAEViB,MAAAA,QAAQ,EAAC,KAFC;AAGVC,MAAAA,OAAO,EAAC;AAHE,KADC;AAMbd,IAAAA,MAAM,EAAE;AACNa,MAAAA,QAAQ,EAAE,IADJ;AAENjB,MAAAA,KAAK,EAAE;AAFD,KANK;AAUbM,IAAAA,SAAS,EAAE;AACTW,MAAAA,QAAQ,EAAE,IADD;AAETjB,MAAAA,KAAK,EAAE;AAFE,KAVE;AAcbU,IAAAA,WAAW,EAAE;AACXO,MAAAA,QAAQ,EAAE,KADC;AAEXjB,MAAAA,KAAK,EAAE;AAFI,KAdA;AAkBbmB,IAAAA,mBAAmB,EAAE;AACnBF,MAAAA,QAAQ,EAAE,KADS;AAEnBjB,MAAAA,KAAK,EAAE;AAFY,KAlBR;AAsBboB,IAAAA,mBAAmB,EAAE;AACnBH,MAAAA,QAAQ,EAAE,IADS;AAEnBjB,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbW,IAAAA,KAAK,EAAE;AACLM,MAAAA,QAAQ,EAAE,KADL;AAELjB,MAAAA,KAAK,EAAE;AAFF;
|
|
1
|
+
{"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","categoryDefaultLabel","chartType","correctAnswer","data","domain","label","graph","width","height","prompt","promptEnabled","rationale","range","max","min","scoringType","title","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","configuration","spellCheck","settings","enabled","studentInstructions","teacherInstructions","maxImageWidth","maxImageHeight"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;eAEe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,kBAAkB,EAAE,IADf;AAELC,IAAAA,oBAAoB,EAAE,UAFjB;AAGLC,IAAAA,SAAS,EAAE,WAHN;AAILC,IAAAA,aAAa,EAAE,EAJV;AAKLC,IAAAA,IAAI,EAAE,EALD;AAMLC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE;AADD,KANH;AASLC,IAAAA,KAAK,EAAE;AACLC,MAAAA,KAAK,EAAE,GADF;AAELC,MAAAA,MAAM,EAAE;AAFH,KATF;AAaLC,IAAAA,MAAM,EAAE,sBAbH;AAcLC,IAAAA,aAAa,EAAE,IAdV;AAeLC,IAAAA,SAAS,EAAE,sBAfN;AAgBLC,IAAAA,KAAK,EAAE;AACLP,MAAAA,KAAK,EAAE,QADF;AAELQ,MAAAA,GAAG,EAAE,GAFA;AAGLC,MAAAA,GAAG,EAAE;AAHA,KAhBF;AAqBLC,IAAAA,WAAW,EAAE,gBArBR;AAsBLC,IAAAA,KAAK,EAAE,kBAtBF;AAuBLC,IAAAA,gBAAgB,EAAE,IAvBb;AAwBLC,IAAAA,0BAA0B,EAAE,IAxBvB;AAyBLC,IAAAA,0BAA0B,EAAE;AAzBvB,GADM;AA4BbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,UAAU,EAAE;AACVhB,MAAAA,KAAK,EAAE,YADG;AAEViB,MAAAA,QAAQ,EAAC,KAFC;AAGVC,MAAAA,OAAO,EAAC;AAHE,KADC;AAMbd,IAAAA,MAAM,EAAE;AACNa,MAAAA,QAAQ,EAAE,IADJ;AAENjB,MAAAA,KAAK,EAAE;AAFD,KANK;AAUbM,IAAAA,SAAS,EAAE;AACTW,MAAAA,QAAQ,EAAE,IADD;AAETjB,MAAAA,KAAK,EAAE;AAFE,KAVE;AAcbU,IAAAA,WAAW,EAAE;AACXO,MAAAA,QAAQ,EAAE,KADC;AAEXjB,MAAAA,KAAK,EAAE;AAFI,KAdA;AAkBbmB,IAAAA,mBAAmB,EAAE;AACnBF,MAAAA,QAAQ,EAAE,KADS;AAEnBjB,MAAAA,KAAK,EAAE;AAFY,KAlBR;AAsBboB,IAAAA,mBAAmB,EAAE;AACnBH,MAAAA,QAAQ,EAAE,IADS;AAEnBjB,MAAAA,KAAK,EAAE;AAFY,KAtBR;AA0BbW,IAAAA,KAAK,EAAE;AACLM,MAAAA,QAAQ,EAAE,KADL;AAELjB,MAAAA,KAAK,EAAE;AAFF,KA1BM;AA8BbqB,IAAAA,aAAa,EAAE;AACbD,MAAAA,mBAAmB,EAAE,GADR;AAEbhB,MAAAA,MAAM,EAAE,GAFK;AAGbE,MAAAA,SAAS,EAAE;AAHE,KA9BF;AAmCbgB,IAAAA,cAAc,EAAE;AACdF,MAAAA,mBAAmB,EAAE,GADP;AAEdhB,MAAAA,MAAM,EAAE,GAFM;AAGdE,MAAAA,SAAS,EAAE;AAHG;AAnCH;AA5BF,C","sourcesContent":["/**\n * NOTE: There's no functionality described for graphTitle,\n * rationale, scoringType, studentInstructions, teacherInstructions\n * so there's no implementation (they are only added in model)\n */\n\n\n// const createCategory = (label, value) => ({\n// label,\n// value,\n// interactive: true,\n// editable: true\n// });\n\nexport default {\n model: {\n addCategoryEnabled: true,\n categoryDefaultLabel: 'Category',\n chartType: 'lineCross',\n correctAnswer: {},\n data: [],\n domain: {\n label: 'Fruits',\n },\n graph: {\n width: 480,\n height: 480\n },\n prompt: 'Here goes item stem!',\n promptEnabled: true,\n rationale: 'Rationale goes here!',\n range: {\n label: 'Amount',\n max: 5.5,\n min: 0,\n },\n scoringType: 'all or nothing',\n title: 'This is a chart!',\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n },\n configuration: {\n spellCheck: {\n label: 'Spellcheck',\n settings:false,\n enabled:true\n },\n prompt: {\n settings: true,\n label: 'Item Stem'\n },\n rationale: {\n settings: true,\n label: 'Rationale'\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type'\n },\n studentInstructions: {\n settings: false,\n label: 'Student Instructions'\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions'\n },\n title: {\n settings: false,\n label: 'Graph Title'\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n }\n }\n};\n"],"file":"defaults.js"}
|
package/configure/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/charting-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "src/index.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@material-ui/core": "^3.9.2",
|
|
11
11
|
"@pie-framework/pie-configure-events": "^1.2.0",
|
|
12
|
-
"@pie-lib/charting": "^5.
|
|
13
|
-
"@pie-lib/config-ui": "^
|
|
14
|
-
"@pie-lib/editable-html": "^
|
|
12
|
+
"@pie-lib/charting": "^5.1.0",
|
|
13
|
+
"@pie-lib/config-ui": "^11.0.1",
|
|
14
|
+
"@pie-lib/editable-html": "^8.1.0",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"prop-types": "^15.6.2",
|
package/docs/config-schema.json
CHANGED
|
@@ -120,6 +120,48 @@
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
|
+
"maxImageWidth": {
|
|
124
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
125
|
+
"type": "object",
|
|
126
|
+
"properties": {
|
|
127
|
+
"teacherInstructions": {
|
|
128
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
129
|
+
"type": "number",
|
|
130
|
+
"title": "teacherInstructions"
|
|
131
|
+
},
|
|
132
|
+
"prompt": {
|
|
133
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
134
|
+
"type": "number",
|
|
135
|
+
"title": "prompt"
|
|
136
|
+
},
|
|
137
|
+
"rationale": {
|
|
138
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
139
|
+
"type": "number",
|
|
140
|
+
"title": "rationale"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"maxImageHeight": {
|
|
145
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
146
|
+
"type": "object",
|
|
147
|
+
"properties": {
|
|
148
|
+
"teacherInstructions": {
|
|
149
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
150
|
+
"type": "number",
|
|
151
|
+
"title": "teacherInstructions"
|
|
152
|
+
},
|
|
153
|
+
"prompt": {
|
|
154
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
155
|
+
"type": "number",
|
|
156
|
+
"title": "prompt"
|
|
157
|
+
},
|
|
158
|
+
"rationale": {
|
|
159
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
160
|
+
"type": "number",
|
|
161
|
+
"title": "rationale"
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
123
165
|
"showPrompt": {
|
|
124
166
|
"description": "Determines whether prompt field will be displayed or not",
|
|
125
167
|
"default": true,
|
|
@@ -176,6 +218,27 @@
|
|
|
176
218
|
"title": "enabled"
|
|
177
219
|
}
|
|
178
220
|
}
|
|
221
|
+
},
|
|
222
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
223
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
224
|
+
"type": "object",
|
|
225
|
+
"properties": {
|
|
226
|
+
"teacherInstructions": {
|
|
227
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
228
|
+
"type": "number",
|
|
229
|
+
"title": "teacherInstructions"
|
|
230
|
+
},
|
|
231
|
+
"prompt": {
|
|
232
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
233
|
+
"type": "number",
|
|
234
|
+
"title": "prompt"
|
|
235
|
+
},
|
|
236
|
+
"rationale": {
|
|
237
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
238
|
+
"type": "number",
|
|
239
|
+
"title": "rationale"
|
|
240
|
+
}
|
|
241
|
+
}
|
|
179
242
|
}
|
|
180
243
|
},
|
|
181
244
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
@@ -91,6 +91,38 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
91
91
|
Indicates the value of the item if it affects config-ui
|
|
92
92
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
93
93
|
|
|
94
|
+
# `maxImageWidth` (object)
|
|
95
|
+
|
|
96
|
+
Properties of the `maxImageWidth` object:
|
|
97
|
+
|
|
98
|
+
## `teacherInstructions` (number)
|
|
99
|
+
|
|
100
|
+
Indicates the max dimension for images in teacher instructions
|
|
101
|
+
|
|
102
|
+
## `prompt` (number)
|
|
103
|
+
|
|
104
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
105
|
+
|
|
106
|
+
## `rationale` (number)
|
|
107
|
+
|
|
108
|
+
Indicates the max dimension for images in rationale
|
|
109
|
+
|
|
110
|
+
# `maxImageHeight` (object)
|
|
111
|
+
|
|
112
|
+
Properties of the `maxImageHeight` object:
|
|
113
|
+
|
|
114
|
+
## `teacherInstructions` (number)
|
|
115
|
+
|
|
116
|
+
Indicates the max dimension for images in teacher instructions
|
|
117
|
+
|
|
118
|
+
## `prompt` (number)
|
|
119
|
+
|
|
120
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
121
|
+
|
|
122
|
+
## `rationale` (number)
|
|
123
|
+
|
|
124
|
+
Indicates the max dimension for images in rationale
|
|
125
|
+
|
|
94
126
|
# `showPrompt` (boolean)
|
|
95
127
|
|
|
96
128
|
Determines whether prompt field will be displayed or not
|
|
@@ -142,4 +174,20 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
142
174
|
### `enabled` (boolean)
|
|
143
175
|
|
|
144
176
|
Indicates the value of the item if it affects config-ui
|
|
145
|
-
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
177
|
+
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
178
|
+
|
|
179
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
180
|
+
|
|
181
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
182
|
+
|
|
183
|
+
### `teacherInstructions` (number)
|
|
184
|
+
|
|
185
|
+
Indicates the max dimension for images in teacher instructions
|
|
186
|
+
|
|
187
|
+
### `prompt` (number)
|
|
188
|
+
|
|
189
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
190
|
+
|
|
191
|
+
### `rationale` (number)
|
|
192
|
+
|
|
193
|
+
Indicates the max dimension for images in rationale
|
package/docs/demo/generate.js
CHANGED
|
@@ -8,21 +8,15 @@ exports.model = (id, element) => ({
|
|
|
8
8
|
data: [
|
|
9
9
|
{
|
|
10
10
|
label: 'A',
|
|
11
|
-
value: 1
|
|
12
|
-
interactive: false,
|
|
13
|
-
editable: false
|
|
11
|
+
value: 1
|
|
14
12
|
},
|
|
15
13
|
{
|
|
16
14
|
label: 'B',
|
|
17
|
-
value: 1
|
|
18
|
-
interactive: true,
|
|
19
|
-
editable: false
|
|
15
|
+
value: 1
|
|
20
16
|
},
|
|
21
17
|
{
|
|
22
18
|
label: 'C',
|
|
23
|
-
value: 1
|
|
24
|
-
interactive: true,
|
|
25
|
-
editable: false
|
|
19
|
+
value: 1
|
|
26
20
|
},
|
|
27
21
|
]
|
|
28
22
|
},
|
package/docs/pie-schema.json
CHANGED
|
@@ -548,6 +548,27 @@
|
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
550
|
},
|
|
551
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
552
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
553
|
+
"type": "object",
|
|
554
|
+
"properties": {
|
|
555
|
+
"teacherInstructions": {
|
|
556
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
557
|
+
"type": "number",
|
|
558
|
+
"title": "teacherInstructions"
|
|
559
|
+
},
|
|
560
|
+
"prompt": {
|
|
561
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
562
|
+
"type": "number",
|
|
563
|
+
"title": "prompt"
|
|
564
|
+
},
|
|
565
|
+
"rationale": {
|
|
566
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
567
|
+
"type": "number",
|
|
568
|
+
"title": "rationale"
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
},
|
|
551
572
|
"Answer": {
|
|
552
573
|
"title": "Answer",
|
|
553
574
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -197,6 +197,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
197
197
|
Indicates the value of the item if it affects config-ui
|
|
198
198
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
199
199
|
|
|
200
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
201
|
+
|
|
202
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
203
|
+
|
|
204
|
+
### `teacherInstructions` (number)
|
|
205
|
+
|
|
206
|
+
Indicates the max dimension for images in teacher instructions
|
|
207
|
+
|
|
208
|
+
### `prompt` (number)
|
|
209
|
+
|
|
210
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
211
|
+
|
|
212
|
+
### `rationale` (number)
|
|
213
|
+
|
|
214
|
+
Indicates the max dimension for images in rationale
|
|
215
|
+
|
|
200
216
|
## `Answer` (object)
|
|
201
217
|
|
|
202
218
|
Properties of the `Answer` object:
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "4.0.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,7 +13,7 @@
|
|
|
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": "^5.
|
|
16
|
+
"@pie-lib/charting": "^5.1.0",
|
|
17
17
|
"@pie-lib/correct-answer-toggle": "^2.3.39",
|
|
18
18
|
"@pie-lib/math-rendering": "^2.4.3",
|
|
19
19
|
"@pie-lib/render-ui": "^4.12.9",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ff92cee6f9a7bf3f3dc75dbafd2263710f0a6b3d",
|
|
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"}
|