@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,129 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SessionChangedEvent } from '@pie-framework/pie-player-events';
|
|
3
|
+
import { isSessionComplete } from '..';
|
|
4
|
+
|
|
5
|
+
jest.mock('@pie-lib/math-rendering', () => ({ renderMath: jest.fn() }));
|
|
6
|
+
jest.mock('@pie-element/multiple-choice', () => jest.fn());
|
|
7
|
+
|
|
8
|
+
const PART_A = 'partA';
|
|
9
|
+
const PART_B = 'partB';
|
|
10
|
+
|
|
11
|
+
const defaultModel = {
|
|
12
|
+
disabled: false,
|
|
13
|
+
mode: 'gather',
|
|
14
|
+
partA: {
|
|
15
|
+
choiceMode: 'radio',
|
|
16
|
+
choices: [
|
|
17
|
+
{ value: 'a', label: 'label a' },
|
|
18
|
+
{ value: 'b', label: 'label b' },
|
|
19
|
+
{ value: 'c', label: 'label c', correct: true, feedback: 'great' },
|
|
20
|
+
],
|
|
21
|
+
choicePrefix: 'numbers',
|
|
22
|
+
prompt: `prompt ${PART_A}`,
|
|
23
|
+
},
|
|
24
|
+
partB: {
|
|
25
|
+
choiceMode: 'radio',
|
|
26
|
+
choices: [
|
|
27
|
+
{ value: 'd', label: 'label d', correct: true, feedback: 'great' },
|
|
28
|
+
{ value: 'e', label: 'label e' },
|
|
29
|
+
{ value: 'f', label: 'label f' },
|
|
30
|
+
],
|
|
31
|
+
choicePrefix: 'numbers',
|
|
32
|
+
prompt: `prompt ${PART_B}`,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const defaultSession = { id: 1 };
|
|
37
|
+
|
|
38
|
+
describe('ebsr', () => {
|
|
39
|
+
let Def;
|
|
40
|
+
let el;
|
|
41
|
+
let ebsr;
|
|
42
|
+
|
|
43
|
+
beforeAll(() => {
|
|
44
|
+
Def = require('../index').default;
|
|
45
|
+
|
|
46
|
+
// Register the custom element if not already registered
|
|
47
|
+
if (!customElements.get('ebsr-element')) {
|
|
48
|
+
customElements.define('ebsr-element', Def);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
el = document.createElement('ebsr-element');
|
|
54
|
+
|
|
55
|
+
// Mock createElement for part elements
|
|
56
|
+
ebsr = {
|
|
57
|
+
partA: document.createElement('div'),
|
|
58
|
+
partB: document.createElement('div'),
|
|
59
|
+
};
|
|
60
|
+
el.querySelector = jest.fn((s) => {
|
|
61
|
+
if (s === '#part-a') {
|
|
62
|
+
return ebsr.partA;
|
|
63
|
+
} else {
|
|
64
|
+
return ebsr.partB;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Mock _render to avoid innerHTML issues with custom elements
|
|
69
|
+
el._render = jest.fn();
|
|
70
|
+
|
|
71
|
+
// Mock dispatchEvent for testing
|
|
72
|
+
el.dispatchEvent = jest.fn();
|
|
73
|
+
|
|
74
|
+
el.connectedCallback();
|
|
75
|
+
el.model = defaultModel;
|
|
76
|
+
el.session = defaultSession;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
describe('model', () => {
|
|
80
|
+
it('should have set the model', () => {
|
|
81
|
+
expect(el._model).toEqual(defaultModel);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('session', () => {
|
|
86
|
+
const dispatchesSessionEvent = (key, value) => {
|
|
87
|
+
it(`${key} dispatches session changed event`, () => {
|
|
88
|
+
const session = { id: key, value };
|
|
89
|
+
el.dispatchSessionChanged(session, key);
|
|
90
|
+
|
|
91
|
+
expect(el.dispatchEvent).toBeCalledWith(new SessionChangedEvent('ebsr-element', false));
|
|
92
|
+
expect(el._session.value[key]).toEqual(session);
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
it('should have set the session', () => {
|
|
97
|
+
expect(el._session).toEqual(defaultSession);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe('changeAnswers', () => {
|
|
101
|
+
dispatchesSessionEvent(PART_A, 'a');
|
|
102
|
+
dispatchesSessionEvent(PART_B, 'd');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('setPartSession', () => {
|
|
107
|
+
it('sets the session object even if missing from session.value', () => {
|
|
108
|
+
const part = {};
|
|
109
|
+
el.model = {};
|
|
110
|
+
el.session = {
|
|
111
|
+
value: {},
|
|
112
|
+
};
|
|
113
|
+
el.setPartSession(part, 'partA');
|
|
114
|
+
expect(part.session).toEqual({ id: 'partA' });
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('isSessionComplete', () => {
|
|
120
|
+
const assertComplete = (s, expected) => {
|
|
121
|
+
it(`${JSON.stringify(s)} => ${expected}`, () => {
|
|
122
|
+
const result = isSessionComplete(s);
|
|
123
|
+
expect(result).toEqual(expected);
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
assertComplete({}, false);
|
|
128
|
+
assertComplete({ value: { partA: { value: [1] }, partB: { value: [2] } } }, true);
|
|
129
|
+
});
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/ebsr/src/index.js
|
|
4
|
-
* @auto-generated
|
|
5
|
-
*
|
|
6
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
-
* Manual edits will be overwritten on next sync.
|
|
8
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { SessionChangedEvent } from '@pie-element/shared-player-events';
|
|
1
|
+
import { SessionChangedEvent } from '@pie-framework/pie-player-events';
|
|
12
2
|
import MultipleChoice from '@pie-element/multiple-choice';
|
|
13
3
|
import { get } from 'lodash-es';
|
|
14
4
|
import debug from 'debug';
|
|
@@ -75,7 +65,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
75
65
|
this._session = {};
|
|
76
66
|
}
|
|
77
67
|
|
|
78
|
-
onSessionUpdated
|
|
68
|
+
onSessionUpdated = (e) => {
|
|
79
69
|
if (e.target === this) {
|
|
80
70
|
return;
|
|
81
71
|
}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/ebsr/src/print.js
|
|
4
|
-
* @auto-generated
|
|
5
|
-
*
|
|
6
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
-
* Manual edits will be overwritten on next sync.
|
|
8
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
import { cloneDeep, get } from 'lodash-es';
|
|
12
2
|
import MultipleChoice from '@pie-element/multiple-choice';
|
|
13
3
|
import debug from 'debug';
|
|
14
|
-
import { SessionChangedEvent } from '@pie-
|
|
4
|
+
import { SessionChangedEvent } from '@pie-framework/pie-player-events';
|
|
15
5
|
const MC_TAG_NAME = 'ebsr-multiple-choice';
|
|
16
6
|
const SESSION_CHANGED = SessionChangedEvent.TYPE;
|
|
17
7
|
import Translator from '@pie-lib/translator';
|
|
@@ -83,7 +73,7 @@ export default class Ebsr extends HTMLElement {
|
|
|
83
73
|
this._options = null;
|
|
84
74
|
}
|
|
85
75
|
|
|
86
|
-
onSessionUpdated
|
|
76
|
+
onSessionUpdated = (e) => {
|
|
87
77
|
if (e.target === this) {
|
|
88
78
|
return;
|
|
89
79
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/configure/src/defaults.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
declare const _default: {
|
|
10
|
-
model: {
|
|
11
|
-
partLabels: boolean;
|
|
12
|
-
partLabelType: string;
|
|
13
|
-
partA: any;
|
|
14
|
-
partB: any;
|
|
15
|
-
};
|
|
16
|
-
configuration: {
|
|
17
|
-
baseInputConfiguration: {
|
|
18
|
-
h3: {
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
};
|
|
21
|
-
audio: {
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
};
|
|
24
|
-
video: {
|
|
25
|
-
disabled: boolean;
|
|
26
|
-
};
|
|
27
|
-
image: {
|
|
28
|
-
disabled: boolean;
|
|
29
|
-
};
|
|
30
|
-
textAlign: {
|
|
31
|
-
disabled: boolean;
|
|
32
|
-
};
|
|
33
|
-
showParagraphs: {
|
|
34
|
-
disabled: boolean;
|
|
35
|
-
};
|
|
36
|
-
separateParagraphs: {
|
|
37
|
-
disabled: boolean;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
partialScoring: {
|
|
41
|
-
label: string;
|
|
42
|
-
settings: boolean;
|
|
43
|
-
};
|
|
44
|
-
scoringType: {
|
|
45
|
-
settings: boolean;
|
|
46
|
-
label: string;
|
|
47
|
-
};
|
|
48
|
-
partA: any;
|
|
49
|
-
partB: any;
|
|
50
|
-
partLabels: {
|
|
51
|
-
settings: boolean;
|
|
52
|
-
label: string;
|
|
53
|
-
};
|
|
54
|
-
settingsPanelDisabled: boolean;
|
|
55
|
-
language: {
|
|
56
|
-
settings: boolean;
|
|
57
|
-
label: string;
|
|
58
|
-
enabled: boolean;
|
|
59
|
-
};
|
|
60
|
-
languageChoices: {
|
|
61
|
-
label: string;
|
|
62
|
-
options: never[];
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
export default _default;
|
|
67
|
-
//# sourceMappingURL=defaults.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../src/author/defaults.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgIH,wBA8CE"}
|
package/dist/author/defaults.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js";
|
|
2
|
-
//#region src/author/defaults.ts
|
|
3
|
-
var t = {
|
|
4
|
-
addChoiceButton: {
|
|
5
|
-
settings: !0,
|
|
6
|
-
label: "Add a Choice"
|
|
7
|
-
},
|
|
8
|
-
choiceMode: {
|
|
9
|
-
settings: !0,
|
|
10
|
-
label: "Response Type"
|
|
11
|
-
},
|
|
12
|
-
choicePrefix: {
|
|
13
|
-
settings: !0,
|
|
14
|
-
label: "Choice Labels"
|
|
15
|
-
},
|
|
16
|
-
deleteChoice: { settings: !0 },
|
|
17
|
-
feedback: {
|
|
18
|
-
settings: !0,
|
|
19
|
-
label: "Feedback"
|
|
20
|
-
},
|
|
21
|
-
lockChoiceOrder: {
|
|
22
|
-
settings: !0,
|
|
23
|
-
label: "Lock Choice Order"
|
|
24
|
-
},
|
|
25
|
-
prompt: {
|
|
26
|
-
settings: !0,
|
|
27
|
-
label: "Prompt",
|
|
28
|
-
inputConfiguration: {
|
|
29
|
-
audio: { disabled: !1 },
|
|
30
|
-
video: { disabled: !1 },
|
|
31
|
-
image: { disabled: !1 }
|
|
32
|
-
},
|
|
33
|
-
required: !1
|
|
34
|
-
},
|
|
35
|
-
rationale: {
|
|
36
|
-
settings: !0,
|
|
37
|
-
label: "Rationale",
|
|
38
|
-
inputConfiguration: {
|
|
39
|
-
audio: { disabled: !1 },
|
|
40
|
-
video: { disabled: !1 },
|
|
41
|
-
image: { disabled: !1 }
|
|
42
|
-
},
|
|
43
|
-
required: !1
|
|
44
|
-
},
|
|
45
|
-
settingsPanelDisabled: !0,
|
|
46
|
-
studentInstructions: {
|
|
47
|
-
settings: !1,
|
|
48
|
-
label: "Student Instructions"
|
|
49
|
-
},
|
|
50
|
-
teacherInstructions: {
|
|
51
|
-
settings: !0,
|
|
52
|
-
label: "Teacher Instructions",
|
|
53
|
-
inputConfiguration: {
|
|
54
|
-
audio: { disabled: !1 },
|
|
55
|
-
video: { disabled: !1 },
|
|
56
|
-
image: { disabled: !1 }
|
|
57
|
-
},
|
|
58
|
-
required: !1
|
|
59
|
-
},
|
|
60
|
-
choicesLayout: {
|
|
61
|
-
settings: !1,
|
|
62
|
-
label: "Choices Layout"
|
|
63
|
-
},
|
|
64
|
-
gridColumns: { label: "Grid columns" },
|
|
65
|
-
spellCheck: {
|
|
66
|
-
label: "Spellcheck",
|
|
67
|
-
settings: !1,
|
|
68
|
-
enabled: !0
|
|
69
|
-
},
|
|
70
|
-
maxImageWidth: {
|
|
71
|
-
teacherInstructions: 300,
|
|
72
|
-
prompt: 300,
|
|
73
|
-
rationale: 636,
|
|
74
|
-
choices: 636
|
|
75
|
-
},
|
|
76
|
-
maxImageHeight: {
|
|
77
|
-
teacherInstructions: 300,
|
|
78
|
-
prompt: 300,
|
|
79
|
-
rationale: 300,
|
|
80
|
-
choices: 300
|
|
81
|
-
},
|
|
82
|
-
mathMlOptions: {
|
|
83
|
-
mmlOutput: !1,
|
|
84
|
-
mmlEditing: !1
|
|
85
|
-
},
|
|
86
|
-
choices: { inputConfiguration: {
|
|
87
|
-
audio: { disabled: !1 },
|
|
88
|
-
video: { disabled: !1 },
|
|
89
|
-
image: { disabled: !1 }
|
|
90
|
-
} },
|
|
91
|
-
baseInputConfiguration: {
|
|
92
|
-
h3: { disabled: !0 },
|
|
93
|
-
audio: { disabled: !1 },
|
|
94
|
-
video: { disabled: !1 },
|
|
95
|
-
image: { disabled: !1 },
|
|
96
|
-
textAlign: { disabled: !0 },
|
|
97
|
-
showParagraphs: { disabled: !1 },
|
|
98
|
-
separateParagraphs: { disabled: !0 }
|
|
99
|
-
}
|
|
100
|
-
}, n = (e) => ({
|
|
101
|
-
choiceMode: "radio",
|
|
102
|
-
choicePrefix: "letters",
|
|
103
|
-
choices: [],
|
|
104
|
-
choicesLayout: "vertical",
|
|
105
|
-
feedbackEnabled: !1,
|
|
106
|
-
gridColumns: 2,
|
|
107
|
-
prompt: "",
|
|
108
|
-
promptEnabled: !0,
|
|
109
|
-
rationale: "",
|
|
110
|
-
rationaleEnabled: !0,
|
|
111
|
-
spellCheckEnabled: !0,
|
|
112
|
-
studentInstructionsEnabled: !0,
|
|
113
|
-
teacherInstructions: "",
|
|
114
|
-
teacherInstructionsEnabled: !0,
|
|
115
|
-
toolbarEditorPosition: "bottom",
|
|
116
|
-
...e
|
|
117
|
-
}), r = {
|
|
118
|
-
model: {
|
|
119
|
-
partLabels: !0,
|
|
120
|
-
partLabelType: "Letters",
|
|
121
|
-
partA: n(),
|
|
122
|
-
partB: n()
|
|
123
|
-
},
|
|
124
|
-
configuration: {
|
|
125
|
-
baseInputConfiguration: {
|
|
126
|
-
h3: { disabled: !0 },
|
|
127
|
-
audio: { disabled: !1 },
|
|
128
|
-
video: { disabled: !1 },
|
|
129
|
-
image: { disabled: !1 },
|
|
130
|
-
textAlign: { disabled: !0 },
|
|
131
|
-
showParagraphs: { disabled: !1 },
|
|
132
|
-
separateParagraphs: { disabled: !0 }
|
|
133
|
-
},
|
|
134
|
-
partialScoring: {
|
|
135
|
-
label: "Allow Partial Scoring",
|
|
136
|
-
settings: !1
|
|
137
|
-
},
|
|
138
|
-
scoringType: {
|
|
139
|
-
settings: !1,
|
|
140
|
-
label: "Scoring Type"
|
|
141
|
-
},
|
|
142
|
-
partA: e(t),
|
|
143
|
-
partB: e(t),
|
|
144
|
-
partLabels: {
|
|
145
|
-
settings: !0,
|
|
146
|
-
label: "Part Labels"
|
|
147
|
-
},
|
|
148
|
-
settingsPanelDisabled: !1,
|
|
149
|
-
language: {
|
|
150
|
-
settings: !1,
|
|
151
|
-
label: "Specify Language",
|
|
152
|
-
enabled: !1
|
|
153
|
-
},
|
|
154
|
-
languageChoices: {
|
|
155
|
-
label: "Language Choices",
|
|
156
|
-
options: []
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
//#endregion
|
|
161
|
-
export { r as default };
|
package/dist/author/index.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/configure/src/index.js
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
export default class EbsrConfigure extends HTMLElement {
|
|
10
|
-
static createDefaultModel: ({ partA, partB, ...model }?: {
|
|
11
|
-
partA?: {} | undefined;
|
|
12
|
-
partB?: {} | undefined;
|
|
13
|
-
}, defaults?: {
|
|
14
|
-
partLabels: boolean;
|
|
15
|
-
partLabelType: string;
|
|
16
|
-
partA: any;
|
|
17
|
-
partB: any;
|
|
18
|
-
}) => {
|
|
19
|
-
partA: any;
|
|
20
|
-
partB: any;
|
|
21
|
-
partLabels: boolean;
|
|
22
|
-
partLabelType: string;
|
|
23
|
-
};
|
|
24
|
-
constructor();
|
|
25
|
-
set model(m: any);
|
|
26
|
-
dispatchModelUpdated(reset: any): void;
|
|
27
|
-
onModelChanged: any;
|
|
28
|
-
set configuration(c: any);
|
|
29
|
-
onConfigurationChanged(c: any): void;
|
|
30
|
-
onModelUpdated: any;
|
|
31
|
-
connectedCallback(): void;
|
|
32
|
-
_render(): void;
|
|
33
|
-
disconnectedCallback(): void;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/author/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAkCH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,MAAM,CAAC,kBAAkB,GAAI;;;KAAyC,EAAE;;;;;KAAuB;;;;;MAe5F;;IAYH,IAAI,KAAK,CAAC,CAAC,KAAA,EAIV;IAED,oBAAoB,CAAC,KAAK,KAAA;IAM1B,cAAc,EAAE,GAAG,CAKjB;IAEF,IAAI,aAAa,CAAC,CAAC,KAAA,EAsClB;IAED,sBAAsB,CAAC,CAAC,KAAA;IAUxB,cAAc,EAAE,GAAG,CAiBjB;IAEF,iBAAiB;IAKjB,OAAO;IAcP,oBAAoB;CAMrB"}
|
package/dist/author/index.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import e from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js";
|
|
2
|
-
import t from "./main.js";
|
|
3
|
-
import n from "./defaults.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import { createRoot as i } from "react-dom/client";
|
|
6
|
-
import { ModelUpdatedEvent as a } from "@pie-element/shared-configure-events";
|
|
7
|
-
import o from "@pie-element/multiple-choice/author";
|
|
8
|
-
//#region src/author/index.ts
|
|
9
|
-
var s = a.TYPE, c = "ebsr-multiple-choice-configure", l = class extends o {};
|
|
10
|
-
customElements.get(c) || customElements.define(c, l);
|
|
11
|
-
var u = (t, r) => ({
|
|
12
|
-
configuration: e(t, n.configuration),
|
|
13
|
-
model: r
|
|
14
|
-
}), { model: d } = n || {}, f = class e extends HTMLElement {
|
|
15
|
-
static createDefaultModel = ({ partA: e = {}, partB: t = {}, ...n } = {}, r = d) => ({
|
|
16
|
-
...r,
|
|
17
|
-
...n,
|
|
18
|
-
partA: {
|
|
19
|
-
...r.partA,
|
|
20
|
-
...e,
|
|
21
|
-
choicesLayout: e.choicesLayout || e.verticalMode === !1 && "horizontal" || r.partA.choicesLayout
|
|
22
|
-
},
|
|
23
|
-
partB: {
|
|
24
|
-
...r.partB,
|
|
25
|
-
...t,
|
|
26
|
-
choicesLayout: t.choicesLayout || t.verticalMode === !1 && "horizontal" || r.partB.choicesLayout
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
constructor() {
|
|
30
|
-
super(), this._root = null, this._model = e.createDefaultModel(), this._configuration = n.configuration, this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
31
|
-
}
|
|
32
|
-
set model(t) {
|
|
33
|
-
this._model = e.createDefaultModel(t, this._model), this._render();
|
|
34
|
-
}
|
|
35
|
-
dispatchModelUpdated(e) {
|
|
36
|
-
let t = !!e;
|
|
37
|
-
this.dispatchEvent(new a(this._model, t));
|
|
38
|
-
}
|
|
39
|
-
onModelChanged = (t, n) => {
|
|
40
|
-
this._model = e.createDefaultModel(t, this._model), this.dispatchModelUpdated(n), this._render();
|
|
41
|
-
};
|
|
42
|
-
set configuration(e) {
|
|
43
|
-
let t = u(e, this._model), r = {
|
|
44
|
-
...n.configuration,
|
|
45
|
-
...t.configuration
|
|
46
|
-
};
|
|
47
|
-
this._configuration = r, r?.language?.enabled ? r?.languageChoices?.options?.length && (this._model.language = r?.languageChoices.options[0].value) : r.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
|
|
48
|
-
value: this._model.language,
|
|
49
|
-
label: this._model.language
|
|
50
|
-
})) : delete this._model.language, this._render();
|
|
51
|
-
}
|
|
52
|
-
onConfigurationChanged(e) {
|
|
53
|
-
this._configuration = u(e, this._model).configuration, this._model && this.onModelChanged(this._model), this._render();
|
|
54
|
-
}
|
|
55
|
-
onModelUpdated = (e) => {
|
|
56
|
-
if (e.target === this) return;
|
|
57
|
-
e.preventDefault(), e.stopImmediatePropagation();
|
|
58
|
-
let t = e.target && e.target.getAttribute("id");
|
|
59
|
-
t && (e.update && (this._model[`part${t}`] = e.update), this.dispatchEvent(new a(this._model)));
|
|
60
|
-
};
|
|
61
|
-
connectedCallback() {
|
|
62
|
-
this.addEventListener(s, this.onModelUpdated), this._render();
|
|
63
|
-
}
|
|
64
|
-
_render() {
|
|
65
|
-
let e = r.createElement(t, {
|
|
66
|
-
model: this._model,
|
|
67
|
-
configuration: this._configuration,
|
|
68
|
-
onModelChanged: this.onModelChanged,
|
|
69
|
-
onConfigurationChanged: this.onConfigurationChanged
|
|
70
|
-
});
|
|
71
|
-
this._root ||= i(this), this._root.render(e);
|
|
72
|
-
}
|
|
73
|
-
disconnectedCallback() {
|
|
74
|
-
this.removeEventListener(s, this.onModelUpdated), this._root && this._root.unmount();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
//#endregion
|
|
78
|
-
export { f as default };
|
package/dist/author/main.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/ebsr/configure/src/main.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class Main extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
configuration: PropTypes.Requireable<object>;
|
|
14
|
-
model: PropTypes.Requireable<object>;
|
|
15
|
-
onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
};
|
|
18
|
-
removeExtraChoices: any;
|
|
19
|
-
onModelChanged: any;
|
|
20
|
-
render(): React.JSX.Element;
|
|
21
|
-
}
|
|
22
|
-
export default Main;
|
|
23
|
-
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/author/main.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAenC,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS;IACvC,MAAM,CAAC,SAAS;;;;;MAKd;IAEF,kBAAkB,EAAE,GAAG,CAgBrB;IAEF,cAAc,EAAE,GAAG,CAgBjB;IAEF,MAAM;CA4KP;AAED,eAAe,IAAI,CAAC"}
|
package/dist/author/main.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { layout as n, settings as r } from "@pie-lib/config-ui";
|
|
4
|
-
import { styled as i } from "@mui/material/styles";
|
|
5
|
-
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
-
//#region src/author/main.tsx
|
|
7
|
-
var { Panel: s, toggle: c, radio: l, dropdown: u } = r, d = i("div")(({ theme: e }) => ({ paddingBottom: e.spacing(2) })), f = i("div")(({ theme: e }) => ({
|
|
8
|
-
flex: 1,
|
|
9
|
-
height: e.spacing(2.5)
|
|
10
|
-
})), p = class extends e.Component {
|
|
11
|
-
static propTypes = {
|
|
12
|
-
configuration: t.object,
|
|
13
|
-
model: t.object,
|
|
14
|
-
onModelChanged: t.func,
|
|
15
|
-
onConfigurationChanged: t.func
|
|
16
|
-
};
|
|
17
|
-
removeExtraChoices = (e) => {
|
|
18
|
-
let t = !1;
|
|
19
|
-
return (e || []).map((e) => t ? (e.correct = !1, e) : (e.correct && (t = !0), e));
|
|
20
|
-
};
|
|
21
|
-
onModelChanged = (e, t) => {
|
|
22
|
-
let { onModelChanged: n } = this.props;
|
|
23
|
-
return t === "partA.choiceMode" && e.partA.choiceMode === "radio" ? (e.partA.choices = this.removeExtraChoices(e.partA.choices), n(e, !0)) : t === "partB.choiceMode" && e.partB.choiceMode === "radio" ? (e.partB.choices = this.removeExtraChoices(e.partB.choices), n(e, !0)) : n(e);
|
|
24
|
-
};
|
|
25
|
-
render() {
|
|
26
|
-
let { model: e, configuration: t, onConfigurationChanged: r } = this.props, { partLabelType: i, partA: p, partB: m, extraCSSRules: h } = e, { contentDimensions: g = {}, partA: _ = {}, partB: v = {}, partialScoring: y = {}, settingsPanelDisabled: b, scoringType: x = {}, language: S = {}, languageChoices: C = {}, ...w } = t, { feedback: T = {}, choiceMode: E = {}, choicePrefix: D = {}, lockChoiceOrder: O = {}, prompt: k = {}, teacherInstructions: A = {}, studentInstructions: j = {}, choicesLayout: M = {}, gridColumns: N = {}, rationale: P = {}, spellCheck: F = {} } = _ || {}, { feedback: I = {}, choiceMode: L = {}, choicePrefix: R = {}, lockChoiceOrder: z = {}, prompt: B = {}, teacherInstructions: V = {}, studentInstructions: H = {}, choicesLayout: U = {}, gridColumns: W = {}, rationale: G = {}, spellCheck: K = {} } = v || {}, q = (i || "Numbers") === "Numbers", J = `Part ${q ? "1" : "A"}`, Y = `Part ${q ? "2" : "B"}`, X = {
|
|
27
|
-
partA: p.choices && p.choices.length ? Array.from({ length: p.choices.length }, (e, t) => `${t + 1}`) : [],
|
|
28
|
-
partB: m.choices && m.choices.length ? Array.from({ length: m.choices.length }, (e, t) => `${t + 1}`) : []
|
|
29
|
-
}, Z = {
|
|
30
|
-
partLabels: w.partLabels.settings && c(w.partLabels.label),
|
|
31
|
-
partLabelType: e.partLabels && u("", ["Numbers", "Letters"]),
|
|
32
|
-
partialScoring: y.settings && c(y.label),
|
|
33
|
-
scoringType: x.settings && l(x.label, ["auto", "rubric"]),
|
|
34
|
-
"language.enabled": S.settings && c(S.label, !0),
|
|
35
|
-
language: S.settings && S.enabled && u(C.label, C.options)
|
|
36
|
-
}, Q = {
|
|
37
|
-
"partA.choiceMode": E.settings && l(E.label, ["checkbox", "radio"]),
|
|
38
|
-
"partA.choicePrefix": D.settings && l(D.label, ["numbers", "letters"]),
|
|
39
|
-
"partA.lockChoiceOrder": O.settings && c(O.label),
|
|
40
|
-
"partA.choicesLayout": M.settings && u(M.label, [
|
|
41
|
-
"vertical",
|
|
42
|
-
"grid",
|
|
43
|
-
"horizontal"
|
|
44
|
-
]),
|
|
45
|
-
"partA.gridColumns": M.settings && p.choicesLayout === "grid" && X.partA.length > 0 && u(N.label, X.partA)
|
|
46
|
-
}, $ = {
|
|
47
|
-
"partA.feedbackEnabled": T.settings && c(T.label),
|
|
48
|
-
"partA.promptEnabled": k.settings && c(k.label),
|
|
49
|
-
"partA.teacherInstructionsEnabled": A.settings && c(A.label),
|
|
50
|
-
"partA.studentInstructionsEnabled": j.settings && c(j.label),
|
|
51
|
-
"partA.rationaleEnabled": P.settings && c(P.label),
|
|
52
|
-
"partA.spellCheckEnabled": F.settings && c(F.label)
|
|
53
|
-
}, ee = {
|
|
54
|
-
"partB.choiceMode": L.settings && l(L.label, ["checkbox", "radio"]),
|
|
55
|
-
"partB.choicePrefix": R.settings && l(R.label, ["numbers", "letters"]),
|
|
56
|
-
"partB.lockChoiceOrder": z.settings && c(z.label),
|
|
57
|
-
"partB.choicesLayout": U.settings && u(U.label, [
|
|
58
|
-
"vertical",
|
|
59
|
-
"grid",
|
|
60
|
-
"horizontal"
|
|
61
|
-
]),
|
|
62
|
-
"partB.gridColumns": U.settings && m.choicesLayout === "grid" && X.partB.length > 0 && u(W.label, X.partB)
|
|
63
|
-
}, te = {
|
|
64
|
-
"partB.feedbackEnabled": I.settings && c(I.label),
|
|
65
|
-
"partB.promptEnabled": B.settings && c(B.label),
|
|
66
|
-
"partB.teacherInstructionsEnabled": V.settings && c(V.label),
|
|
67
|
-
"partB.studentInstructionsEnabled": H.settings && c(H.label),
|
|
68
|
-
"partB.rationaleEnabled": G.settings && c(G.label),
|
|
69
|
-
"partB.spellCheckEnabled": K.settings && c(K.label)
|
|
70
|
-
};
|
|
71
|
-
return /* @__PURE__ */ o(n.ConfigLayout, {
|
|
72
|
-
extraCSSRules: h,
|
|
73
|
-
dimensions: g,
|
|
74
|
-
hideSettings: b,
|
|
75
|
-
settings: /* @__PURE__ */ a(s, {
|
|
76
|
-
model: e,
|
|
77
|
-
onChangeModel: this.onModelChanged,
|
|
78
|
-
configuration: t,
|
|
79
|
-
onChangeConfiguration: r,
|
|
80
|
-
groups: {
|
|
81
|
-
"Settings for both": Z,
|
|
82
|
-
[`Settings ${J}`]: Q,
|
|
83
|
-
[`Properties ${J}`]: $,
|
|
84
|
-
[`Settings ${Y}`]: ee,
|
|
85
|
-
[`Properties ${Y}`]: te
|
|
86
|
-
}
|
|
87
|
-
}),
|
|
88
|
-
children: [
|
|
89
|
-
e.partLabels && /* @__PURE__ */ a(d, { children: J }),
|
|
90
|
-
/* @__PURE__ */ a("ebsr-multiple-choice-configure", {
|
|
91
|
-
id: "A",
|
|
92
|
-
ref: (e) => {
|
|
93
|
-
e && (this.partA = e, this.partA._model = {
|
|
94
|
-
...this.props.model.partA,
|
|
95
|
-
errors: this.props.model.errors && this.props.model.errors.partA || {}
|
|
96
|
-
}, this.partA.configuration = {
|
|
97
|
-
..._,
|
|
98
|
-
...w
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}, "partA"),
|
|
102
|
-
/* @__PURE__ */ a(f, {}),
|
|
103
|
-
e.partLabels && /* @__PURE__ */ a(d, { children: Y }),
|
|
104
|
-
/* @__PURE__ */ a("ebsr-multiple-choice-configure", {
|
|
105
|
-
id: "B",
|
|
106
|
-
ref: (e) => {
|
|
107
|
-
e && (this.partB = e, this.partB._model = {
|
|
108
|
-
...this.props.model.partB,
|
|
109
|
-
errors: this.props.model.errors && this.props.model.errors.partB || {}
|
|
110
|
-
}, this.partB.configuration = {
|
|
111
|
-
...v,
|
|
112
|
-
...w
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}, "partB")
|
|
116
|
-
]
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
//#endregion
|
|
121
|
-
export { p as default };
|