@pie-element/charting 2.7.28 → 3.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 +33 -0
- package/configure/CHANGELOG.md +33 -0
- package/configure/lib/charting-config.js +16 -2
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/correct-response.js +2 -27
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +1 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/index.js +24 -20
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/demo/generate.js +6 -20
- package/docs/demo/session.js +3 -9
- package/docs/pie-schema.json +0 -48
- package/docs/pie-schema.json.md +0 -8
- package/lib/main.js +0 -3
- package/lib/main.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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
|
+
# [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
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **charting:** remove editCategoryEnabled property checkbox and usage. ([b5e6a93](https://github.com/pie-framework/pie-elements/commit/b5e6a93fb99c957bec304bac7d7bf34ee3c98f27))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **charting:** The editCategoryEnabled checkbox and property was removed.
|
|
17
|
+
Enabled property will be used for each category.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [2.7.30](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.29...@pie-element/charting@2.7.30) (2022-05-30)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @pie-element/charting
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [2.7.29](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.28...@pie-element/charting@2.7.29) (2022-05-16)
|
|
32
|
+
|
|
33
|
+
**Note:** Version bump only for package @pie-element/charting
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
## [2.7.28](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting@2.7.27...@pie-element/charting@2.7.28) (2022-05-09)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package @pie-element/charting
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,39 @@
|
|
|
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
|
+
# [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
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **charting:** remove editCategoryEnabled property checkbox and usage. ([b5e6a93](https://github.com/pie-framework/pie-elements/commit/b5e6a93fb99c957bec304bac7d7bf34ee3c98f27))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* **charting:** The editCategoryEnabled checkbox and property was removed.
|
|
17
|
+
Enabled property will be used for each category.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [2.1.49](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.48...@pie-element/charting-configure@2.1.49) (2022-05-30)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package @pie-element/charting-configure
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [2.1.48](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.47...@pie-element/charting-configure@2.1.48) (2022-05-16)
|
|
32
|
+
|
|
33
|
+
**Note:** Version bump only for package @pie-element/charting-configure
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
6
39
|
## [2.1.47](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-configure@2.1.46...@pie-element/charting-configure@2.1.47) (2022-05-09)
|
|
7
40
|
|
|
8
41
|
**Note:** Version bump only for package @pie-element/charting-configure
|
|
@@ -31,6 +31,8 @@ var _styles = require("@material-ui/core/styles");
|
|
|
31
31
|
|
|
32
32
|
var _charting = require("@pie-lib/charting");
|
|
33
33
|
|
|
34
|
+
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
35
|
+
|
|
34
36
|
var _Typography = _interopRequireDefault(require("@material-ui/core/Typography"));
|
|
35
37
|
|
|
36
38
|
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); }
|
|
@@ -79,12 +81,19 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
79
81
|
data: data
|
|
80
82
|
}));
|
|
81
83
|
});
|
|
84
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeAddRemoveEnabled", function (value) {
|
|
85
|
+
return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
86
|
+
addCategoryEnabled: value
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
82
89
|
return _this;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
(0, _createClass2["default"])(ChartingConfig, [{
|
|
86
93
|
key: "render",
|
|
87
94
|
value: function render() {
|
|
95
|
+
var _this2 = this;
|
|
96
|
+
|
|
88
97
|
var _this$props = this.props,
|
|
89
98
|
classes = _this$props.classes,
|
|
90
99
|
model = _this$props.model,
|
|
@@ -98,6 +107,7 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
98
107
|
component: "div",
|
|
99
108
|
type: "body1"
|
|
100
109
|
}, /*#__PURE__*/React.createElement("span", null, "Use the tools below to set background shapes")), /*#__PURE__*/React.createElement(_charting.Chart, {
|
|
110
|
+
defineChart: true,
|
|
101
111
|
chartType: model.chartType,
|
|
102
112
|
size: model.graph,
|
|
103
113
|
domain: model.domain,
|
|
@@ -106,10 +116,14 @@ var ChartingConfig = /*#__PURE__*/function (_React$Component) {
|
|
|
106
116
|
data: model.data,
|
|
107
117
|
title: model.title,
|
|
108
118
|
onDataChange: this.changeData,
|
|
109
|
-
editCategoryEnabled: true,
|
|
110
119
|
addCategoryEnabled: true,
|
|
111
120
|
categoryDefaultLabel: model.categoryDefaultLabel
|
|
112
|
-
})
|
|
121
|
+
}), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Checkbox["default"], {
|
|
122
|
+
checked: model.addCategoryEnabled,
|
|
123
|
+
onChange: function onChange(e) {
|
|
124
|
+
_this2.changeAddRemoveEnabled(e.target.checked);
|
|
125
|
+
}
|
|
126
|
+
}), "Student can add categories"))));
|
|
113
127
|
}
|
|
114
128
|
}]);
|
|
115
129
|
return ChartingConfig;
|
|
@@ -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","classes","charts","chartType","graph","domain","range","title","changeData","categoryDefaultLabel","React","Component","PropTypes","object","isRequired","func","array"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;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;;;;;;
|
|
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,IAA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G,8CACC,oBAAC,oBAAD;AACE,QAAA,OAAO,EAAEX,KAAK,CAACE,kBADjB;AAEE,QAAA,QAAQ,EAAE,kBAACU,CAAD,EAAO;AACf,UAAA,MAAI,CAACC,sBAAL,CAA4BD,CAAC,CAACE,MAAF,CAASC,OAArC;AACD;AAJH,QADD,+BAlBH,CADF,CAHF,CADF;AAqCD;;;EApDiCC,KAAK,CAACC,S;;;iCAA7BrB,c,eACQ;AACjBO,EAAAA,OAAO,EAAEe,sBAAUC,MAAV,CAAiBC,UADT;AAEjBpB,EAAAA,KAAK,EAAEkB,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBrB,EAAAA,QAAQ,EAAEmB,sBAAUG,IAAV,CAAeD,UAHR;AAIjBhB,EAAAA,MAAM,EAAEc,sBAAUI;AAJD,C;;eAsDN,wBAAWpC,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 data={model.data}\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"}
|
|
@@ -29,8 +29,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
29
29
|
|
|
30
30
|
var _styles = require("@material-ui/core/styles");
|
|
31
31
|
|
|
32
|
-
var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
|
|
33
|
-
|
|
34
32
|
var _charting = require("@pie-lib/charting");
|
|
35
33
|
|
|
36
34
|
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); }
|
|
@@ -93,16 +91,6 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
|
93
91
|
})
|
|
94
92
|
}));
|
|
95
93
|
});
|
|
96
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeEditable", function (value) {
|
|
97
|
-
return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
98
|
-
editCategoryEnabled: value
|
|
99
|
-
}));
|
|
100
|
-
});
|
|
101
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeAddRemoveEnabled", function (value) {
|
|
102
|
-
return _this.props.onChange(_objectSpread(_objectSpread({}, _this.props.model), {}, {
|
|
103
|
-
addCategoryEnabled: value
|
|
104
|
-
}));
|
|
105
|
-
});
|
|
106
94
|
return _this;
|
|
107
95
|
}
|
|
108
96
|
|
|
@@ -116,8 +104,6 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
|
116
104
|
model = _this$props2.model,
|
|
117
105
|
charts = _this$props2.charts;
|
|
118
106
|
return /*#__PURE__*/React.createElement("div", null, "Define Correct Response", /*#__PURE__*/React.createElement("div", {
|
|
119
|
-
className: classes.container
|
|
120
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
121
107
|
key: "correct-response-graph-".concat(model.correctAnswer.name)
|
|
122
108
|
}, /*#__PURE__*/React.createElement("p", null, model.correctAnswer.name), /*#__PURE__*/React.createElement(_charting.Chart, {
|
|
123
109
|
chartType: model.chartType,
|
|
@@ -130,20 +116,9 @@ var CorrectResponse = /*#__PURE__*/function (_React$Component) {
|
|
|
130
116
|
onDataChange: function onDataChange(data) {
|
|
131
117
|
return _this2.changeData(data);
|
|
132
118
|
},
|
|
133
|
-
|
|
134
|
-
addCategoryEnabled: true,
|
|
119
|
+
addCategoryEnabled: model.addCategoryEnabled,
|
|
135
120
|
categoryDefaultLabel: model.categoryDefaultLabel
|
|
136
|
-
})
|
|
137
|
-
checked: model.editCategoryEnabled,
|
|
138
|
-
onChange: function onChange(e) {
|
|
139
|
-
_this2.changeEditable(e.target.checked);
|
|
140
|
-
}
|
|
141
|
-
}), "Student can edit category labels"), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_Checkbox["default"], {
|
|
142
|
-
checked: model.addCategoryEnabled,
|
|
143
|
-
onChange: function onChange(e) {
|
|
144
|
-
_this2.changeAddRemoveEnabled(e.target.checked);
|
|
145
|
-
}
|
|
146
|
-
}), "Student can add/remove category labels"))));
|
|
121
|
+
})));
|
|
147
122
|
}
|
|
148
123
|
}]);
|
|
149
124
|
return CorrectResponse;
|
|
@@ -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","
|
|
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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from 'react';\nimport PropTypes 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"}
|
|
@@ -13,10 +13,8 @@ exports["default"] = void 0;
|
|
|
13
13
|
// const createCategory = (label, value) => ({
|
|
14
14
|
// label,
|
|
15
15
|
// value,
|
|
16
|
-
// initial: true,
|
|
17
16
|
// interactive: true,
|
|
18
|
-
// editable: true
|
|
19
|
-
// deletable: true
|
|
17
|
+
// editable: true
|
|
20
18
|
// });
|
|
21
19
|
var _default = {
|
|
22
20
|
model: {
|
|
@@ -28,7 +26,6 @@ var _default = {
|
|
|
28
26
|
domain: {
|
|
29
27
|
label: 'Fruits'
|
|
30
28
|
},
|
|
31
|
-
editCategoryEnabled: true,
|
|
32
29
|
graph: {
|
|
33
30
|
width: 480,
|
|
34
31
|
height: 480
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defaults.js"],"names":["model","addCategoryEnabled","categoryDefaultLabel","chartType","correctAnswer","data","domain","label","
|
|
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;AA1BM;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 }\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": "3.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": "^
|
|
13
|
-
"@pie-lib/config-ui": "^10.
|
|
14
|
-
"@pie-lib/editable-html": "^7.22.
|
|
12
|
+
"@pie-lib/charting": "^5.0.0",
|
|
13
|
+
"@pie-lib/config-ui": "^10.13.3",
|
|
14
|
+
"@pie-lib/editable-html": "^7.22.6",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"debug": "^4.1.1",
|
|
17
17
|
"prop-types": "^15.6.2",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
## [2.2.24](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.2.23...@pie-element/charting-controller@2.2.24) (2022-06-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/charting-controller
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [2.2.23](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.2.22...@pie-element/charting-controller@2.2.23) (2022-05-30)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @pie-element/charting-controller
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [2.2.22](https://github.com/pie-framework/pie-elements/compare/@pie-element/charting-controller@2.2.21...@pie-element/charting-controller@2.2.22) (2022-01-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @pie-element/charting-controller
|
package/controller/lib/index.js
CHANGED
|
@@ -23,7 +23,8 @@ var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
|
23
23
|
|
|
24
24
|
var _controllerUtils = require("@pie-lib/controller-utils");
|
|
25
25
|
|
|
26
|
-
var _excluded = ["
|
|
26
|
+
var _excluded = ["deletable"],
|
|
27
|
+
_excluded2 = ["correctness"];
|
|
27
28
|
|
|
28
29
|
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; }
|
|
29
30
|
|
|
@@ -57,7 +58,6 @@ exports.setCorrectness = setCorrectness;
|
|
|
57
58
|
var normalize = function normalize(question) {
|
|
58
59
|
return _objectSpread({
|
|
59
60
|
addCategoryEnabled: true,
|
|
60
|
-
editCategoryEnabled: true,
|
|
61
61
|
promptEnabled: true,
|
|
62
62
|
rationaleEnabled: true,
|
|
63
63
|
teacherInstructionsEnabled: true,
|
|
@@ -72,8 +72,7 @@ var getScore = function getScore(question, session) {
|
|
|
72
72
|
var correctAnswer = question.correctAnswer,
|
|
73
73
|
_question$data = question.data,
|
|
74
74
|
initialData = _question$data === void 0 ? [] : _question$data,
|
|
75
|
-
scoringType = question.scoringType
|
|
76
|
-
editCategoryEnabled = question.editCategoryEnabled;
|
|
75
|
+
scoringType = question.scoringType;
|
|
77
76
|
|
|
78
77
|
var isPartialScoring = _controllerUtils.partialScoring.enabled({
|
|
79
78
|
partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType
|
|
@@ -83,7 +82,7 @@ var getScore = function getScore(question, session) {
|
|
|
83
82
|
_ref$data = _ref.data,
|
|
84
83
|
correctAnswers = _ref$data === void 0 ? [] : _ref$data;
|
|
85
84
|
|
|
86
|
-
var defaultAnswers = filterCategories(initialData
|
|
85
|
+
var defaultAnswers = filterCategories(initialData);
|
|
87
86
|
var answers = setCorrectness(session && session.answer || defaultAnswers, isPartialScoring);
|
|
88
87
|
var result = 0;
|
|
89
88
|
|
|
@@ -183,13 +182,11 @@ var getScore = function getScore(question, session) {
|
|
|
183
182
|
|
|
184
183
|
exports.getScore = getScore;
|
|
185
184
|
|
|
186
|
-
var filterCategories = function filterCategories(categories
|
|
187
|
-
return categories ? categories.map(function (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
initial: true
|
|
192
|
-
});
|
|
185
|
+
var filterCategories = function filterCategories(categories) {
|
|
186
|
+
return categories ? categories.map(function (_ref2) {
|
|
187
|
+
var deletable = _ref2.deletable,
|
|
188
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
189
|
+
return rest;
|
|
193
190
|
}) : [];
|
|
194
191
|
};
|
|
195
192
|
|
|
@@ -203,7 +200,6 @@ function model(question, session, env) {
|
|
|
203
200
|
chartType = normalizedQuestion.chartType,
|
|
204
201
|
data = normalizedQuestion.data,
|
|
205
202
|
domain = normalizedQuestion.domain,
|
|
206
|
-
editCategoryEnabled = normalizedQuestion.editCategoryEnabled,
|
|
207
203
|
graph = normalizedQuestion.graph,
|
|
208
204
|
prompt = normalizedQuestion.prompt,
|
|
209
205
|
promptEnabled = normalizedQuestion.promptEnabled,
|
|
@@ -223,9 +219,8 @@ function model(question, session, env) {
|
|
|
223
219
|
addCategoryEnabled: addCategoryEnabled,
|
|
224
220
|
categoryDefaultLabel: categoryDefaultLabel,
|
|
225
221
|
chartType: chartType,
|
|
226
|
-
data: filterCategories(data
|
|
222
|
+
data: filterCategories(data),
|
|
227
223
|
domain: domain,
|
|
228
|
-
editCategoryEnabled: editCategoryEnabled,
|
|
229
224
|
graph: graph,
|
|
230
225
|
prompt: promptEnabled ? prompt : null,
|
|
231
226
|
range: range,
|
|
@@ -236,12 +231,12 @@ function model(question, session, env) {
|
|
|
236
231
|
disabled: env.mode !== 'gather',
|
|
237
232
|
scoringType: scoringType
|
|
238
233
|
};
|
|
239
|
-
var answers = filterCategories(getScore(normalizedQuestion, session, env).answers
|
|
234
|
+
var answers = filterCategories(getScore(normalizedQuestion, session, env).answers);
|
|
240
235
|
|
|
241
236
|
if (env.mode === 'view') {
|
|
242
|
-
base.correctedAnswer = answers.map(function (
|
|
243
|
-
var correctness =
|
|
244
|
-
rest = (0, _objectWithoutProperties2["default"])(
|
|
237
|
+
base.correctedAnswer = answers.map(function (_ref3) {
|
|
238
|
+
var correctness = _ref3.correctness,
|
|
239
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref3, _excluded2);
|
|
245
240
|
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
246
241
|
interactive: false
|
|
247
242
|
});
|
|
@@ -281,8 +276,17 @@ var createCorrectResponseSession = function createCorrectResponseSession(questio
|
|
|
281
276
|
return new Promise(function (resolve) {
|
|
282
277
|
if (env.mode !== 'evaluate' && env.role === 'instructor') {
|
|
283
278
|
var correctAnswer = question.correctAnswer;
|
|
279
|
+
var answers = correctAnswer && correctAnswer.data; // for IBX preview mode
|
|
280
|
+
|
|
281
|
+
if (env.mode === 'gather') {
|
|
282
|
+
var data = question.data;
|
|
283
|
+
answers = (correctAnswer && correctAnswer.data || []).map(function (answer, index) {
|
|
284
|
+
return _objectSpread(_objectSpread({}, data[index]), answer);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
284
288
|
resolve({
|
|
285
|
-
answer:
|
|
289
|
+
answer: answers,
|
|
286
290
|
id: '1'
|
|
287
291
|
});
|
|
288
292
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","editCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","category","deletable","initial","model","Promise","resolve","normalizedQuestion","categoryDefaultLabel","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","correctInfo","base","size","disabled","mode","correctedAnswer","rest","role","outcome","empty","createCorrectResponseSession","id"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,MAAM;AAAA,SAAI,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAJ;AAAA,CAAxB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV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;AACF,GAXM,CAAP;AAYD,CAbM","sourcesContent":["import debug from 'debug';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = string => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) => answers ? answers.map(answer => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct'\n }\n})) : [];\n\n\nexport const normalize = question => ({\n addCategoryEnabled: true,\n editCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType, editCategoryEnabled } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData, editCategoryEnabled);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true)\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers\n };\n};\n\nexport const filterCategories = (categories, editable) => categories ? categories.map(category => ({\n ...category,\n deletable: false,\n editable,\n initial: true\n})) : [];\n\nexport function model(question, session, env) {\n return new Promise(resolve => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data,\n domain,\n editCategoryEnabled,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data: filterCategories(data, editCategoryEnabled),\n domain,\n editCategoryEnabled,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers, false);\n\n if (env.mode === 'view') {\n base.correctedAnswer = answers.map(({correctness, ...rest}) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session)\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n resolve({\n answer: correctAnswer && correctAnswer.data,\n id: '1'\n });\n } else {\n return resolve(null);\n }\n });\n};\n"],"file":"index.js"}
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","lowerCase","string","toLowerCase","checkLabelsEquality","givenAnswerLabel","correctAnswerLabel","setCorrectness","answers","partialScoring","map","answer","correctness","value","label","normalize","question","addCategoryEnabled","promptEnabled","rationaleEnabled","teacherInstructionsEnabled","studentInstructionsEnabled","getScore","session","env","correctAnswer","data","initialData","scoringType","isPartialScoring","enabled","undefined","correctAnswers","defaultAnswers","filterCategories","result","maxScore","score","scoreForLabelAndValueEditable","corrAnswer","forEach","index","defaultAnswer","editable","interactive","length","slice","parseFloat","toFixed","categories","deletable","rest","model","Promise","resolve","normalizedQuestion","categoryDefaultLabel","chartType","domain","graph","prompt","range","rationale","title","teacherInstructions","correctInfo","base","size","disabled","mode","correctedAnswer","role","outcome","empty","createCorrectResponseSession","id"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,kCAAN,CAAZ;;AAEA,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,MAAM;AAAA,SAAI,CAACA,MAAM,IAAI,EAAX,EAAeC,WAAf,EAAJ;AAAA,CAAxB;;AAEO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,gBAAD,EAAmBC,kBAAnB;AAAA,SACjCL,SAAS,CAACI,gBAAD,CAAT,KAAgCJ,SAAS,CAACK,kBAAD,CADR;AAAA,CAA5B;;;;AAGA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,OAAD,EAAUC,cAAV;AAAA,SAA6BD,OAAO,GAAGA,OAAO,CAACE,GAAR,CAAY,UAAAC,MAAM;AAAA,2CAClFA,MADkF;AAErFC,MAAAA,WAAW,EAAE;AACXC,QAAAA,KAAK,EAAEJ,cAAc,GAAG,WAAH,GAAiB,SAD3B;AAEXK,QAAAA,KAAK,EAAEL,cAAc,GAAG,WAAH,GAAiB;AAF3B;AAFwE;AAAA,GAAlB,CAAH,GAM5D,EANwB;AAAA,CAAvB;;;;AASA,IAAMM,SAAS,GAAG,SAAZA,SAAY,CAAAC,QAAQ;AAAA;AAC/BC,IAAAA,kBAAkB,EAAE,IADW;AAE/BC,IAAAA,aAAa,EAAE,IAFgB;AAG/BC,IAAAA,gBAAgB,EAAE,IAHa;AAI/BC,IAAAA,0BAA0B,EAAE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+B,CAAC1D,QAAD,EAAWQ,GAAX,EAAmB;AAC7D,SAAO,IAAI6B,OAAJ,CAAY,UAAAC,OAAO,EAAI;AAC5B,QAAI9B,GAAG,CAAC6C,IAAJ,KAAa,UAAb,IAA2B7C,GAAG,CAAC+C,IAAJ,KAAa,YAA5C,EAA0D;AACxD,UAAQ9C,aAAR,GAA0BT,QAA1B,CAAQS,aAAR;AAEA,UAAIjB,OAAO,GAAGiB,aAAa,IAAIA,aAAa,CAACC,IAA7C,CAHwD,CAKxD;;AACA,UAAIF,GAAG,CAAC6C,IAAJ,KAAa,QAAjB,EAA2B;AACzB,YAAO3C,IAAP,GAAeV,QAAf,CAAOU,IAAP;AAEAlB,QAAAA,OAAO,GAAG,CAACiB,aAAa,IAAIA,aAAa,CAACC,IAA/B,IAAuC,EAAxC,EAA4ChB,GAA5C,CAAgD,UAACC,MAAD,EAAS8B,KAAT,EAAmB;AAC3E,iDACKf,IAAI,CAACe,KAAD,CADT,GAEK9B,MAFL;AAID,SALS,CAAV;AAMD;;AAED2C,MAAAA,OAAO,CAAC;AACN3C,QAAAA,MAAM,EAAEH,OADF;AAENmE,QAAAA,EAAE,EAAE;AAFE,OAAD,CAAP;AAID,KArBD,MAqBO;AACL,aAAOrB,OAAO,CAAC,IAAD,CAAd;AACD;AACF,GAzBM,CAAP;AA0BD,CA3BM","sourcesContent":["import debug from 'debug';\nimport isEmpty from 'lodash/isEmpty';\n\nimport { partialScoring } from '@pie-lib/controller-utils';\n\nconst log = debug('@pie-element:graphing:controller');\n\nconst lowerCase = string => (string || '').toLowerCase();\n\nexport const checkLabelsEquality = (givenAnswerLabel, correctAnswerLabel) =>\n lowerCase(givenAnswerLabel) === lowerCase(correctAnswerLabel);\n\nexport const setCorrectness = (answers, partialScoring) => answers ? answers.map(answer => ({\n ...answer,\n correctness: {\n value: partialScoring ? 'incorrect' : 'correct',\n label: partialScoring ? 'incorrect' : 'correct'\n }\n})) : [];\n\n\nexport const normalize = question => ({\n addCategoryEnabled: true,\n promptEnabled: true,\n rationaleEnabled: true,\n teacherInstructionsEnabled: true,\n studentInstructionsEnabled: true,\n ...question,\n});\n\nexport const getScore = (question, session, env = {}) => {\n const { correctAnswer, data: initialData = [], scoringType } = question;\n\n const isPartialScoring = partialScoring.enabled(\n { partialScoring: scoringType !== undefined ? scoringType === 'partial scoring' : scoringType },\n env\n );\n\n const { data: correctAnswers = [] } = correctAnswer || {};\n const defaultAnswers = filterCategories(initialData);\n\n let answers = setCorrectness((session && session.answer) || defaultAnswers, isPartialScoring);\n\n let result = 0;\n\n if (isPartialScoring) {\n // if score type is \"partial scoring\"\n // maxScore is calculated based on the correct response\n // score is calculated based on the given response\n let maxScore = 0;\n let score = 0;\n\n const scoreForLabelAndValueEditable = (answer, corrAnswer) => {\n const { value, label } = answer;\n\n maxScore += 2;\n\n if (value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n\n if (checkLabelsEquality(label, corrAnswer.label)) {\n score += 1;\n answer.correctness.label = 'correct';\n }\n };\n\n // if given answer has more categories than the correct answers, the \"extra\" will be ignored\n correctAnswers.forEach((corrAnswer, index) => {\n const defaultAnswer = defaultAnswers[index];\n const answer = answers[index];\n\n // if there is a corresponding category at the same position in the given answer\n if (answer) {\n // if there is a corresponding category at the same position in the default answer\n if (defaultAnswer) {\n // if category's label (in default answer) was not editable\n // it means that this category values only one point (only the value can be changed)\n if (!defaultAnswer.editable && answer.interactive) {\n maxScore += 1;\n\n if (answer.value === corrAnswer.value) {\n score += 1;\n answer.correctness.value = 'correct';\n }\n answer.correctness.label = 'correct';\n\n // if category's label (in default answer) was editable\n // it means that this category values 2 points (both label and value can be changed)\n } else if (defaultAnswer.editable && answer.interactive) {\n scoreForLabelAndValueEditable(answer, corrAnswer);\n } else if (!answer.interactive) {\n answer.correctness.value = 'correct';\n answer.correctness.label = 'correct';\n }\n } else {\n // if there is not a corresponding category at the same position in the default answer\n scoreForLabelAndValueEditable(answer, corrAnswer);\n }\n } else {\n // if there is not a corresponding category at the same position in the given answer\n // it means that the given answer has less categories than the correct answer\n maxScore += 2;\n }\n });\n\n result = maxScore ? score / maxScore : 0;\n } else {\n // if scoring type is \"all or nothing\"\n // the length on correct answers and length of given answer have to match\n result = correctAnswers.length === answers.length ? 1 : 0;\n\n if (result) {\n // if there is at least one difference between the correct answer and the given answer\n // the result will be incorrect\n correctAnswers.forEach((corrAnswer, index) => {\n const { value, label } = answers[index];\n\n if (value !== corrAnswer.value) {\n result = 0;\n answers[index].correctness.value = 'incorrect';\n }\n if (lowerCase(label) !== lowerCase(corrAnswer.label)) {\n result = 0;\n answers[index].correctness.label = 'incorrect';\n }\n });\n } else {\n answers = [\n ...answers.slice(0, correctAnswers.length),\n ...setCorrectness(answers.slice(correctAnswers.length), true)\n ];\n }\n }\n\n return {\n score: parseFloat(result.toFixed(2)),\n answers\n };\n};\n\nexport const filterCategories = (categories) => categories ? categories.map(({deletable, ...rest}) => rest) : [];\n\nexport function model(question, session, env) {\n return new Promise(resolve => {\n const normalizedQuestion = normalize(question);\n const {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data,\n domain,\n graph,\n prompt,\n promptEnabled,\n range,\n rationale,\n title,\n rationaleEnabled,\n teacherInstructions,\n teacherInstructionsEnabled,\n correctAnswer,\n scoringType\n } = normalizedQuestion;\n\n const correctInfo = { correctness: 'incorrect', score: '0%' };\n\n const base = {\n addCategoryEnabled,\n categoryDefaultLabel,\n chartType,\n data: filterCategories(data),\n domain,\n graph,\n prompt: promptEnabled ? prompt : null,\n range,\n rationale,\n title,\n size: graph,\n correctness: correctInfo,\n disabled: env.mode !== 'gather',\n scoringType\n };\n\n const answers = filterCategories(getScore(normalizedQuestion, session, env).answers);\n\n if (env.mode === 'view') {\n base.correctedAnswer = answers.map(({correctness, ...rest}) => {\n return { ...rest, interactive: false };\n });\n\n base.addCategoryEnabled = false;\n }\n\n if (env.mode === 'evaluate') {\n base.correctedAnswer = answers;\n base.correctAnswer = correctAnswer;\n base.addCategoryEnabled = false;\n }\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n base.rationale = rationaleEnabled ? rationale : null;\n base.teacherInstructions = teacherInstructionsEnabled ? teacherInstructions : null;\n } else {\n base.rationale = null;\n base.teacherInstructions = null;\n }\n\n log('base: ', base);\n resolve(base);\n });\n}\n\nexport function outcome(model, session, env) {\n return new Promise(resolve => {\n resolve({\n score: getScore(model, session, env).score,\n empty: !session || isEmpty(session)\n });\n });\n}\n\nexport const createCorrectResponseSession = (question, env) => {\n return new Promise(resolve => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { correctAnswer } = question;\n\n let answers = correctAnswer && correctAnswer.data;\n\n // for IBX preview mode\n if (env.mode === 'gather') {\n const {data} = question;\n\n answers = (correctAnswer && correctAnswer.data || []).map((answer, index) => {\n return {\n ...data[index],\n ...answer\n };\n });\n }\n\n resolve({\n answer: answers,\n id: '1'\n });\n } else {\n return resolve(null);\n }\n });\n};\n"],"file":"index.js"}
|
package/controller/package.json
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
exports.model = (id, element) => ({
|
|
2
2
|
id,
|
|
3
3
|
element,
|
|
4
|
-
|
|
5
4
|
addCategoryEnabled: true,
|
|
6
5
|
categoryDefaultLabel: 'Category',
|
|
7
6
|
chartType: 'bar',
|
|
@@ -10,26 +9,20 @@ exports.model = (id, element) => ({
|
|
|
10
9
|
{
|
|
11
10
|
label: 'A',
|
|
12
11
|
value: 1,
|
|
13
|
-
initial: true,
|
|
14
12
|
interactive: false,
|
|
15
|
-
editable:
|
|
16
|
-
deletable: true
|
|
13
|
+
editable: false
|
|
17
14
|
},
|
|
18
15
|
{
|
|
19
16
|
label: 'B',
|
|
20
17
|
value: 1,
|
|
21
|
-
initial: true,
|
|
22
18
|
interactive: true,
|
|
23
|
-
editable:
|
|
24
|
-
deletable: true
|
|
19
|
+
editable: false
|
|
25
20
|
},
|
|
26
21
|
{
|
|
27
22
|
label: 'C',
|
|
28
23
|
value: 1,
|
|
29
|
-
initial: true,
|
|
30
24
|
interactive: true,
|
|
31
|
-
editable:
|
|
32
|
-
deletable: true
|
|
25
|
+
editable: false
|
|
33
26
|
},
|
|
34
27
|
]
|
|
35
28
|
},
|
|
@@ -37,32 +30,25 @@ exports.model = (id, element) => ({
|
|
|
37
30
|
{
|
|
38
31
|
label: 'A',
|
|
39
32
|
value: 1,
|
|
40
|
-
initial: true,
|
|
41
33
|
interactive: false,
|
|
42
|
-
editable:
|
|
43
|
-
deletable: true
|
|
34
|
+
editable: false
|
|
44
35
|
},
|
|
45
36
|
{
|
|
46
37
|
label: 'B',
|
|
47
38
|
value: 1,
|
|
48
|
-
initial: true,
|
|
49
39
|
interactive: true,
|
|
50
|
-
editable:
|
|
51
|
-
deletable: true
|
|
40
|
+
editable: false
|
|
52
41
|
},
|
|
53
42
|
{
|
|
54
43
|
label: 'D',
|
|
55
44
|
value: 2,
|
|
56
|
-
initial: true,
|
|
57
45
|
interactive: true,
|
|
58
|
-
editable:
|
|
59
|
-
deletable: true
|
|
46
|
+
editable: false
|
|
60
47
|
},
|
|
61
48
|
],
|
|
62
49
|
domain: {
|
|
63
50
|
label: 'Characters',
|
|
64
51
|
},
|
|
65
|
-
editCategoryEnabled: true,
|
|
66
52
|
graph: {
|
|
67
53
|
width: 480,
|
|
68
54
|
height: 480
|
package/docs/demo/session.js
CHANGED
|
@@ -6,26 +6,20 @@ module.exports = [
|
|
|
6
6
|
// {
|
|
7
7
|
// label: 'A',
|
|
8
8
|
// value: 1,
|
|
9
|
-
// initial: true,
|
|
10
9
|
// interactive: false,
|
|
11
|
-
// editable: true
|
|
12
|
-
// deletable: true
|
|
10
|
+
// editable: true
|
|
13
11
|
// },
|
|
14
12
|
// {
|
|
15
13
|
// label: 'B',
|
|
16
14
|
// value: 1,
|
|
17
|
-
// initial: true,
|
|
18
15
|
// interactive: true,
|
|
19
|
-
// editable: true
|
|
20
|
-
// deletable: true
|
|
16
|
+
// editable: true
|
|
21
17
|
// },
|
|
22
18
|
// {
|
|
23
19
|
// label: 'C',
|
|
24
20
|
// value: 1,
|
|
25
|
-
// initial: true,
|
|
26
21
|
// interactive: true,
|
|
27
|
-
// editable: true
|
|
28
|
-
// deletable: true
|
|
22
|
+
// editable: true
|
|
29
23
|
// }
|
|
30
24
|
// ]
|
|
31
25
|
},
|
package/docs/pie-schema.json
CHANGED
|
@@ -52,11 +52,6 @@
|
|
|
52
52
|
"type": "number",
|
|
53
53
|
"title": "value"
|
|
54
54
|
},
|
|
55
|
-
"initial": {
|
|
56
|
-
"description": "Indicates if category is default category",
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"title": "initial"
|
|
59
|
-
},
|
|
60
55
|
"interactive": {
|
|
61
56
|
"description": "Indicates if category label & value are interactive",
|
|
62
57
|
"type": "boolean",
|
|
@@ -104,7 +99,6 @@
|
|
|
104
99
|
"correctness",
|
|
105
100
|
"deletable",
|
|
106
101
|
"editable",
|
|
107
|
-
"initial",
|
|
108
102
|
"interactive",
|
|
109
103
|
"label",
|
|
110
104
|
"value"
|
|
@@ -128,11 +122,6 @@
|
|
|
128
122
|
"type": "number",
|
|
129
123
|
"title": "value"
|
|
130
124
|
},
|
|
131
|
-
"initial": {
|
|
132
|
-
"description": "Indicates if category is default category",
|
|
133
|
-
"type": "boolean",
|
|
134
|
-
"title": "initial"
|
|
135
|
-
},
|
|
136
125
|
"interactive": {
|
|
137
126
|
"description": "Indicates if category label & value are interactive",
|
|
138
127
|
"type": "boolean",
|
|
@@ -180,7 +169,6 @@
|
|
|
180
169
|
"correctness",
|
|
181
170
|
"deletable",
|
|
182
171
|
"editable",
|
|
183
|
-
"initial",
|
|
184
172
|
"interactive",
|
|
185
173
|
"label",
|
|
186
174
|
"value"
|
|
@@ -214,11 +202,6 @@
|
|
|
214
202
|
"type": "number",
|
|
215
203
|
"title": "value"
|
|
216
204
|
},
|
|
217
|
-
"initial": {
|
|
218
|
-
"description": "Indicates if category is default category",
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"title": "initial"
|
|
221
|
-
},
|
|
222
205
|
"interactive": {
|
|
223
206
|
"description": "Indicates if category label & value are interactive",
|
|
224
207
|
"type": "boolean",
|
|
@@ -266,7 +249,6 @@
|
|
|
266
249
|
"correctness",
|
|
267
250
|
"deletable",
|
|
268
251
|
"editable",
|
|
269
|
-
"initial",
|
|
270
252
|
"interactive",
|
|
271
253
|
"label",
|
|
272
254
|
"value"
|
|
@@ -290,11 +272,6 @@
|
|
|
290
272
|
"type": "number",
|
|
291
273
|
"title": "value"
|
|
292
274
|
},
|
|
293
|
-
"initial": {
|
|
294
|
-
"description": "Indicates if category is default category",
|
|
295
|
-
"type": "boolean",
|
|
296
|
-
"title": "initial"
|
|
297
|
-
},
|
|
298
275
|
"interactive": {
|
|
299
276
|
"description": "Indicates if category label & value are interactive",
|
|
300
277
|
"type": "boolean",
|
|
@@ -342,7 +319,6 @@
|
|
|
342
319
|
"correctness",
|
|
343
320
|
"deletable",
|
|
344
321
|
"editable",
|
|
345
|
-
"initial",
|
|
346
322
|
"interactive",
|
|
347
323
|
"label",
|
|
348
324
|
"value"
|
|
@@ -390,11 +366,6 @@
|
|
|
390
366
|
"step"
|
|
391
367
|
]
|
|
392
368
|
},
|
|
393
|
-
"editCategoryEnabled": {
|
|
394
|
-
"description": "Indicates if user can edit default categories",
|
|
395
|
-
"type": "boolean",
|
|
396
|
-
"title": "editCategoryEnabled"
|
|
397
|
-
},
|
|
398
369
|
"graph": {
|
|
399
370
|
"title": "Chart",
|
|
400
371
|
"type": "object",
|
|
@@ -530,7 +501,6 @@
|
|
|
530
501
|
"correctAnswer",
|
|
531
502
|
"data",
|
|
532
503
|
"domain",
|
|
533
|
-
"editCategoryEnabled",
|
|
534
504
|
"element",
|
|
535
505
|
"graph",
|
|
536
506
|
"id",
|
|
@@ -605,11 +575,6 @@
|
|
|
605
575
|
"type": "number",
|
|
606
576
|
"title": "value"
|
|
607
577
|
},
|
|
608
|
-
"initial": {
|
|
609
|
-
"description": "Indicates if category is default category",
|
|
610
|
-
"type": "boolean",
|
|
611
|
-
"title": "initial"
|
|
612
|
-
},
|
|
613
578
|
"interactive": {
|
|
614
579
|
"description": "Indicates if category label & value are interactive",
|
|
615
580
|
"type": "boolean",
|
|
@@ -657,7 +622,6 @@
|
|
|
657
622
|
"correctness",
|
|
658
623
|
"deletable",
|
|
659
624
|
"editable",
|
|
660
|
-
"initial",
|
|
661
625
|
"interactive",
|
|
662
626
|
"label",
|
|
663
627
|
"value"
|
|
@@ -681,11 +645,6 @@
|
|
|
681
645
|
"type": "number",
|
|
682
646
|
"title": "value"
|
|
683
647
|
},
|
|
684
|
-
"initial": {
|
|
685
|
-
"description": "Indicates if category is default category",
|
|
686
|
-
"type": "boolean",
|
|
687
|
-
"title": "initial"
|
|
688
|
-
},
|
|
689
648
|
"interactive": {
|
|
690
649
|
"description": "Indicates if category label & value are interactive",
|
|
691
650
|
"type": "boolean",
|
|
@@ -733,7 +692,6 @@
|
|
|
733
692
|
"correctness",
|
|
734
693
|
"deletable",
|
|
735
694
|
"editable",
|
|
736
|
-
"initial",
|
|
737
695
|
"interactive",
|
|
738
696
|
"label",
|
|
739
697
|
"value"
|
|
@@ -763,11 +721,6 @@
|
|
|
763
721
|
"type": "number",
|
|
764
722
|
"title": "value"
|
|
765
723
|
},
|
|
766
|
-
"initial": {
|
|
767
|
-
"description": "Indicates if category is default category",
|
|
768
|
-
"type": "boolean",
|
|
769
|
-
"title": "initial"
|
|
770
|
-
},
|
|
771
724
|
"interactive": {
|
|
772
725
|
"description": "Indicates if category label & value are interactive",
|
|
773
726
|
"type": "boolean",
|
|
@@ -815,7 +768,6 @@
|
|
|
815
768
|
"correctness",
|
|
816
769
|
"deletable",
|
|
817
770
|
"editable",
|
|
818
|
-
"initial",
|
|
819
771
|
"interactive",
|
|
820
772
|
"label",
|
|
821
773
|
"value"
|
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:
|
|
@@ -229,10 +225,6 @@ Indicates category label
|
|
|
229
225
|
|
|
230
226
|
Indicates category value
|
|
231
227
|
|
|
232
|
-
### `initial` (boolean, required)
|
|
233
|
-
|
|
234
|
-
Indicates if category is default category
|
|
235
|
-
|
|
236
228
|
### `interactive` (boolean, required)
|
|
237
229
|
|
|
238
230
|
Indicates if category label & value are interactive
|
package/lib/main.js
CHANGED
|
@@ -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,
|
|
@@ -144,7 +143,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
144
143
|
data: correctData || categories,
|
|
145
144
|
title: title,
|
|
146
145
|
onDataChange: this.changeData,
|
|
147
|
-
editCategoryEnabled: false,
|
|
148
146
|
addCategoryEnabled: false,
|
|
149
147
|
categoryDefaultLabel: categoryDefaultLabel
|
|
150
148
|
}) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
@@ -156,7 +154,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
156
154
|
data: correctedAnswer || categories,
|
|
157
155
|
title: title,
|
|
158
156
|
onDataChange: this.changeData,
|
|
159
|
-
editCategoryEnabled: editCategoryEnabled,
|
|
160
157
|
addCategoryEnabled: addCategoryEnabled,
|
|
161
158
|
categoryDefaultLabel: categoryDefaultLabel
|
|
162
159
|
}), /*#__PURE__*/_react["default"].createElement("br", null), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
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;A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AJL,C;iCADRhD,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": "
|
|
7
|
+
"version": "3.0.0",
|
|
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.4.
|
|
19
|
-
"@pie-lib/render-ui": "^4.12.
|
|
16
|
+
"@pie-lib/charting": "^5.0.0",
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "^2.3.39",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.4.3",
|
|
19
|
+
"@pie-lib/render-ui": "^4.12.9",
|
|
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": "2b16a41c0627a27ee758af9285afde4d226dc12b",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|