@pie-element/ebsr 14.1.1-next.2 → 14.2.0-next.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.json +1547 -0
- package/CHANGELOG.md +2271 -0
- package/LICENSE.md +5 -0
- package/README.md +62 -0
- package/configure/CHANGELOG.json +992 -0
- package/configure/CHANGELOG.md +2136 -0
- package/configure/lib/defaults.js +229 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +154 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +222 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.js +492 -0
- package/{src/author/defaults.ts → configure/src/defaults.js} +0 -10
- package/{src/author/index.ts → configure/src/index.js} +6 -16
- package/{src/author/main.tsx → configure/src/main.jsx} +4 -14
- package/controller/CHANGELOG.json +552 -0
- package/controller/CHANGELOG.md +1275 -0
- package/controller/lib/defaults.js +31 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +448 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +18 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/controller/src/__tests__/index.test.js +591 -0
- package/controller/src/__tests__/utils.test.js +48 -0
- package/{src/controller/defaults.ts → controller/src/defaults.js} +0 -10
- package/{src/controller/index.ts → controller/src/index.js} +3 -13
- package/{src/controller/utils.ts → controller/src/utils.js} +0 -10
- package/docs/config-schema.json +5787 -0
- package/docs/config-schema.json.md +4278 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +52 -0
- package/docs/demo/index.html +2 -0
- package/docs/demo/session.js +14 -0
- package/docs/pie-schema.json +2911 -0
- package/docs/pie-schema.json.md +2142 -0
- package/ebsr.png +0 -0
- package/lib/index.js +207 -0
- package/lib/index.js.map +1 -0
- package/lib/print.js +186 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +5664 -0
- package/module/demo.js +77 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +115 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +18 -59
- package/src/__tests__/index.test.js +129 -0
- package/src/{delivery/index.tsx → index.js} +2 -12
- package/src/{print/index.tsx → print.js} +2 -12
- package/dist/author/defaults.d.ts +0 -67
- package/dist/author/defaults.d.ts.map +0 -1
- package/dist/author/defaults.js +0 -161
- package/dist/author/index.d.ts +0 -35
- package/dist/author/index.d.ts.map +0 -1
- package/dist/author/index.js +0 -78
- package/dist/author/main.d.ts +0 -23
- package/dist/author/main.d.ts.map +0 -1
- package/dist/author/main.js +0 -121
- package/dist/controller/defaults.d.ts +0 -16
- package/dist/controller/defaults.d.ts.map +0 -1
- package/dist/controller/defaults.js +0 -26
- package/dist/controller/index.d.ts +0 -43
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/controller/index.js +0 -186
- package/dist/controller/utils.d.ts +0 -11
- package/dist/controller/utils.d.ts.map +0 -1
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/index.d.ts +0 -27
- package/dist/delivery/index.d.ts.map +0 -1
- package/dist/delivery/index.js +0 -132
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.iife.d.ts +0 -9
- package/dist/index.iife.d.ts.map +0 -1
- package/dist/index.iife.js +0 -165
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGet.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +0 -7
- package/dist/print/index.d.ts +0 -26
- package/dist/print/index.d.ts.map +0 -1
- package/dist/print/index.js +0 -107
- package/src/index.iife.ts +0 -16
- package/src/index.ts +0 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _lodashEs = require("lodash-es");
|
|
8
|
+
const defaultConfig = {
|
|
9
|
+
addChoiceButton: {
|
|
10
|
+
settings: true,
|
|
11
|
+
label: 'Add a Choice'
|
|
12
|
+
},
|
|
13
|
+
choiceMode: {
|
|
14
|
+
settings: true,
|
|
15
|
+
label: 'Response Type'
|
|
16
|
+
},
|
|
17
|
+
choicePrefix: {
|
|
18
|
+
settings: true,
|
|
19
|
+
label: 'Choice Labels'
|
|
20
|
+
},
|
|
21
|
+
deleteChoice: {
|
|
22
|
+
settings: true
|
|
23
|
+
},
|
|
24
|
+
feedback: {
|
|
25
|
+
settings: true,
|
|
26
|
+
label: 'Feedback'
|
|
27
|
+
},
|
|
28
|
+
lockChoiceOrder: {
|
|
29
|
+
settings: true,
|
|
30
|
+
label: 'Lock Choice Order'
|
|
31
|
+
},
|
|
32
|
+
prompt: {
|
|
33
|
+
settings: true,
|
|
34
|
+
label: 'Prompt',
|
|
35
|
+
inputConfiguration: {
|
|
36
|
+
audio: {
|
|
37
|
+
disabled: false
|
|
38
|
+
},
|
|
39
|
+
video: {
|
|
40
|
+
disabled: false
|
|
41
|
+
},
|
|
42
|
+
image: {
|
|
43
|
+
disabled: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
required: false
|
|
47
|
+
},
|
|
48
|
+
rationale: {
|
|
49
|
+
settings: true,
|
|
50
|
+
label: 'Rationale',
|
|
51
|
+
inputConfiguration: {
|
|
52
|
+
audio: {
|
|
53
|
+
disabled: false
|
|
54
|
+
},
|
|
55
|
+
video: {
|
|
56
|
+
disabled: false
|
|
57
|
+
},
|
|
58
|
+
image: {
|
|
59
|
+
disabled: false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
required: false
|
|
63
|
+
},
|
|
64
|
+
settingsPanelDisabled: true,
|
|
65
|
+
studentInstructions: {
|
|
66
|
+
settings: false,
|
|
67
|
+
label: 'Student Instructions'
|
|
68
|
+
},
|
|
69
|
+
teacherInstructions: {
|
|
70
|
+
settings: true,
|
|
71
|
+
label: 'Teacher Instructions',
|
|
72
|
+
inputConfiguration: {
|
|
73
|
+
audio: {
|
|
74
|
+
disabled: false
|
|
75
|
+
},
|
|
76
|
+
video: {
|
|
77
|
+
disabled: false
|
|
78
|
+
},
|
|
79
|
+
image: {
|
|
80
|
+
disabled: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
required: false
|
|
84
|
+
},
|
|
85
|
+
choicesLayout: {
|
|
86
|
+
settings: false,
|
|
87
|
+
label: 'Choices Layout'
|
|
88
|
+
},
|
|
89
|
+
gridColumns: {
|
|
90
|
+
label: 'Grid columns'
|
|
91
|
+
},
|
|
92
|
+
spellCheck: {
|
|
93
|
+
label: 'Spellcheck',
|
|
94
|
+
settings: false,
|
|
95
|
+
enabled: true
|
|
96
|
+
},
|
|
97
|
+
maxImageWidth: {
|
|
98
|
+
teacherInstructions: 300,
|
|
99
|
+
prompt: 300,
|
|
100
|
+
rationale: 636,
|
|
101
|
+
choices: 636
|
|
102
|
+
},
|
|
103
|
+
maxImageHeight: {
|
|
104
|
+
teacherInstructions: 300,
|
|
105
|
+
prompt: 300,
|
|
106
|
+
rationale: 300,
|
|
107
|
+
choices: 300
|
|
108
|
+
},
|
|
109
|
+
mathMlOptions: {
|
|
110
|
+
mmlOutput: false,
|
|
111
|
+
mmlEditing: false
|
|
112
|
+
},
|
|
113
|
+
choices: {
|
|
114
|
+
inputConfiguration: {
|
|
115
|
+
audio: {
|
|
116
|
+
disabled: false
|
|
117
|
+
},
|
|
118
|
+
video: {
|
|
119
|
+
disabled: false
|
|
120
|
+
},
|
|
121
|
+
image: {
|
|
122
|
+
disabled: false
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
baseInputConfiguration: {
|
|
127
|
+
h3: {
|
|
128
|
+
disabled: true
|
|
129
|
+
},
|
|
130
|
+
audio: {
|
|
131
|
+
disabled: false
|
|
132
|
+
},
|
|
133
|
+
video: {
|
|
134
|
+
disabled: false
|
|
135
|
+
},
|
|
136
|
+
image: {
|
|
137
|
+
disabled: false
|
|
138
|
+
},
|
|
139
|
+
textAlign: {
|
|
140
|
+
disabled: true
|
|
141
|
+
},
|
|
142
|
+
showParagraphs: {
|
|
143
|
+
disabled: false
|
|
144
|
+
},
|
|
145
|
+
separateParagraphs: {
|
|
146
|
+
disabled: true
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const partModel = base => ({
|
|
151
|
+
choiceMode: 'radio',
|
|
152
|
+
choicePrefix: 'letters',
|
|
153
|
+
choices: [],
|
|
154
|
+
choicesLayout: 'vertical',
|
|
155
|
+
feedbackEnabled: false,
|
|
156
|
+
gridColumns: 2,
|
|
157
|
+
prompt: '',
|
|
158
|
+
promptEnabled: true,
|
|
159
|
+
rationale: '',
|
|
160
|
+
rationaleEnabled: true,
|
|
161
|
+
spellCheckEnabled: true,
|
|
162
|
+
studentInstructionsEnabled: true,
|
|
163
|
+
teacherInstructions: '',
|
|
164
|
+
teacherInstructionsEnabled: true,
|
|
165
|
+
toolbarEditorPosition: 'bottom',
|
|
166
|
+
...base
|
|
167
|
+
});
|
|
168
|
+
var _default = exports.default = {
|
|
169
|
+
model: {
|
|
170
|
+
partLabels: true,
|
|
171
|
+
partLabelType: 'Letters',
|
|
172
|
+
// partialScoring: false,
|
|
173
|
+
partA: partModel(),
|
|
174
|
+
partB: partModel()
|
|
175
|
+
},
|
|
176
|
+
configuration: {
|
|
177
|
+
baseInputConfiguration: {
|
|
178
|
+
h3: {
|
|
179
|
+
disabled: true
|
|
180
|
+
},
|
|
181
|
+
audio: {
|
|
182
|
+
disabled: false
|
|
183
|
+
},
|
|
184
|
+
video: {
|
|
185
|
+
disabled: false
|
|
186
|
+
},
|
|
187
|
+
image: {
|
|
188
|
+
disabled: false
|
|
189
|
+
},
|
|
190
|
+
textAlign: {
|
|
191
|
+
disabled: true
|
|
192
|
+
},
|
|
193
|
+
showParagraphs: {
|
|
194
|
+
disabled: false
|
|
195
|
+
},
|
|
196
|
+
separateParagraphs: {
|
|
197
|
+
disabled: true
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
partialScoring: {
|
|
201
|
+
label: 'Allow Partial Scoring',
|
|
202
|
+
// this will turn off partial scoring toggle in the settings tab by default for the interaction
|
|
203
|
+
// as we'd like partial scoring to be controlled from the environment entirely
|
|
204
|
+
// if any other consumers would like to enable it for themselves, they can do so from their model directly.
|
|
205
|
+
settings: false
|
|
206
|
+
},
|
|
207
|
+
scoringType: {
|
|
208
|
+
settings: false,
|
|
209
|
+
label: 'Scoring Type'
|
|
210
|
+
},
|
|
211
|
+
partA: (0, _lodashEs.cloneDeep)(defaultConfig),
|
|
212
|
+
partB: (0, _lodashEs.cloneDeep)(defaultConfig),
|
|
213
|
+
partLabels: {
|
|
214
|
+
settings: true,
|
|
215
|
+
label: 'Part Labels'
|
|
216
|
+
},
|
|
217
|
+
settingsPanelDisabled: false,
|
|
218
|
+
language: {
|
|
219
|
+
settings: false,
|
|
220
|
+
label: 'Specify Language',
|
|
221
|
+
enabled: false
|
|
222
|
+
},
|
|
223
|
+
languageChoices: {
|
|
224
|
+
label: 'Language Choices',
|
|
225
|
+
options: []
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","names":["_lodashEs","require","defaultConfig","addChoiceButton","settings","label","choiceMode","choicePrefix","deleteChoice","feedback","lockChoiceOrder","prompt","inputConfiguration","audio","disabled","video","image","required","rationale","settingsPanelDisabled","studentInstructions","teacherInstructions","choicesLayout","gridColumns","spellCheck","enabled","maxImageWidth","choices","maxImageHeight","mathMlOptions","mmlOutput","mmlEditing","baseInputConfiguration","h3","textAlign","showParagraphs","separateParagraphs","partModel","base","feedbackEnabled","promptEnabled","rationaleEnabled","spellCheckEnabled","studentInstructionsEnabled","teacherInstructionsEnabled","toolbarEditorPosition","_default","exports","default","model","partLabels","partLabelType","partA","partB","configuration","partialScoring","scoringType","cloneDeep","language","languageChoices","options"],"sources":["../src/defaults.js"],"sourcesContent":["import { cloneDeep } from 'lodash-es';\n\nconst defaultConfig = {\n addChoiceButton: {\n settings: true,\n label: 'Add a Choice',\n },\n choiceMode: {\n settings: true,\n label: 'Response Type',\n },\n choicePrefix: {\n settings: true,\n label: 'Choice Labels',\n },\n deleteChoice: {\n settings: true,\n },\n feedback: {\n settings: true,\n label: 'Feedback',\n },\n lockChoiceOrder: {\n settings: true,\n label: 'Lock Choice Order',\n },\n prompt: {\n settings: true,\n label: 'Prompt',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n rationale: {\n settings: true,\n label: 'Rationale',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n settingsPanelDisabled: true,\n studentInstructions: {\n settings: false,\n label: 'Student Instructions',\n },\n teacherInstructions: {\n settings: true,\n label: 'Teacher Instructions',\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n required: false,\n },\n choicesLayout: {\n settings: false,\n label: 'Choices Layout',\n },\n gridColumns: {\n label: 'Grid columns',\n },\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n maxImageWidth: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 636,\n choices: 636,\n },\n maxImageHeight: {\n teacherInstructions: 300,\n prompt: 300,\n rationale: 300,\n choices: 300,\n },\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n choices: {\n inputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n};\n\nconst partModel = (base) => ({\n choiceMode: 'radio',\n choicePrefix: 'letters',\n choices: [],\n choicesLayout: 'vertical',\n feedbackEnabled: false,\n gridColumns: 2,\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n spellCheckEnabled: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n ...base,\n});\n\nexport default {\n model: {\n partLabels: true,\n partLabelType: 'Letters',\n // partialScoring: false,\n partA: partModel(),\n partB: partModel(),\n },\n configuration: {\n baseInputConfiguration: {\n h3: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n partialScoring: {\n label: 'Allow Partial Scoring',\n // this will turn off partial scoring toggle in the settings tab by default for the interaction\n // as we'd like partial scoring to be controlled from the environment entirely\n // if any other consumers would like to enable it for themselves, they can do so from their model directly.\n settings: false,\n },\n scoringType: {\n settings: false,\n label: 'Scoring Type',\n },\n partA: cloneDeep(defaultConfig),\n partB: cloneDeep(defaultConfig),\n partLabels: {\n settings: true,\n label: 'Part Labels',\n },\n settingsPanelDisabled: false,\n language: {\n settings: false,\n label: 'Specify Language',\n enabled: false,\n },\n languageChoices: {\n label: 'Language Choices',\n options: [],\n },\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GAAG;EACpBC,eAAe,EA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,QAAQ,EAAE;IACZ,CAAC;IACDoD,WAAW,EAAE;MACXpD,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE;IACT,CAAC;IACD+C,KAAK,EAAE,IAAAK,mBAAS,EAACvD,aAAa,CAAC;IAC/BmD,KAAK,EAAE,IAAAI,mBAAS,EAACvD,aAAa,CAAC;IAC/BgD,UAAU,EAAE;MACV9C,QAAQ,EAAE,IAAI;MACdC,KAAK,EAAE;IACT,CAAC;IACDc,qBAAqB,EAAE,KAAK;IAC5BuC,QAAQ,EAAE;MACRtD,QAAQ,EAAE,KAAK;MACfC,KAAK,EAAE,kBAAkB;MACzBoB,OAAO,EAAE;IACX,CAAC;IACDkC,eAAe,EAAE;MACftD,KAAK,EAAE,kBAAkB;MACzBuD,OAAO,EAAE;IACX;EACF;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _client = require("react-dom/client");
|
|
11
|
+
var _pieConfigureEvents = require("@pie-framework/pie-configure-events");
|
|
12
|
+
var _lib = _interopRequireDefault(require("@pie-element/multiple-choice/configure/lib"));
|
|
13
|
+
var _lodashEs = require("lodash-es");
|
|
14
|
+
var _main = _interopRequireDefault(require("./main"));
|
|
15
|
+
var _defaults = _interopRequireDefault(require("./defaults"));
|
|
16
|
+
const MODEL_UPDATED = _pieConfigureEvents.ModelUpdatedEvent.TYPE;
|
|
17
|
+
const MC_TAG_NAME = 'ebsr-multiple-choice-configure';
|
|
18
|
+
class EbsrMCConfigure extends _lib.default {}
|
|
19
|
+
const defineMultipleChoice = () => {
|
|
20
|
+
if (!customElements.get(MC_TAG_NAME)) {
|
|
21
|
+
customElements.define(MC_TAG_NAME, EbsrMCConfigure);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
defineMultipleChoice();
|
|
25
|
+
const prepareCustomizationObject = (config, model) => {
|
|
26
|
+
const configuration = (0, _lodashEs.defaults)(config, _defaults.default.configuration);
|
|
27
|
+
return {
|
|
28
|
+
configuration,
|
|
29
|
+
model
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const {
|
|
33
|
+
model: modelDefault
|
|
34
|
+
} = _defaults.default || {};
|
|
35
|
+
class EbsrConfigure extends HTMLElement {
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
(0, _defineProperty2.default)(this, "onModelChanged", (m, reset) => {
|
|
39
|
+
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
40
|
+
this.dispatchModelUpdated(reset);
|
|
41
|
+
this._render();
|
|
42
|
+
});
|
|
43
|
+
(0, _defineProperty2.default)(this, "onModelUpdated", e => {
|
|
44
|
+
if (e.target === this) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
e.stopImmediatePropagation();
|
|
49
|
+
const id = e.target && e.target.getAttribute('id');
|
|
50
|
+
if (id) {
|
|
51
|
+
if (e.update) {
|
|
52
|
+
this._model[`part${id}`] = e.update;
|
|
53
|
+
}
|
|
54
|
+
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
this._root = null;
|
|
58
|
+
this._model = EbsrConfigure.createDefaultModel();
|
|
59
|
+
this._configuration = _defaults.default.configuration;
|
|
60
|
+
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
61
|
+
}
|
|
62
|
+
set model(m) {
|
|
63
|
+
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
64
|
+
this._render();
|
|
65
|
+
}
|
|
66
|
+
dispatchModelUpdated(reset) {
|
|
67
|
+
const resetValue = !!reset;
|
|
68
|
+
this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, resetValue));
|
|
69
|
+
}
|
|
70
|
+
set configuration(c) {
|
|
71
|
+
const info = prepareCustomizationObject(c, this._model);
|
|
72
|
+
const newConfiguration = {
|
|
73
|
+
..._defaults.default.configuration,
|
|
74
|
+
...info.configuration
|
|
75
|
+
};
|
|
76
|
+
this._configuration = newConfiguration;
|
|
77
|
+
|
|
78
|
+
// if language:enabled is true, then the corresponding default item model should include a language value;
|
|
79
|
+
// if it is false, then the language field should be omitted from the item model.
|
|
80
|
+
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
81
|
+
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
82
|
+
if (newConfiguration?.language?.enabled) {
|
|
83
|
+
if (newConfiguration?.languageChoices?.options?.length) {
|
|
84
|
+
this._model.language = newConfiguration?.languageChoices.options[0].value;
|
|
85
|
+
}
|
|
86
|
+
} else if (newConfiguration.language.settings && this._model.language) {
|
|
87
|
+
this._configuration.language.enabled = true;
|
|
88
|
+
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
89
|
+
this._configuration.languageChoices.options = [];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// check if the language is already included in the languageChoices.options array
|
|
93
|
+
// and if not, then add it.
|
|
94
|
+
if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
|
|
95
|
+
this._configuration.languageChoices.options.push({
|
|
96
|
+
value: this._model.language,
|
|
97
|
+
label: this._model.language
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
} else {
|
|
101
|
+
delete this._model.language;
|
|
102
|
+
}
|
|
103
|
+
this._render();
|
|
104
|
+
}
|
|
105
|
+
onConfigurationChanged(c) {
|
|
106
|
+
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
107
|
+
if (this._model) {
|
|
108
|
+
this.onModelChanged(this._model);
|
|
109
|
+
}
|
|
110
|
+
this._render();
|
|
111
|
+
}
|
|
112
|
+
connectedCallback() {
|
|
113
|
+
this.addEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
114
|
+
this._render();
|
|
115
|
+
}
|
|
116
|
+
_render() {
|
|
117
|
+
let element = /*#__PURE__*/_react.default.createElement(_main.default, {
|
|
118
|
+
model: this._model,
|
|
119
|
+
configuration: this._configuration,
|
|
120
|
+
onModelChanged: this.onModelChanged,
|
|
121
|
+
onConfigurationChanged: this.onConfigurationChanged
|
|
122
|
+
});
|
|
123
|
+
if (!this._root) {
|
|
124
|
+
this._root = (0, _client.createRoot)(this);
|
|
125
|
+
}
|
|
126
|
+
this._root.render(element);
|
|
127
|
+
}
|
|
128
|
+
disconnectedCallback() {
|
|
129
|
+
this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
130
|
+
if (this._root) {
|
|
131
|
+
this._root.unmount();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
exports.default = EbsrConfigure;
|
|
136
|
+
(0, _defineProperty2.default)(EbsrConfigure, "createDefaultModel", ({
|
|
137
|
+
partA = {},
|
|
138
|
+
partB = {},
|
|
139
|
+
...model
|
|
140
|
+
} = {}, defaults = modelDefault) => ({
|
|
141
|
+
...defaults,
|
|
142
|
+
...model,
|
|
143
|
+
partA: {
|
|
144
|
+
...defaults.partA,
|
|
145
|
+
...partA,
|
|
146
|
+
choicesLayout: partA.choicesLayout || partA.verticalMode === false && 'horizontal' || defaults.partA.choicesLayout
|
|
147
|
+
},
|
|
148
|
+
partB: {
|
|
149
|
+
...defaults.partB,
|
|
150
|
+
...partB,
|
|
151
|
+
choicesLayout: partB.choicesLayout || partB.verticalMode === false && 'horizontal' || defaults.partB.choicesLayout
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_client","_pieConfigureEvents","_lib","_lodashEs","_main","_defaults","MODEL_UPDATED","ModelUpdatedEvent","TYPE","MC_TAG_NAME","EbsrMCConfigure","MultipleChoiceConfigure","defineMultipleChoice","customElements","get","define","prepareCustomizationObject","config","model","configuration","defaults","sensibleDefaults","modelDefault","EbsrConfigure","HTMLElement","constructor","_defineProperty2","default","m","reset","_model","createDefaultModel","dispatchModelUpdated","_render","e","target","preventDefault","stopImmediatePropagation","id","getAttribute","update","dispatchEvent","_root","_configuration","onConfigurationChanged","bind","resetValue","c","info","newConfiguration","language","enabled","languageChoices","options","length","value","settings","find","option","push","label","onModelChanged","connectedCallback","addEventListener","onModelUpdated","element","React","createElement","Main","createRoot","render","disconnectedCallback","removeEventListener","unmount","exports","partA","partB","choicesLayout","verticalMode"],"sources":["../src/index.js"],"sourcesContent":["import React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';\nimport MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';\nimport { defaults } from 'lodash-es';\nimport Main from './main';\n\nimport sensibleDefaults from './defaults';\n\nconst MODEL_UPDATED = ModelUpdatedEvent.TYPE;\nconst MC_TAG_NAME = 'ebsr-multiple-choice-configure';\n\nclass EbsrMCConfigure extends MultipleChoiceConfigure {}\nconst defineMultipleChoice = () => {\n if (!customElements.get(MC_TAG_NAME)) {\n customElements.define(MC_TAG_NAME, EbsrMCConfigure);\n }\n};\n\ndefineMultipleChoice();\n\nconst prepareCustomizationObject = (config, model) => {\n const configuration = defaults(config, sensibleDefaults.configuration);\n\n return {\n configuration,\n model,\n };\n};\n\nconst { model: modelDefault } = sensibleDefaults || {};\n\nexport default class EbsrConfigure extends HTMLElement {\n static createDefaultModel = ({ partA = {}, partB = {}, ...model } = {}, defaults = modelDefault) => ({\n ...defaults,\n ...model,\n partA: {\n ...defaults.partA,\n ...partA,\n choicesLayout:\n partA.choicesLayout || (partA.verticalMode === false && 'horizontal') || defaults.partA.choicesLayout,\n },\n partB: {\n ...defaults.partB,\n ...partB,\n choicesLayout:\n partB.choicesLayout || (partB.verticalMode === false && 'horizontal') || defaults.partB.choicesLayout,\n },\n });\n\n constructor() {\n super();\n this._root = null;\n\n this._model = EbsrConfigure.createDefaultModel();\n\n this._configuration = sensibleDefaults.configuration;\n this.onConfigurationChanged = this.onConfigurationChanged.bind(this);\n }\n\n set model(m) {\n this._model = EbsrConfigure.createDefaultModel(m, this._model);\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 = EbsrConfigure.createDefaultModel(m, this._model);\n\n this.dispatchModelUpdated(reset);\n this._render();\n };\n\n set configuration(c) {\n const info = prepareCustomizationObject(c, this._model);\n\n const newConfiguration = {\n ...sensibleDefaults.configuration,\n ...info.configuration,\n };\n\n this._configuration = newConfiguration;\n\n // if language:enabled is true, then the corresponding default item model should include a language value;\n // if it is false, then the language field should be omitted from the item model.\n // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,\n // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).\n if (newConfiguration?.language?.enabled) {\n if (newConfiguration?.languageChoices?.options?.length) {\n this._model.language = newConfiguration?.languageChoices.options[0].value;\n }\n } else if (newConfiguration.language.settings && this._model.language) {\n this._configuration.language.enabled = true;\n\n if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {\n this._configuration.languageChoices.options = [];\n }\n\n // check if the language is already included in the languageChoices.options array\n // and if not, then add it.\n if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {\n this._configuration.languageChoices.options.push({\n value: this._model.language,\n label: this._model.language,\n });\n }\n } else {\n delete this._model.language;\n }\n\n this._render();\n }\n\n onConfigurationChanged(c) {\n this._configuration = prepareCustomizationObject(c, this._model).configuration;\n\n if (this._model) {\n this.onModelChanged(this._model);\n }\n\n this._render();\n }\n\n onModelUpdated = (e) => {\n if (e.target === this) {\n return;\n }\n\n e.preventDefault();\n e.stopImmediatePropagation();\n\n const id = e.target && e.target.getAttribute('id');\n\n if (id) {\n if (e.update) {\n this._model[`part${id}`] = e.update;\n }\n\n this.dispatchEvent(new ModelUpdatedEvent(this._model));\n }\n };\n\n connectedCallback() {\n this.addEventListener(MODEL_UPDATED, this.onModelUpdated);\n this._render();\n }\n\n _render() {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n }\n\n disconnectedCallback() {\n this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,MAAMO,aAAa,GAAGC,qCAAiB,CAACC,IAAI;AAC5C,MAAMC,WAAW,GAAG,gCAAgC;AAEpD,MAAMC,eAAe,SAASC,YAAuB,CAAC;AACtD,MAAMC,oBAAoB,GAAGA,CAAA,KAAM;EACjC,IAAI,CAACC,cAAc,CAACC,GAAG,CAACL,WAAW,CAAC,EAAE;IACpCI,cAAc,CAACE,MAAM,CAACN,WAAW,EAAEC,eAAe,CAAC;EACrD;AACF,CAAC;AAEDE,oBAAoB,CAAC,CAAC;AAEtB,MAAMI,0BAA0B,GAAGA,CAACC,MAAM,EA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@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Main = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _configUi = require("@pie-lib/config-ui");
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
const {
|
|
14
|
+
Panel,
|
|
15
|
+
toggle,
|
|
16
|
+
radio,
|
|
17
|
+
dropdown
|
|
18
|
+
} = _configUi.settings;
|
|
19
|
+
const PartLabel = (0, _styles.styled)('div')(({
|
|
20
|
+
theme
|
|
21
|
+
}) => ({
|
|
22
|
+
paddingBottom: theme.spacing(2)
|
|
23
|
+
}));
|
|
24
|
+
const Divider = (0, _styles.styled)('div')(({
|
|
25
|
+
theme
|
|
26
|
+
}) => ({
|
|
27
|
+
flex: 1,
|
|
28
|
+
height: theme.spacing(2.5)
|
|
29
|
+
}));
|
|
30
|
+
class Main extends _react.default.Component {
|
|
31
|
+
constructor(...args) {
|
|
32
|
+
super(...args);
|
|
33
|
+
(0, _defineProperty2.default)(this, "removeExtraChoices", choices => {
|
|
34
|
+
let correctFound = false;
|
|
35
|
+
return (choices || []).map(choice => {
|
|
36
|
+
if (correctFound) {
|
|
37
|
+
choice.correct = false;
|
|
38
|
+
return choice;
|
|
39
|
+
}
|
|
40
|
+
if (choice.correct) {
|
|
41
|
+
correctFound = true;
|
|
42
|
+
}
|
|
43
|
+
return choice;
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
(0, _defineProperty2.default)(this, "onModelChanged", (model, key) => {
|
|
47
|
+
const {
|
|
48
|
+
onModelChanged
|
|
49
|
+
} = this.props;
|
|
50
|
+
if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {
|
|
51
|
+
model.partA.choices = this.removeExtraChoices(model.partA.choices);
|
|
52
|
+
return onModelChanged(model, true);
|
|
53
|
+
}
|
|
54
|
+
if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {
|
|
55
|
+
model.partB.choices = this.removeExtraChoices(model.partB.choices);
|
|
56
|
+
return onModelChanged(model, true);
|
|
57
|
+
}
|
|
58
|
+
return onModelChanged(model);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
const {
|
|
63
|
+
model,
|
|
64
|
+
configuration,
|
|
65
|
+
onConfigurationChanged
|
|
66
|
+
} = this.props;
|
|
67
|
+
const {
|
|
68
|
+
partLabelType,
|
|
69
|
+
partA: modelPartA,
|
|
70
|
+
partB: modelPartB,
|
|
71
|
+
extraCSSRules
|
|
72
|
+
} = model;
|
|
73
|
+
const {
|
|
74
|
+
contentDimensions = {},
|
|
75
|
+
partA = {},
|
|
76
|
+
partB = {},
|
|
77
|
+
partialScoring = {},
|
|
78
|
+
settingsPanelDisabled,
|
|
79
|
+
scoringType = {},
|
|
80
|
+
language = {},
|
|
81
|
+
languageChoices = {},
|
|
82
|
+
...generalConfiguration
|
|
83
|
+
} = configuration;
|
|
84
|
+
const {
|
|
85
|
+
feedback: feedbackA = {},
|
|
86
|
+
choiceMode: choiceModeA = {},
|
|
87
|
+
choicePrefix: choicePrefixA = {},
|
|
88
|
+
lockChoiceOrder: lockChoiceOrderA = {},
|
|
89
|
+
prompt: promptA = {},
|
|
90
|
+
teacherInstructions: teacherInstructionsA = {},
|
|
91
|
+
studentInstructions: studentInstructionsA = {},
|
|
92
|
+
choicesLayout: choicesLayoutA = {},
|
|
93
|
+
gridColumns: gridColumnsA = {},
|
|
94
|
+
rationale: rationaleA = {},
|
|
95
|
+
spellCheck: spellCheckA = {}
|
|
96
|
+
} = partA || {};
|
|
97
|
+
const {
|
|
98
|
+
feedback: feedbackB = {},
|
|
99
|
+
choiceMode: choiceModeB = {},
|
|
100
|
+
choicePrefix: choicePrefixB = {},
|
|
101
|
+
lockChoiceOrder: lockChoiceOrderB = {},
|
|
102
|
+
prompt: promptB = {},
|
|
103
|
+
teacherInstructions: teacherInstructionsB = {},
|
|
104
|
+
studentInstructions: studentInstructionsB = {},
|
|
105
|
+
choicesLayout: choicesLayoutB = {},
|
|
106
|
+
gridColumns: gridColumnsB = {},
|
|
107
|
+
rationale: rationaleB = {},
|
|
108
|
+
spellCheck: spellCheckB = {}
|
|
109
|
+
} = partB || {};
|
|
110
|
+
const type = partLabelType || 'Numbers';
|
|
111
|
+
const typeIsNumber = type === 'Numbers';
|
|
112
|
+
const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;
|
|
113
|
+
const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;
|
|
114
|
+
const nrOfColumnsAvailable = {
|
|
115
|
+
partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
|
|
116
|
+
length: modelPartA.choices.length
|
|
117
|
+
}, (_, i) => `${i + 1}`) : [],
|
|
118
|
+
partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
|
|
119
|
+
length: modelPartB.choices.length
|
|
120
|
+
}, (_, i) => `${i + 1}`) : []
|
|
121
|
+
};
|
|
122
|
+
const panelSettings = {
|
|
123
|
+
partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
|
|
124
|
+
partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
|
|
125
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
126
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
127
|
+
'language.enabled': language.settings && toggle(language.label, true),
|
|
128
|
+
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
|
|
129
|
+
};
|
|
130
|
+
const panelSettingsPartA = {
|
|
131
|
+
'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
|
|
132
|
+
'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
|
|
133
|
+
'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
|
|
134
|
+
'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
|
|
135
|
+
'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
|
|
136
|
+
};
|
|
137
|
+
const panelPropertiesPartA = {
|
|
138
|
+
'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
|
|
139
|
+
'partA.promptEnabled': promptA.settings && toggle(promptA.label),
|
|
140
|
+
'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
|
|
141
|
+
'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
|
|
142
|
+
'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label),
|
|
143
|
+
'partA.spellCheckEnabled': spellCheckA.settings && toggle(spellCheckA.label)
|
|
144
|
+
};
|
|
145
|
+
const panelSettingsPartB = {
|
|
146
|
+
'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
|
|
147
|
+
'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
|
|
148
|
+
'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
|
|
149
|
+
'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
|
|
150
|
+
'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
|
|
151
|
+
};
|
|
152
|
+
const panelPropertiesPartB = {
|
|
153
|
+
'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
|
|
154
|
+
'partB.promptEnabled': promptB.settings && toggle(promptB.label),
|
|
155
|
+
'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
|
|
156
|
+
'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
|
|
157
|
+
'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label),
|
|
158
|
+
'partB.spellCheckEnabled': spellCheckB.settings && toggle(spellCheckB.label)
|
|
159
|
+
};
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
|
|
161
|
+
extraCSSRules: extraCSSRules,
|
|
162
|
+
dimensions: contentDimensions,
|
|
163
|
+
hideSettings: settingsPanelDisabled,
|
|
164
|
+
settings: /*#__PURE__*/_react.default.createElement(Panel, {
|
|
165
|
+
model: model,
|
|
166
|
+
onChangeModel: this.onModelChanged,
|
|
167
|
+
configuration: configuration,
|
|
168
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
169
|
+
groups: {
|
|
170
|
+
'Settings for both': panelSettings,
|
|
171
|
+
[`Settings ${firstPart}`]: panelSettingsPartA,
|
|
172
|
+
[`Properties ${firstPart}`]: panelPropertiesPartA,
|
|
173
|
+
[`Settings ${secondPart}`]: panelSettingsPartB,
|
|
174
|
+
[`Properties ${secondPart}`]: panelPropertiesPartB
|
|
175
|
+
}
|
|
176
|
+
})
|
|
177
|
+
}, model.partLabels && /*#__PURE__*/_react.default.createElement(PartLabel, null, firstPart), /*#__PURE__*/_react.default.createElement("ebsr-multiple-choice-configure", {
|
|
178
|
+
id: "A",
|
|
179
|
+
key: "partA",
|
|
180
|
+
ref: ref => {
|
|
181
|
+
if (ref) {
|
|
182
|
+
// do not use destructuring to get model from props
|
|
183
|
+
this.partA = ref;
|
|
184
|
+
this.partA._model = {
|
|
185
|
+
...this.props.model.partA,
|
|
186
|
+
errors: this.props.model.errors && this.props.model.errors.partA || {}
|
|
187
|
+
};
|
|
188
|
+
this.partA.configuration = {
|
|
189
|
+
...partA,
|
|
190
|
+
...generalConfiguration
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}), /*#__PURE__*/_react.default.createElement(Divider, null), model.partLabels && /*#__PURE__*/_react.default.createElement(PartLabel, null, secondPart), /*#__PURE__*/_react.default.createElement("ebsr-multiple-choice-configure", {
|
|
195
|
+
id: "B",
|
|
196
|
+
key: "partB",
|
|
197
|
+
ref: ref => {
|
|
198
|
+
if (ref) {
|
|
199
|
+
// do not use destructuring to get model from props
|
|
200
|
+
this.partB = ref;
|
|
201
|
+
this.partB._model = {
|
|
202
|
+
...this.props.model.partB,
|
|
203
|
+
errors: this.props.model.errors && this.props.model.errors.partB || {}
|
|
204
|
+
};
|
|
205
|
+
this.partB.configuration = {
|
|
206
|
+
...partB,
|
|
207
|
+
...generalConfiguration
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
exports.Main = Main;
|
|
215
|
+
(0, _defineProperty2.default)(Main, "propTypes", {
|
|
216
|
+
configuration: _propTypes.default.object,
|
|
217
|
+
model: _propTypes.default.object,
|
|
218
|
+
onModelChanged: _propTypes.default.func,
|
|
219
|
+
onConfigurationChanged: _propTypes.default.func
|
|
220
|
+
});
|
|
221
|
+
var _default = exports.default = Main;
|
|
222
|
+
//# sourceMappingURL=main.js.map
|