@pie-element/rubric 3.4.1-next.14 → 3.4.1-next.48

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.
@@ -14,6 +14,30 @@ var _default = {
14
14
  maxPointsEnabled: true
15
15
  },
16
16
  configuration: {
17
+ baseInputConfiguration: {
18
+ audio: {
19
+ disabled: false
20
+ },
21
+ video: {
22
+ disabled: false
23
+ },
24
+ image: {
25
+ disabled: false
26
+ }
27
+ },
28
+ rubriclessInstruction: {
29
+ inputConfiguration: {
30
+ audio: {
31
+ disabled: false
32
+ },
33
+ video: {
34
+ disabled: false
35
+ },
36
+ image: {
37
+ disabled: false
38
+ }
39
+ }
40
+ },
17
41
  showExcludeZero: {
18
42
  settings: true,
19
43
  label: 'Ability to exclude zero'
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KADJ;AAKbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KALD;AASbE,IAAAA,qBAAqB,EAAE,KATV;AAUb;AACAC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KAXF;AAebC,IAAAA,YAAY,EAAE;AAfD;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n excludeZero: false,\n excludeZeroEnabled: true,\n maxPointsEnabled: true,\n },\n configuration: {\n showExcludeZero: {\n settings: true,\n label: 'Ability to exclude zero',\n },\n showMaxPoint: {\n settings: true,\n label: 'Show max points dropdown',\n },\n settingsPanelDisabled: false,\n // width: '500px'\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 9,\n },\n};\n"],"file":"defaults.js"}
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","points","sampleAnswers","maxPoints","excludeZero","excludeZeroEnabled","maxPointsEnabled","configuration","baseInputConfiguration","audio","disabled","video","image","rubriclessInstruction","inputConfiguration","showExcludeZero","settings","label","showMaxPoint","settingsPanelDisabled","mathMlOptions","mmlOutput","mmlEditing","maxMaxPoints"],"mappings":";;;;;;eAAe;AACbA,EAAAA,KAAK,EAAE;AACLC,IAAAA,MAAM,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,EAAT,EAAa,EAAb,CADH;AAELC,IAAAA,aAAa,EAAE,CAAC,IAAD,EAAO,IAAP,EAAa,IAAb,EAAmB,IAAnB,CAFV;AAGLC,IAAAA,SAAS,EAAE,CAHN;AAILC,IAAAA,WAAW,EAAE,KAJR;AAKLC,IAAAA,kBAAkB,EAAE,IALf;AAMLC,IAAAA,gBAAgB,EAAE;AANb,GADM;AASbC,EAAAA,aAAa,EAAE;AACbC,IAAAA,sBAAsB,EAAE;AACtBC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,QAAQ,EAAE;AAAZ,OADe;AAEtBC,MAAAA,KAAK,EAAE;AAAED,QAAAA,QAAQ,EAAE;AAAZ,OAFe;AAGtBE,MAAAA,KAAK,EAAE;AAAEF,QAAAA,QAAQ,EAAE;AAAZ;AAHe,KADX;AAMbG,IAAAA,qBAAqB,EAAE;AACrBC,MAAAA,kBAAkB,EAAE;AAClBL,QAAAA,KAAK,EAAE;AAAEC,UAAAA,QAAQ,EAAE;AAAZ,SADW;AAElBC,QAAAA,KAAK,EAAE;AAAED,UAAAA,QAAQ,EAAE;AAAZ,SAFW;AAGlBE,QAAAA,KAAK,EAAE;AAAEF,UAAAA,QAAQ,EAAE;AAAZ;AAHW;AADC,KANV;AAabK,IAAAA,eAAe,EAAE;AACfC,MAAAA,QAAQ,EAAE,IADK;AAEfC,MAAAA,KAAK,EAAE;AAFQ,KAbJ;AAiBbC,IAAAA,YAAY,EAAE;AACZF,MAAAA,QAAQ,EAAE,IADE;AAEZC,MAAAA,KAAK,EAAE;AAFK,KAjBD;AAqBbE,IAAAA,qBAAqB,EAAE,KArBV;AAsBb;AACAC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KAvBF;AA2BbC,IAAAA,YAAY,EAAE;AA3BD;AATF,C","sourcesContent":["export default {\n model: {\n points: ['', '', '', ''],\n sampleAnswers: [null, null, null, null],\n maxPoints: 3,\n excludeZero: false,\n excludeZeroEnabled: true,\n maxPointsEnabled: true,\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n rubriclessInstruction: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n showExcludeZero: {\n settings: true,\n label: 'Ability to exclude zero',\n },\n showMaxPoint: {\n settings: true,\n label: 'Show max points dropdown',\n },\n settingsPanelDisabled: false,\n // width: '500px'\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 9,\n },\n};\n"],"file":"defaults.js"}
@@ -33,6 +33,10 @@ var _configUi = require("@pie-lib/pie-toolbox/config-ui");
33
33
 
34
34
  var _excluded = ["points", "sampleAnswers"];
35
35
 
36
+ 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; }
37
+
38
+ 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; }
39
+
36
40
  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); }; }
