@pie-element/drawing-response 4.3.2-next.0 → 4.3.2-next.2
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/configure/lib/index.js
CHANGED
|
@@ -61,15 +61,15 @@ var DrawableResponseConfigure = /*#__PURE__*/function (_HTMLElement) {
|
|
|
61
61
|
_this = _super.call(this);
|
|
62
62
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "verifyRubric", /*#__PURE__*/function () {
|
|
63
63
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(c) {
|
|
64
|
-
var _ref2, withRubric;
|
|
64
|
+
var _ref2, _ref2$withRubric, withRubric;
|
|
65
65
|
|
|
66
66
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
67
67
|
while (1) {
|
|
68
68
|
switch (_context.prev = _context.next) {
|
|
69
69
|
case 0:
|
|
70
|
-
_ref2 = c || {}, withRubric = _ref2.withRubric;
|
|
70
|
+
_ref2 = c || {}, _ref2$withRubric = _ref2.withRubric, withRubric = _ref2$withRubric === void 0 ? {} : _ref2$withRubric;
|
|
71
71
|
|
|
72
|
-
if (withRubric.forceEnabled && !_this._model.rubricEnabled) {
|
|
72
|
+
if (withRubric !== null && withRubric !== void 0 && withRubric.forceEnabled && !_this._model.rubricEnabled) {
|
|
73
73
|
_this._model.rubricEnabled = true;
|
|
74
74
|
|
|
75
75
|
_this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(_this._model));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.js"],"names":["log","DrawableResponseConfigure","c","withRubric","forceEnabled","_model","rubricEnabled","dispatchEvent","ModelUpdatedEvent","m","reset","dispatchModelUpdated","_render","_configuration","verifyRubric","handler","InsertImageEvent","src","done","DeleteImageEvent","sensibleDefaults","configuration","createDefaultModel","onModelChanged","bind","s","resetValue","InsertSoundEvent","DeleteSoundEvent","console","element","React","createElement","Root","model","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","config","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,mBAAN,CAAZ;;IAEqBC,yB;;;;;AAcnB,uCAAc;AAAA;;AAAA;AACZ;AADY;AAAA,+FAOC,iBAAOC,CAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/index.js"],"names":["log","DrawableResponseConfigure","c","withRubric","forceEnabled","_model","rubricEnabled","dispatchEvent","ModelUpdatedEvent","m","reset","dispatchModelUpdated","_render","_configuration","verifyRubric","handler","InsertImageEvent","src","done","DeleteImageEvent","sensibleDefaults","configuration","createDefaultModel","onModelChanged","bind","s","resetValue","InsertSoundEvent","DeleteSoundEvent","console","element","React","createElement","Root","model","onConfigurationChanged","imageSupport","add","insertImage","onDeleteImage","uploadSoundSupport","insertSound","onDeleteSound","ReactDOM","render","HTMLElement","config","defaultModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,mBAAN,CAAZ;;IAEqBC,yB;;;;;AAcnB,uCAAc;AAAA;;AAAA;AACZ;AADY;AAAA,+FAOC,iBAAOC,CAAP;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wBACeA,CAAC,IAAI,EADpB,2BACLC,UADK,EACLA,UADK,iCACQ,EADR;;AAGb,oBAAIA,UAAU,SAAV,IAAAA,UAAU,WAAV,IAAAA,UAAU,CAAEC,YAAZ,IAA4B,CAAC,MAAKC,MAAL,CAAYC,aAA7C,EAA4D;AAC1D,wBAAKD,MAAL,CAAYC,aAAZ,GAA4B,IAA5B;;AACA,wBA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AAlB;;AAKA,MAAIY,MAAM,SAAN,IAAAA,MAAM,WAAN,0BAAAA,MAAM,CAAE3C,UAAR,kEAAoBC,YAApB,IAAoC,CAAC2C,YAAY,CAACzC,aAAtD,EAAqE;AACnEyC,IAAAA,YAAY,CAACzC,aAAb,GAA6B,IAA7B;AACD;;AAED,SAAOyC,YAAP;AACD,C","sourcesContent":["import {\n ModelUpdatedEvent,\n DeleteImageEvent,\n InsertImageEvent,\n InsertSoundEvent,\n DeleteSoundEvent\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport debug from 'debug';\n\nimport Root from './root';\nimport sensibleDefaults from './defaults';\n\nconst log = debug('hotspot:configure');\n\nexport default class DrawableResponseConfigure extends HTMLElement {\n static createDefaultModel = (model = {}, config) => {\n const defaultModel = {\n ...sensibleDefaults.model,\n ...model,\n };\n\n if (config?.withRubric?.forceEnabled && !defaultModel.rubricEnabled) {\n defaultModel.rubricEnabled = true;\n }\n\n return defaultModel;\n };\n\n constructor() {\n super();\n this._configuration = sensibleDefaults.configuration;\n this._model = DrawableResponseConfigure.createDefaultModel({}, this._configuration);\n this.onModelChanged = this.onModelChanged.bind(this);\n }\n\n verifyRubric = async (c) => {\n const { withRubric = {} } = c || {};\n\n if (withRubric?.forceEnabled && !this._model.rubricEnabled) {\n this._model.rubricEnabled = true;\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n }\n }\n\n set model(s) {\n this._model = DrawableResponseConfigure.createDefaultModel(s, this._configuration);\n this._render();\n }\n\n set configuration(c) {\n this._configuration = c;\n\n this.verifyRubric(this._configuration);\n\n this._render();\n }\n\n dispatchModelUpdated(reset) {\n const resetValue = !!reset;\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));\n }\n\n onModelChanged = (m, reset) => {\n this._model = m;\n this.dispatchModelUpdated(reset);\n this._render();\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = c;\n\n this.verifyRubric(this._configuration);\n\n this._render();\n };\n\n insertImage = (handler) => {\n this.dispatchEvent(new InsertImageEvent(handler));\n };\n\n onDeleteImage = (src, done) => {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n _render() {\n log('_render');\n\n console.log('this._model.rubricEnabled', this._model.rubricEnabled);\n let element = React.createElement(Root, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n imageSupport: {\n add: this.insertImage,\n delete: this.onDeleteImage\n },\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this)\n }\n });\n ReactDOM.render(element, this);\n }\n}\n"],"file":"index.js"}
|
package/configure/src/index.js
CHANGED
|
@@ -37,9 +37,9 @@ export default class DrawableResponseConfigure extends HTMLElement {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
verifyRubric = async (c) => {
|
|
40
|
-
const { withRubric } = c || {};
|
|
40
|
+
const { withRubric = {} } = c || {};
|
|
41
41
|
|
|
42
|
-
if (withRubric
|
|
42
|
+
if (withRubric?.forceEnabled && !this._model.rubricEnabled) {
|
|
43
43
|
this._model.rubricEnabled = true;
|
|
44
44
|
this.dispatchEvent(new ModelUpdatedEvent(this._model));
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/drawing-response",
|
|
3
|
-
"version": "4.3.2-next.
|
|
3
|
+
"version": "4.3.2-next.2+9f701fa93",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": "pie-framework/pie-elements",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"author": "pie framework developers",
|
|
26
26
|
"license": "ISC",
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "9f701fa934e6f0c8524ff243927459c9ad558a99",
|
|
28
28
|
"scripts": {
|
|
29
29
|
"postpublish": "../../scripts/postpublish"
|
|
30
30
|
},
|