@pie-element/rubric 6.3.4-next.3 → 7.0.0-beta.1
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 +0 -11
- package/configure/CHANGELOG.md +0 -11
- package/configure/lib/defaults.js +2 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +90 -152
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +90 -149
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +11 -7
- package/configure/src/__tests__/index.test.jsx +12 -2
- package/configure/src/index.js +12 -2
- package/configure/src/main.jsx +11 -13
- package/controller/lib/defaults.js +2 -3
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +15 -28
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/lib/index.js +38 -80
- package/lib/index.js.map +1 -1
- package/lib/main.js +182 -244
- package/lib/main.js.map +1 -1
- package/lib/print.js +41 -84
- package/lib/print.js.map +1 -1
- package/package.json +8 -13
- package/src/__tests__/rubric-view.test.jsx +12 -24
- package/src/index.js +14 -3
- package/src/main.jsx +100 -93
- package/src/print.js +13 -2
- package/configure/lib/pie-toolbox-rubric/authoring.js +0 -573
- package/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
- package/configure/lib/pie-toolbox-rubric/index.js +0 -24
- package/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
- package/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
- package/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
- package/configure/src/pie-toolbox-rubric/authoring.jsx +0 -449
- package/configure/src/pie-toolbox-rubric/index.js +0 -9
- package/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
- package/esm/configure.js +0 -34632
- package/esm/configure.js.map +0 -1
- package/esm/controller.js +0 -68
- package/esm/controller.js.map +0 -1
- package/esm/element.js +0 -12909
- package/esm/element.js.map +0 -1
- package/esm/package.json +0 -3
- package/esm/print.js +0 -13482
- package/esm/print.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -113
- package/module/demo.js +0 -33
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -71
- package/module/print.html +0 -18
- package/module/print.js +0 -1
- package/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -2521
package/configure/lib/main.js
CHANGED
|
@@ -1,162 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
7
|
+
exports.default = void 0;
|
|
24
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
9
|
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
var _styles = require("@material-ui/core/styles");
|
|
31
|
-
|
|
10
|
+
var _rubric = require("@pie-lib/rubric");
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
32
12
|
var _configUi = require("@pie-lib/config-ui");
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(0, _inherits2["default"])(Main, _React$Component);
|
|
58
|
-
|
|
59
|
-
var _super = _createSuper(Main);
|
|
60
|
-
|
|
61
|
-
function Main() {
|
|
62
|
-
var _this;
|
|
63
|
-
|
|
64
|
-
(0, _classCallCheck2["default"])(this, Main);
|
|
65
|
-
|
|
66
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
67
|
-
args[_key] = arguments[_key];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
71
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "verifyRubriclessModel", function (m, config) {
|
|
72
|
-
var _ref = config || {},
|
|
73
|
-
_ref$rubricless = _ref.rubricless,
|
|
74
|
-
rubricless = _ref$rubricless === void 0 ? false : _ref$rubricless;
|
|
75
|
-
|
|
76
|
-
return rubricless ? function (_ref2) {
|
|
77
|
-
var points = _ref2.points,
|
|
78
|
-
sampleAnswers = _ref2.sampleAnswers,
|
|
79
|
-
rest = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
80
|
-
return rest;
|
|
81
|
-
}(m) : m;
|
|
13
|
+
const {
|
|
14
|
+
Panel,
|
|
15
|
+
toggle
|
|
16
|
+
} = _configUi.settings;
|
|
17
|
+
const StyledDiv = (0, _styles.styled)('div')(({
|
|
18
|
+
theme,
|
|
19
|
+
width
|
|
20
|
+
}) => ({
|
|
21
|
+
maxWidth: width,
|
|
22
|
+
fontFamily: 'Cerebri Sans',
|
|
23
|
+
fontSize: theme.typography.fontSize
|
|
24
|
+
}));
|
|
25
|
+
class Main extends _react.default.Component {
|
|
26
|
+
constructor(...args) {
|
|
27
|
+
super(...args);
|
|
28
|
+
(0, _defineProperty2.default)(this, "verifyRubriclessModel", (m, config) => {
|
|
29
|
+
const {
|
|
30
|
+
rubricless = false
|
|
31
|
+
} = config || {};
|
|
32
|
+
return rubricless ? (({
|
|
33
|
+
points,
|
|
34
|
+
sampleAnswers,
|
|
35
|
+
...rest
|
|
36
|
+
}) => rest)(m) : m;
|
|
82
37
|
});
|
|
83
|
-
return _this;
|
|
84
38
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
configuration: configuration,
|
|
134
|
-
onChangeConfiguration: onConfigurationChanged,
|
|
135
|
-
pluginOpts: getPluginProps(rubriclessInstruction === null || rubriclessInstruction === void 0 ? void 0 : rubriclessInstruction.inputConfiguration),
|
|
136
|
-
groups: {
|
|
137
|
-
Properties: panelProperties
|
|
138
|
-
},
|
|
139
|
-
imageSupport: imageSupport
|
|
140
|
-
})
|
|
141
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
142
|
-
style: {
|
|
143
|
-
maxWidth: width
|
|
144
|
-
}
|
|
145
|
-
}, /*#__PURE__*/_react["default"].createElement(_index.Authoring, {
|
|
146
|
-
value: value,
|
|
147
|
-
config: configuration,
|
|
148
|
-
onChange: onModelChanged,
|
|
149
|
-
mathMlOptions: mathMlOptions,
|
|
150
|
-
rubricless: rubricless,
|
|
151
|
-
pluginOpts: baseInputConfiguration,
|
|
39
|
+
render() {
|
|
40
|
+
const {
|
|
41
|
+
model,
|
|
42
|
+
configuration,
|
|
43
|
+
onConfigurationChanged,
|
|
44
|
+
onModelChanged,
|
|
45
|
+
imageSupport
|
|
46
|
+
} = this.props || {};
|
|
47
|
+
const {
|
|
48
|
+
baseInputConfiguration = {},
|
|
49
|
+
contentDimensions = {},
|
|
50
|
+
settingsPanelDisabled,
|
|
51
|
+
showExcludeZero = {},
|
|
52
|
+
showMaxPoint = {},
|
|
53
|
+
mathMlOptions = {},
|
|
54
|
+
rubricless = false,
|
|
55
|
+
rubriclessInstruction,
|
|
56
|
+
width
|
|
57
|
+
} = configuration || {};
|
|
58
|
+
|
|
59
|
+
// ensure to eliminate points and sampleAnswers in case of rubricless
|
|
60
|
+
const value = this.verifyRubriclessModel(model, configuration);
|
|
61
|
+
const {
|
|
62
|
+
extraCSSRules
|
|
63
|
+
} = model;
|
|
64
|
+
const panelProperties = {
|
|
65
|
+
excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),
|
|
66
|
+
maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
|
|
67
|
+
rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label)
|
|
68
|
+
};
|
|
69
|
+
const getPluginProps = props => {
|
|
70
|
+
return Object.assign({
|
|
71
|
+
...baseInputConfiguration
|
|
72
|
+
}, props || {});
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
75
|
+
extraCSSRules: extraCSSRules,
|
|
76
|
+
dimensions: contentDimensions,
|
|
77
|
+
hideSettings: settingsPanelDisabled,
|
|
78
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
79
|
+
model: model,
|
|
80
|
+
onChangeModel: onModelChanged,
|
|
81
|
+
configuration: configuration,
|
|
82
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
83
|
+
pluginOpts: getPluginProps(rubriclessInstruction?.inputConfiguration),
|
|
84
|
+
groups: {
|
|
85
|
+
Properties: panelProperties
|
|
86
|
+
},
|
|
152
87
|
imageSupport: imageSupport
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
88
|
+
})
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(StyledDiv, {
|
|
90
|
+
width: width
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(_rubric.Authoring, {
|
|
92
|
+
value: value,
|
|
93
|
+
config: configuration,
|
|
94
|
+
onChange: onModelChanged,
|
|
95
|
+
mathMlOptions: mathMlOptions,
|
|
96
|
+
rubricless: rubricless,
|
|
97
|
+
pluginOpts: baseInputConfiguration,
|
|
98
|
+
imageSupport: imageSupport
|
|
99
|
+
})));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var _default = exports.default = Main;
|
|
162
103
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"main.js","names":["_react","_interopRequireDefault","require","_rubric","_styles","_configUi","Panel","toggle","settings","StyledDiv","styled","theme","width","maxWidth","fontFamily","fontSize","typography","Main","React","Component","constructor","args","_defineProperty2","default","m","config","rubricless","points","sampleAnswers","rest","render","model","configuration","onConfigurationChanged","onModelChanged","imageSupport","props","baseInputConfiguration","contentDimensions","settingsPanelDisabled","showExcludeZero","showMaxPoint","mathMlOptions","rubriclessInstruction","value","verifyRubriclessModel","extraCSSRules","panelProperties","excludeZeroEnabled","label","maxPointsEnabled","rubriclessInstructionEnabled","getPluginProps","Object","assign","createElement","layout","ConfigLayout","dimensions","hideSettings","onChangeModel","onChangeConfiguration","pluginOpts","inputConfiguration","groups","Properties","Authoring","onChange","_default","exports"],"sources":["../src/main.jsx"],"sourcesContent":["import React from 'react';\nimport { Authoring } from '@pie-lib/rubric';\nimport { styled } from '@mui/material/styles';\nimport { layout, settings } from '@pie-lib/config-ui';\n\nconst { Panel, toggle } = settings;\n\nconst StyledDiv = styled('div')(({ theme, width }) => ({\n maxWidth: width,\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize,\n}));\n\nclass Main extends React.Component {\n verifyRubriclessModel = (m, config) => {\n const { rubricless = false } = config || {};\n return rubricless ? (({ points, sampleAnswers, ...rest }) => rest)(m) : m;\n };\n\n render() {\n const { model, configuration, onConfigurationChanged, onModelChanged, imageSupport } = this.props || {};\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n settingsPanelDisabled,\n showExcludeZero = {},\n showMaxPoint = {},\n mathMlOptions = {},\n rubricless = false,\n rubriclessInstruction,\n width,\n } = configuration || {};\n\n // ensure to eliminate points and sampleAnswers in case of rubricless\n const value = this.verifyRubriclessModel(model, configuration);\n const { extraCSSRules } = model;\n\n const panelProperties = {\n excludeZeroEnabled: showExcludeZero.settings && toggle(showExcludeZero.label),\n maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),\n rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label),\n };\n\n const getPluginProps = (props) => {\n return Object.assign(\n {\n ...baseInputConfiguration,\n },\n props || {},\n );\n };\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n pluginOpts={getPluginProps(rubriclessInstruction?.inputConfiguration)}\n groups={{\n Properties: panelProperties,\n }}\n imageSupport={imageSupport}\n />\n } >\n <StyledDiv width={width}>\n <Authoring\n value={value}\n config={configuration}\n onChange={onModelChanged}\n mathMlOptions={mathMlOptions}\n rubricless={rubricless}\n pluginOpts={baseInputConfiguration}\n imageSupport={imageSupport}\n />\n </StyledDiv>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default Main;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,MAAM;EAAEI,KAAK;EAAEC;AAAO,CAAC,GAAGC,kBAAQ;AAElC,MAAMC,SAAS,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC,KAAK;EAAEC;AAAM,CAAC,MAAM;EACrDC,QAAQ,EAAED,KAAK;EACfE,UAAU,EAAE,cAAc;EAC1BC,QAAQ,EAAEJ,KAAK,CAACK,UAAU,CAACD;AAC7B,CAAC,CAAC,CAAC;AAEH,MAAME,IAAI,SAASC,cAAK,CAACC,SAAS,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iCACT,CAACC,CAAC,EAAEC,MAAM,KAAK;MACrC,MAAM;QAAEC,UAAU,GAAG;MAAM,CAAC,GAAGD,MAAM,IAAI,CAAC,CAAC;MAC3C,OAAOC,UAAU,GAAG,CAAC,CAAC;QAAEC,MAAM;QAAEC,aAAa;QAAE,GAAGC;MAAK,CAAC,KAAKA,IAAI,EAAEL,CAAC,CAAC,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qBAAsB;MACpC/B,QAAQ,eACNR,MAAA,CAAAuB,OAAA,CAAAgC,aAAA,CAACjD,KAAK;QACJyB,KAAK,EAAEA,KAAM;QACb6B,aAAa,EAAE1B,cAAe;QAC9BF,aAAa,EAAEA,aAAc;QAC7B6B,qBAAqB,EAAE5B,sBAAuB;QAC9C6B,UAAU,EAAEV,cAAc,CAACT,qBAAqB,EAAEoB,kBAAkB,CAAE;QACtEC,MAAM,EAAE;UACNC,UAAU,EAAElB;QACd,CAAE;QACFZ,YAAY,EAAEA;MAAa,CAC5B;IACF,gBACDnC,MAAA,CAAAuB,OAAA,CAAAgC,aAAA,CAAC9C,SAAS;MAACG,KAAK,EAAEA;IAAM,gBACtBZ,MAAA,CAAAuB,OAAA,CAAAgC,aAAA,CAACpD,OAAA,CAAA+D,SAAS;MACRtB,KAAK,EAAEA,KAAM;MACbnB,MAAM,EAAEO,aAAc;MACtBmC,QAAQ,EAAEjC,cAAe;MACzBQ,aAAa,EAAEA,aAAc;MAC7BhB,UAAU,EAAEA,UAAW;MACvBoC,UAAU,EAAEzB,sBAAuB;MACnCF,YAAY,EAAEA;IAAa,CAC5B,CACQ,CACQ,CAAC;EAE1B;AACF;AAAC,IAAAiC,QAAA,GAAAC,OAAA,CAAA9C,OAAA,GAEcN,IAAI","ignoreList":[]}
|
package/configure/package.json
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/rubric-configure",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0-beta.1",
|
|
5
5
|
"description": "Rubric authoring view",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"author": "Pie Framework Authors",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@
|
|
9
|
+
"@emotion/react": "^11.14.0",
|
|
10
|
+
"@emotion/style": "^0.8.0",
|
|
11
|
+
"@mui/icons-material": "^7.3.4",
|
|
12
|
+
"@mui/material": "^7.3.4",
|
|
10
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
11
|
-
"@pie-lib/config-ui": "
|
|
12
|
-
"@pie-lib/editable-html": "
|
|
13
|
-
"@pie-lib/render-ui": "
|
|
14
|
+
"@pie-lib/config-ui": "12.1.0-next.5",
|
|
15
|
+
"@pie-lib/editable-html-tip-tap": "1.1.0-next.5",
|
|
16
|
+
"@pie-lib/render-ui": "5.1.0-next.5",
|
|
17
|
+
"@pie-lib/rubric": "1.1.0-next.5",
|
|
14
18
|
"debug": "^4.1.1",
|
|
15
|
-
"react": "
|
|
19
|
+
"react": "18.2.0",
|
|
16
20
|
"react-beautiful-dnd": "^11.0.2",
|
|
17
|
-
"react-dom": "
|
|
21
|
+
"react-dom": "18.2.0"
|
|
18
22
|
},
|
|
19
23
|
"license": "ISC"
|
|
20
24
|
}
|
|
@@ -3,8 +3,11 @@ import defaults from '../defaults';
|
|
|
3
3
|
import { ModelUpdatedEvent, InsertSoundEvent, DeleteSoundEvent } from '@pie-framework/pie-configure-events';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
jest.mock('react-dom', () => ({
|
|
7
|
-
|
|
6
|
+
jest.mock('react-dom/client', () => ({
|
|
7
|
+
createRoot: jest.fn(() => ({
|
|
8
|
+
render: jest.fn(),
|
|
9
|
+
unmount: jest.fn(),
|
|
10
|
+
})),
|
|
8
11
|
}));
|
|
9
12
|
|
|
10
13
|
jest.mock('@pie-lib/config-ui', () => ({
|
|
@@ -46,6 +49,13 @@ const configuration = (c) => ({ ...defaults.configuration, ...c });
|
|
|
46
49
|
describe('RubricElement', () => {
|
|
47
50
|
let element;
|
|
48
51
|
|
|
52
|
+
beforeAll(() => {
|
|
53
|
+
// Register the custom element if not already registered
|
|
54
|
+
if (!customElements.get('pie-rubric-configure')) {
|
|
55
|
+
customElements.define('pie-rubric-configure', RubricElement);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
49
59
|
beforeEach(() => {
|
|
50
60
|
element = new RubricElement();
|
|
51
61
|
});
|
package/configure/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModelUpdatedEvent, InsertImageEvent, DeleteImageEvent } from '@pie-framework/pie-configure-events';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import debug from 'debug';
|
|
5
5
|
|
|
6
6
|
import Main from './main';
|
|
@@ -13,6 +13,7 @@ const configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });
|
|
|
13
13
|
export default class RubricElement extends HTMLElement {
|
|
14
14
|
constructor() {
|
|
15
15
|
super();
|
|
16
|
+
this._root = null;
|
|
16
17
|
debug.log('constructor called');
|
|
17
18
|
this._model = modelWithDefaults();
|
|
18
19
|
this._configuration = configurationWithDefaults();
|
|
@@ -123,7 +124,16 @@ export default class RubricElement extends HTMLElement {
|
|
|
123
124
|
},
|
|
124
125
|
});
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
if (!this._root) {
|
|
128
|
+
this._root = createRoot(this);
|
|
129
|
+
}
|
|
130
|
+
this._root.render(element);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
disconnectedCallback() {
|
|
135
|
+
if (this._root) {
|
|
136
|
+
this._root.unmount();
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
139
|
}
|
package/configure/src/main.jsx
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Authoring } from '
|
|
3
|
-
import {
|
|
2
|
+
import { Authoring } from '@pie-lib/rubric';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
4
|
import { layout, settings } from '@pie-lib/config-ui';
|
|
5
5
|
|
|
6
6
|
const { Panel, toggle } = settings;
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
8
|
+
const StyledDiv = styled('div')(({ theme, width }) => ({
|
|
9
|
+
maxWidth: width,
|
|
10
|
+
fontFamily: 'Cerebri Sans',
|
|
11
|
+
fontSize: theme.typography.fontSize,
|
|
12
|
+
}));
|
|
14
13
|
|
|
15
14
|
class Main extends React.Component {
|
|
16
15
|
verifyRubriclessModel = (m, config) => {
|
|
@@ -68,9 +67,8 @@ class Main extends React.Component {
|
|
|
68
67
|
}}
|
|
69
68
|
imageSupport={imageSupport}
|
|
70
69
|
/>
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
<div style={{ maxWidth: width }}>
|
|
70
|
+
} >
|
|
71
|
+
<StyledDiv width={width}>
|
|
74
72
|
<Authoring
|
|
75
73
|
value={value}
|
|
76
74
|
config={configuration}
|
|
@@ -80,10 +78,10 @@ class Main extends React.Component {
|
|
|
80
78
|
pluginOpts={baseInputConfiguration}
|
|
81
79
|
imageSupport={imageSupport}
|
|
82
80
|
/>
|
|
83
|
-
</
|
|
81
|
+
</StyledDiv>
|
|
84
82
|
</layout.ConfigLayout>
|
|
85
83
|
);
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
|
|
89
|
-
export default
|
|
87
|
+
export default Main;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
var _default = {
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = exports.default = {
|
|
8
8
|
points: ['', '', '', ''],
|
|
9
9
|
sampleAnswers: [null, null, null, null],
|
|
10
10
|
maxPoints: 3,
|
|
@@ -12,5 +12,4 @@ var _default = {
|
|
|
12
12
|
excludeZero: false,
|
|
13
13
|
excludeZeroEnabled: true
|
|
14
14
|
};
|
|
15
|
-
exports["default"] = _default;
|
|
16
15
|
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["points","sampleAnswers","maxPoints","maxPointsEnabled","excludeZero","excludeZeroEnabled"],"sources":["../src/defaults.js"],"sourcesContent":["export default {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n maxPointsEnabled: true,\n excludeZero: false,\n excludeZeroEnabled: true,\n};\n"],"mappings":";;;;;;iCAAe;EACbA,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EACxBC,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;EACvCC,SAAS,EAAE,CAAC;EACZC,gBAAgB,EAAE,IAAI;EACtBC,WAAW,EAAE,KAAK;EAClBC,kBAAkB,EAAE;AACtB,CAAC","ignoreList":[]}
|
package/controller/lib/index.js
CHANGED
|
@@ -1,59 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.model = model;
|
|
9
8
|
exports.validate = validate;
|
|
10
|
-
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
9
|
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var normalize = function normalize(model) {
|
|
20
|
-
return _objectSpread(_objectSpread({}, _defaults["default"]), model);
|
|
21
|
-
};
|
|
22
|
-
|
|
10
|
+
const normalize = model => ({
|
|
11
|
+
..._defaults.default,
|
|
12
|
+
...model
|
|
13
|
+
});
|
|
23
14
|
function model(model, session, env) {
|
|
24
|
-
return new Promise(
|
|
25
|
-
|
|
15
|
+
return new Promise(resolve => {
|
|
16
|
+
const modelResult = normalize(model || {});
|
|
26
17
|
resolve(env && env.role && env.role === 'instructor' ? modelResult : {});
|
|
27
18
|
});
|
|
28
19
|
}
|
|
29
|
-
|
|
30
20
|
function markupToText(s) {
|
|
31
21
|
return (s || '').replace(/(<([^>]+)>)/gi, '');
|
|
32
|
-
}
|
|
33
|
-
|
|
22
|
+
}
|
|
34
23
|
|
|
24
|
+
// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.
|
|
35
25
|
function validate(model) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
const {
|
|
27
|
+
points
|
|
28
|
+
} = model;
|
|
29
|
+
const errors = {};
|
|
30
|
+
const pointsDescriptorsErrors = {};
|
|
31
|
+
(points || []).forEach((point, index) => {
|
|
40
32
|
if (!point || point === '<div></div>') {
|
|
41
33
|
pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';
|
|
42
34
|
} else {
|
|
43
|
-
|
|
44
|
-
return markupToText(p) === markupToText(point);
|
|
45
|
-
});
|
|
46
|
-
|
|
35
|
+
const identicalPointDescr = points.slice(index + 1).some(p => markupToText(p) === markupToText(point));
|
|
47
36
|
if (identicalPointDescr) {
|
|
48
37
|
pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';
|
|
49
38
|
}
|
|
50
39
|
}
|
|
51
40
|
});
|
|
52
|
-
|
|
53
41
|
if (Object.keys(pointsDescriptorsErrors).length > 0) {
|
|
54
42
|
errors.pointsDescriptorsErrors = pointsDescriptorsErrors;
|
|
55
43
|
}
|
|
56
|
-
|
|
57
44
|
return errors;
|
|
58
45
|
}
|
|
59
46
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_defaults","_interopRequireDefault","require","normalize","model","defaults","session","env","Promise","resolve","modelResult","role","markupToText","s","replace","validate","points","errors","pointsDescriptorsErrors","forEach","point","index","identicalPointDescr","slice","some","p","Object","keys","length"],"sources":["../src/index.js"],"sourcesContent":["import defaults from './defaults';\n\nconst normalize = (model) => ({ ...defaults, ...model });\n\nexport function model(model, session, env) {\n return new Promise((resolve) => {\n const modelResult = normalize(model || {});\n\n resolve(env && env.role && env.role === 'instructor' ? modelResult : {});\n });\n}\n\nfunction markupToText(s) {\n return (s || '').replace(/(<([^>]+)>)/gi, '');\n}\n\n// IMPORTANT! If you make any changes to this function, please make sure you also update complex-rubric/controller/validateSimpleRubric function!“.\nexport function validate(model) {\n const { points } = model;\n const errors = {};\n const pointsDescriptorsErrors = {};\n\n (points || []).forEach((point, index) => {\n\n if (!point || point === '<div></div>') {\n pointsDescriptorsErrors[index] = 'Points descriptors cannot be empty.';\n } else {\n const identicalPointDescr = points.slice(index + 1).some((p) => markupToText(p) === markupToText(point));\n\n if (identicalPointDescr) {\n pointsDescriptorsErrors[index] = 'Points descriptors should be unique.';\n }\n }\n });\n\n if (Object.keys(pointsDescriptorsErrors).length > 0) {\n errors.pointsDescriptorsErrors = pointsDescriptorsErrors;\n }\n\n return errors;\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,MAAMC,SAAS,GAAIC,KAAK,KAAM;EAAE,GAAGC,iBAAQ;EAAE,GAAGD;AAAM,CAAC,CAAC;AAEjD,SAASA,KAAKA,CAACA,KAAK,EAAEE,OAAO,EAAEC,GAAG,EAAE;EACzC,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,MAAMC,WAAW,GAAGP,SAAS,CAACC,KAAK,IAAI,CAAC,CAAC,CAAC;IAE1CK,OAAO,CAACF,GAAG,IAAIA,GAAG,CAACI,IAAI,IAAIJ,GAAG,CAACI,IAAI,KAAK,YAAY,GAAGD,WAAW,GAAG,CAAC,CAAC,CAAC;EAC1E,CAAC,CAAC;AACJ;AAEA,SAASE,YAAYA,CAACC,CAAC,EAAE;EACvB,OAAO,CAACA,CAAC,IAAI,EAAE,EAAEC,OAAO,CAAC,eAAe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