37
41
 
38
42
  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; } }
@@ -89,6 +93,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
89
93
  onModelChanged = _ref3.onModelChanged;
90
94
 
91
95
  var _ref4 = configuration || {},
96
+ _ref4$baseInputConfig = _ref4.baseInputConfiguration,
97
+ baseInputConfiguration = _ref4$baseInputConfig === void 0 ? {} : _ref4$baseInputConfig,
92
98
  _ref4$contentDimensio = _ref4.contentDimensions,
93
99
  contentDimensions = _ref4$contentDimensio === void 0 ? {} : _ref4$contentDimensio,
94
100
  settingsPanelDisabled = _ref4.settingsPanelDisabled,
@@ -110,6 +116,11 @@ var Main = /*#__PURE__*/function (_React$Component) {
110
116
  maxPointsEnabled: showMaxPoint.settings && toggle(showMaxPoint.label),
111
117
  rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label)
112
118
  };
119
+
120
+ var getPluginProps = function getPluginProps(props) {
121
+ return Object.assign(_objectSpread({}, baseInputConfiguration), props || {});
122
+ };
123
+
113
124
  return /*#__PURE__*/_react["default"].createElement(_configUi.layout.ConfigLayout, {
114
125
  dimensions: contentDimensions,
115
126
  hideSettings: settingsPanelDisabled,
@@ -118,6 +129,7 @@ var Main = /*#__PURE__*/function (_React$Component) {
118
129
  onChangeModel: onModelChanged,
119
130
  configuration: configuration,
120
131
  onChangeConfiguration: onConfigurationChanged,
132
+ pluginOpts: getPluginProps(rubriclessInstruction === null || rubriclessInstruction === void 0 ? void 0 : rubriclessInstruction.inputConfiguration),
121
133
  groups: {
122
134
  Properties: panelProperties
123
135
  }
@@ -131,7 +143,8 @@ var Main = /*#__PURE__*/function (_React$Component) {
131
143
  config: configuration,
132
144
  onChange: onModelChanged,
133
145
  mathMlOptions: mathMlOptions,
134
- rubricless: rubricless
146
+ rubricless: rubricless,
147
+ pluginOpts: baseInputConfiguration
135
148
  })));
136
149
  }
137
150
  }]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","styles","theme","design","fontFamily","fontSize","typography","Main","m","config","rubricless","points","sampleAnswers","rest","props","model","configuration","onConfigurationChanged","onModelChanged","contentDimensions","settingsPanelDisabled","showExcludeZero","showMaxPoint","mathMlOptions","rubriclessInstruction","width","value","verifyRubriclessModel","panelProperties","excludeZeroEnabled","label","maxPointsEnabled","rubriclessInstructionEnabled","Properties","maxWidth","React","Component"],"mappings":"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","sourcesContent":["import React from 'react';\nimport { Authoring } from '@pie-lib/pie-toolbox/rubric';\nimport { withStyles } from '@material-ui/core/styles';\nimport { layout, settings } from '@pie-lib/pie-toolbox/config-ui';\n\nconst { Panel, toggle } = settings;\n\nconst styles = (theme) => ({\n design: {\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize,\n },\n});\n\nclass Main extends React.Component {\n\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 } = this.props || {};\n const {\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\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 return (\n <layout.ConfigLayout\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChanged}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Properties: panelProperties,\n }}\n />\n }\n >\n <div style={{ maxWidth: width }}>\n <Authoring value={value} config={configuration} onChange={onModelChanged} mathMlOptions={mathMlOptions} rubricless={rubricless} />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
1
+ {"version":3,"sources":["../src/main.jsx"],"names":["Panel","settings","toggle","styles","theme","design","fontFamily","fontSize","typography","Main","m","config","rubricless","points","sampleAnswers","rest","props","model","configuration","onConfigurationChanged","onModelChanged","baseInputConfiguration","contentDimensions","settingsPanelDisabled","showExcludeZero","showMaxPoint","mathMlOptions","rubriclessInstruction","width","value","verifyRubriclessModel","panelProperties","excludeZeroEnabled","label","maxPointsEnabled","rubriclessInstructionEnabled","getPluginProps","Object","assign","inputConfiguration","Properties","maxWidth","React","Component"],"mappings":"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","sourcesContent":["import React from 'react';\nimport { Authoring } from '@pie-lib/pie-toolbox/rubric';\nimport { withStyles } from '@material-ui/core/styles';\nimport { layout, settings } from '@pie-lib/pie-toolbox/config-ui';\n\nconst { Panel, toggle } = settings;\n\nconst styles = (theme) => ({\n design: {\n fontFamily: 'Cerebri Sans',\n fontSize: theme.typography.fontSize,\n },\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 } = 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\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 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 />\n }\n >\n <div style={{ maxWidth: width }}>\n <Authoring\n value={value}\n config={configuration}\n onChange={onModelChanged}\n mathMlOptions={mathMlOptions}\n rubricless={rubricless}\n pluginOpts={baseInputConfiguration}\n />\n </div>\n </layout.ConfigLayout>\n );\n }\n}\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
@@ -8,7 +8,7 @@
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
10
  "@pie-framework/pie-configure-events": "^1.3.0",
11
- "@pie-lib/pie-toolbox": "1.10.0",
11
+ "@pie-lib/pie-toolbox": "1.11.1",
12
12
  "debug": "^4.1.1",
13
13
  "react": "^16.8.6",
14
14
  "react-dom": "^16.8.6"
@@ -8,6 +8,18 @@ export default {
8
8
  maxPointsEnabled: true,
9
9
  },
10
10
  configuration: {
11
+ baseInputConfiguration: {
12
+ audio: { disabled: false },
13
+ video: { disabled: false },
14
+ image: { disabled: false },
15
+ },
16
+ rubriclessInstruction: {
17
+ inputConfiguration: {
18
+ audio: { disabled: false },
19
+ video: { disabled: false },
20
+ image: { disabled: false },
21
+ },
22
+ },
11
23
  showExcludeZero: {
12
24
  settings: true,
13
25
  label: 'Ability to exclude zero',
@@ -13,7 +13,6 @@ const styles = (theme) => ({
13
13
  });
14
14
 
15
15
  class Main extends React.Component {
16
-
17
16
  verifyRubriclessModel = (m, config) => {
18
17
  const { rubricless = false } = config || {};
19
18
  return rubricless ? (({ points, sampleAnswers, ...rest }) => rest)(m) : m;
@@ -22,6 +21,7 @@ class Main extends React.Component {
22
21
  render() {
23
22
  const { model, configuration, onConfigurationChanged, onModelChanged } = this.props || {};
24
23
  const {
24
+ baseInputConfiguration = {},
25
25
  contentDimensions = {},
26
26
  settingsPanelDisabled,
27
27
  showExcludeZero = {},
@@ -41,6 +41,15 @@ class Main extends React.Component {
41
41
  rubriclessInstructionEnabled: rubricless && rubriclessInstruction.settings && toggle(rubriclessInstruction.label),
42
42
  };
43
43
 
44
+ const getPluginProps = (props) => {
45
+ return Object.assign(
46
+ {
47
+ ...baseInputConfiguration,
48
+ },
49
+ props || {},
50
+ );
51
+ };
52
+
44
53
  return (
45
54
  <layout.ConfigLayout
46
55
  dimensions={contentDimensions}
@@ -51,6 +60,7 @@ class Main extends React.Component {
51
60
  onChangeModel={onModelChanged}
52
61
  configuration={configuration}
53
62
  onChangeConfiguration={onConfigurationChanged}
63
+ pluginOpts={getPluginProps(rubriclessInstruction?.inputConfiguration)}
54
64
  groups={{
55
65
  Properties: panelProperties,
56
66
  }}
@@ -58,7 +68,14 @@ class Main extends React.Component {
58
68
  }
59
69
  >
60
70
  <div style={{ maxWidth: width }}>
61
- <Authoring value={value} config={configuration} onChange={onModelChanged} mathMlOptions={mathMlOptions} rubricless={rubricless} />
71
+ <Authoring
72
+ value={value}
73
+ config={configuration}
74
+ onChange={onModelChanged}
75
+ mathMlOptions={mathMlOptions}
76
+ rubricless={rubricless}
77
+ pluginOpts={baseInputConfiguration}
78
+ />
62
79
  </div>
63
80
  </layout.ConfigLayout>
64
81
  );
@@ -7,7 +7,7 @@
7
7
  "test": "./node_modules/.bin/jest"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.10.0",
10
+ "@pie-lib/pie-toolbox": "1.11.1",
11
11
  "lodash": "^4.17.15"
12
12
  }
13
13
  }
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "type": "object",
3
3
  "properties": {
4
+ "baseInputConfiguration": {
5
+ "title": "EditableHtmlConfigureProp",
6
+ "type": "object",
7
+ "properties": {
8
+ "math": {
9
+ "title": "EditableHtmlButtonConfigure",
10
+ "type": "object",
11
+ "properties": {
12
+ "disabled": {
13
+ "description": "Indicates if the plugin is disabled or not",
14
+ "type": "boolean",
15
+ "title": "disabled"
16
+ }
17
+ }
18
+ },
19
+ "audio": {
20
+ "title": "EditableHtmlButtonConfigure",
21
+ "type": "object",
22
+ "properties": {
23
+ "disabled": {
24
+ "description": "Indicates if the plugin is disabled or not",
25
+ "type": "boolean",
26
+ "title": "disabled"
27
+ }
28
+ }
29
+ },
30
+ "video": {
31
+ "title": "EditableHtmlButtonConfigure",
32
+ "type": "object",
33
+ "properties": {
34
+ "disabled": {
35
+ "description": "Indicates if the plugin is disabled or not",
36
+ "type": "boolean",
37
+ "title": "disabled"
38
+ }
39
+ }
40
+ },
41
+ "image": {
42
+ "title": "EditableHtmlButtonConfigure",
43
+ "type": "object",
44
+ "properties": {
45
+ "disabled": {
46
+ "description": "Indicates if the plugin is disabled or not",
47
+ "type": "boolean",
48
+ "title": "disabled"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ },
4
54
  "settingsPanelDisabled": {
5
55
  "description": "Indicates if the settings panel is not available",
6
56
  "type": "boolean",
@@ -128,6 +178,67 @@
128
178
  }
129
179
  },
130
180
  "definitions": {
181
+ "EditableHtmlConfigureProp": {
182
+ "title": "EditableHtmlConfigureProp",
183
+ "type": "object",
184
+ "properties": {
185
+ "math": {
186
+ "title": "EditableHtmlButtonConfigure",
187
+ "type": "object",
188
+ "properties": {
189
+ "disabled": {
190
+ "description": "Indicates if the plugin is disabled or not",
191
+ "type": "boolean",
192
+ "title": "disabled"
193
+ }
194
+ }
195
+ },
196
+ "audio": {
197
+ "title": "EditableHtmlButtonConfigure",
198
+ "type": "object",
199
+ "properties": {
200
+ "disabled": {
201
+ "description": "Indicates if the plugin is disabled or not",
202
+ "type": "boolean",
203
+ "title": "disabled"
204
+ }
205
+ }
206
+ },
207
+ "video": {
208
+ "title": "EditableHtmlButtonConfigure",
209
+ "type": "object",
210
+ "properties": {
211
+ "disabled": {
212
+ "description": "Indicates if the plugin is disabled or not",
213
+ "type": "boolean",
214
+ "title": "disabled"
215
+ }
216
+ }
217
+ },
218
+ "image": {
219
+ "title": "EditableHtmlButtonConfigure",
220
+ "type": "object",
221
+ "properties": {
222
+ "disabled": {
223
+ "description": "Indicates if the plugin is disabled or not",
224
+ "type": "boolean",
225
+ "title": "disabled"
226
+ }
227
+ }
228
+ }
229
+ }
230
+ },
231
+ "EditableHtmlButtonConfigure": {
232
+ "title": "EditableHtmlButtonConfigure",
233
+ "type": "object",
234
+ "properties": {
235
+ "disabled": {
236
+ "description": "Indicates if the plugin is disabled or not",
237
+ "type": "boolean",
238
+ "title": "disabled"
239
+ }
240
+ }
241
+ },
131
242
  "ConfigureProp": {
132
243
  "title": "ConfigureProp",
133
244
  "type": "object",
@@ -1,5 +1,41 @@
1
1
  The schema defines the following properties:
2
2
 
3
+ # `baseInputConfiguration` (object)
4
+
5
+ Properties of the `baseInputConfiguration` object:
6
+
7
+ ## `math` (object)
8
+
9
+ Properties of the `math` object:
10
+
11
+ ### `disabled` (boolean)
12
+
13
+ Indicates if the plugin is disabled or not
14
+
15
+ ## `audio` (object)
16
+
17
+ Properties of the `audio` object:
18
+
19
+ ### `disabled` (boolean)
20
+
21
+ Indicates if the plugin is disabled or not
22
+
23
+ ## `video` (object)
24
+
25
+ Properties of the `video` object:
26
+
27
+ ### `disabled` (boolean)
28
+
29
+ Indicates if the plugin is disabled or not
30
+
31
+ ## `image` (object)
32
+
33
+ Properties of the `image` object:
34
+
35
+ ### `disabled` (boolean)
36
+
37
+ Indicates if the plugin is disabled or not
38
+
3
39
  # `settingsPanelDisabled` (boolean)
4
40
 
5
41
  Indicates if the settings panel is not available
@@ -106,6 +142,50 @@ Default: `true`
106
142
 
107
143
  The schema defines the following additional types:
108
144
 
145
+ ## `EditableHtmlConfigureProp` (object)
146
+
147
+ Properties of the `EditableHtmlConfigureProp` object:
148
+
149
+ ### `math` (object)
150
+
151
+ Properties of the `math` object:
152
+
153
+ #### `disabled` (boolean)
154
+
155
+ Indicates if the plugin is disabled or not
156
+
157
+ ### `audio` (object)
158
+
159
+ Properties of the `audio` object:
160
+
161
+ #### `disabled` (boolean)
162
+
163
+ Indicates if the plugin is disabled or not
164
+
165
+ ### `video` (object)
166
+
167
+ Properties of the `video` object:
168
+
169
+ #### `disabled` (boolean)
170
+
171
+ Indicates if the plugin is disabled or not
172
+
173
+ ### `image` (object)
174
+
175
+ Properties of the `image` object:
176
+
177
+ #### `disabled` (boolean)
178
+
179
+ Indicates if the plugin is disabled or not
180
+
181
+ ## `EditableHtmlButtonConfigure` (object)
182
+
183
+ Properties of the `EditableHtmlButtonConfigure` object:
184
+
185
+ ### `disabled` (boolean)
186
+
187
+ Indicates if the plugin is disabled or not
188
+
109
189
  ## `ConfigureProp` (object)
110
190
 
111
191
  Properties of the `ConfigureProp` object:
@@ -59,6 +59,67 @@
59
59
  "id"
60
60
  ],
61
61
  "definitions": {
62
+ "EditableHtmlConfigureProp": {
63
+ "title": "EditableHtmlConfigureProp",
64
+ "type": "object",
65
+ "properties": {
66
+ "math": {
67
+ "title": "EditableHtmlButtonConfigure",
68
+ "type": "object",
69
+ "properties": {
70
+ "disabled": {
71
+ "description": "Indicates if the plugin is disabled or not",
72
+ "type": "boolean",
73
+ "title": "disabled"
74
+ }
75
+ }
76
+ },
77
+ "audio": {
78
+ "title": "EditableHtmlButtonConfigure",
79
+ "type": "object",
80
+ "properties": {
81
+ "disabled": {
82
+ "description": "Indicates if the plugin is disabled or not",
83
+ "type": "boolean",
84
+ "title": "disabled"
85
+ }
86
+ }
87
+ },
88
+ "video": {
89
+ "title": "EditableHtmlButtonConfigure",
90
+ "type": "object",
91
+ "properties": {
92
+ "disabled": {
93
+ "description": "Indicates if the plugin is disabled or not",
94
+ "type": "boolean",
95
+ "title": "disabled"
96
+ }
97
+ }
98
+ },
99
+ "image": {
100
+ "title": "EditableHtmlButtonConfigure",
101
+ "type": "object",
102
+ "properties": {
103
+ "disabled": {
104
+ "description": "Indicates if the plugin is disabled or not",
105
+ "type": "boolean",
106
+ "title": "disabled"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ },
112
+ "EditableHtmlButtonConfigure": {
113
+ "title": "EditableHtmlButtonConfigure",
114
+ "type": "object",
115
+ "properties": {
116
+ "disabled": {
117
+ "description": "Indicates if the plugin is disabled or not",
118
+ "type": "boolean",
119
+ "title": "disabled"
120
+ }
121
+ }
122
+ },
62
123
  "ConfigureProp": {
63
124
  "title": "ConfigureProp",
64
125
  "type": "object",
@@ -40,6 +40,50 @@ The html Element tag name
40
40
 
41
41
  The schema defines the following additional types:
42
42
 
43
+ ## `EditableHtmlConfigureProp` (object)
44
+
45
+ Properties of the `EditableHtmlConfigureProp` object:
46
+
47
+ ### `math` (object)
48
+
49
+ Properties of the `math` object:
50
+
51
+ #### `disabled` (boolean)
52
+
53
+ Indicates if the plugin is disabled or not
54
+
55
+ ### `audio` (object)
56
+
57
+ Properties of the `audio` object:
58
+
59
+ #### `disabled` (boolean)
60
+
61
+ Indicates if the plugin is disabled or not
62
+
63
+ ### `video` (object)
64
+
65
+ Properties of the `video` object:
66
+
67
+ #### `disabled` (boolean)
68
+
69
+ Indicates if the plugin is disabled or not
70
+
71
+ ### `image` (object)
72
+
73
+ Properties of the `image` object:
74
+
75
+ #### `disabled` (boolean)
76
+
77
+ Indicates if the plugin is disabled or not
78
+
79
+ ## `EditableHtmlButtonConfigure` (object)
80
+
81
+ Properties of the `EditableHtmlButtonConfigure` object:
82
+
83
+ ### `disabled` (boolean)
84
+
85
+ Indicates if the plugin is disabled or not
86
+
43
87
  ## `ConfigureProp` (object)
44
88
 
45
89
  Properties of the `ConfigureProp` object:
package/lib/print.js CHANGED
@@ -31,7 +31,7 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
31
31
 
32
32
  var _main = _interopRequireDefault(require("./main"));
33
33
 
34
- var _mathRenderingAccessible = require("@pie-lib/pie-toolbox/math-rendering-accessible");
34
+ var _mathRendering = require("@pie-lib/pie-toolbox/math-rendering");
35
35
 
36
36
  var _debug = _interopRequireDefault(require("debug"));
37
37
 
@@ -79,7 +79,7 @@ var RubricPrint = /*#__PURE__*/function (_HTMLElement) {
79
79
 
80
80
  _reactDom["default"].render(element, (0, _assertThisInitialized2["default"])(_this), function () {
81
81
  log('render complete - render math');
82
- (0, _mathRenderingAccessible.renderMath)((0, _assertThisInitialized2["default"])(_this));
82
+ (0, _mathRendering.renderMath)((0, _assertThisInitialized2["default"])(_this));
83
83
  });
84
84
  } else {
85
85
  log('skip');
package/lib/print.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;;AAEA,MAAI,CAACD,KAAL,EAAY;AACV,WAAO,EAAP;AACD;;AAEDF,EAAAA,KAAK,CAACI,KAAN,qBAAmBJ,KAAnB;AACAA,EAAAA,KAAK,CAACK,IAAN,GAAa,UAAb;AACAL,EAAAA,KAAK,CAACM,kBAAN,GAA2B,IAA3B;AAEA,SAAON,KAAP;AACD,CAZD;;IAcqBO,W;;;;;AACnB,yBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAGb,iBAAiB,CAAC,MAAKU,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,oBACKJ,UADL,EAFF;;AAMAK,6BAASC,MAAT,CAAgBL,OAAhB,kDAA+B,YAAM;AACnCf,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAbD,MAaO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAlBc,EAmBf,EAnBe,EAoBf;AAAEqB,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KApBe,CAAjB;AALY;AA2Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKb,QAAL,GAAgBa,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKb,MAAL,GAAca,CAAd;;AACA,WAAKX,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAtCiBY,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering-accessible';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}
1
+ {"version":3,"sources":["../src/print.js"],"names":["log","preparePrintModel","model","opts","instr","role","value","mode","animationsDisabled","RubricPrint","_options","_model","_session","_rerender","printModel","element","React","createElement","Main","ReactDOM","render","leading","trailing","o","s","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,0BAAN,CAAZ;;AAEA,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,KAAD,EAAQC,IAAR,EAAiB;AACzC,MAAMC,KAAK,GAAGD,IAAI,CAACE,IAAL,KAAc,YAA5B;;AAEA,MAAI,CAACD,KAAL,EAAY;AACV,WAAO,EAAP;AACD;;AAEDF,EAAAA,KAAK,CAACI,KAAN,qBAAmBJ,KAAnB;AACAA,EAAAA,KAAK,CAACK,IAAN,GAAa,UAAb;AACAL,EAAAA,KAAK,CAACM,kBAAN,GAA2B,IAA3B;AAEA,SAAON,KAAP;AACD,CAZD;;IAcqBO,W;;;;;AACnB,yBAAc;AAAA;;AAAA;AACZ;AACA,UAAKC,QAAL,GAAgB,IAAhB;AACA,UAAKC,MAAL,GAAc,IAAd;AACA,UAAKC,QAAL,GAAgB,EAAhB;AACA,UAAKC,SAAL,GAAiB,0BACf,YAAM;AACJ,UAAI,MAAKF,MAAL,IAAe,MAAKC,QAAxB,EAAkC;AAChC,YAAME,UAAU,GAAGb,iBAAiB,CAAC,MAAKU,MAAN,EAAc,MAAKD,QAAnB,CAApC;;AAEA,YAAMK,OAAO,GACX,MAAKL,QAAL,iBACAM,kBAAMC,aAAN,CAAoBC,gBAApB,oBACKJ,UADL,EAFF;;AAMAK,6BAASC,MAAT,CAAgBL,OAAhB,kDAA+B,YAAM;AACnCf,UAAAA,GAAG,CAAC,+BAAD,CAAH;AACA;AACD,SAHD;AAID,OAbD,MAaO;AACLA,QAAAA,GAAG,CAAC,MAAD,CAAH;AACD;AACF,KAlBc,EAmBf,EAnBe,EAoBf;AAAEqB,MAAAA,OAAO,EAAE,KAAX;AAAkBC,MAAAA,QAAQ,EAAE;AAA5B,KApBe,CAAjB;AALY;AA2Bb;;;;SACD,aAAYC,CAAZ,EAAe;AACb,WAAKb,QAAL,GAAgBa,CAAhB;AACD;;;SAED,aAAUC,CAAV,EAAa;AACX,WAAKb,MAAL,GAAca,CAAd;;AACA,WAAKX,SAAL;AACD;;;WAED,6BAAoB,CAAE;;;kDAtCiBY,W","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport debounce from 'lodash/debounce';\nimport Main from './main';\nimport { renderMath } from '@pie-lib/pie-toolbox/math-rendering';\nimport debug from 'debug';\n\nconst log = debug('pie-element:rubric:print');\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n if (!instr) {\n return {};\n }\n\n model.value = { ...model };\n model.mode = 'evaluate';\n model.animationsDisabled = true;\n\n return model;\n};\n\nexport default class RubricPrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n ...printModel,\n });\n\n ReactDOM.render(element, this, () => {\n log('render complete - render math');\n renderMath(this);\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n}\n"],"file":"print.js"}