@pie-element/multiple-choice 13.1.1-next.0 → 13.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 +1972 -0
- package/CHANGELOG.md +2704 -0
- package/LICENSE.md +5 -0
- package/PRINT.md +35 -0
- package/README.md +56 -0
- package/choice.png +0 -0
- package/configure/CHANGELOG.json +1387 -0
- package/configure/CHANGELOG.md +2054 -0
- package/{src/author/defaults.ts → configure/lib/defaults.js} +90 -55
- package/configure/lib/defaults.js.map +1 -0
- package/{src/author/index.ts → configure/lib/index.js} +55 -99
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +483 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/utils.js +18 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +22 -0
- package/controller/CHANGELOG.json +527 -0
- package/controller/CHANGELOG.md +1394 -0
- package/{src/controller/defaults.ts → controller/lib/defaults.js} +8 -11
- package/controller/lib/defaults.js.map +1 -0
- package/{src/controller/index.ts → controller/lib/index.js} +109 -123
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +15 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +15 -0
- package/docs/config-schema.json +2993 -0
- package/docs/config-schema.json.md +2217 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +61 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +7 -0
- package/docs/pie-schema.json +1332 -0
- package/docs/pie-schema.json.md +1015 -0
- package/lib/choice-input.js +380 -0
- package/lib/choice-input.js.map +1 -0
- package/lib/choice.js +197 -0
- package/lib/choice.js.map +1 -0
- package/lib/feedback-tick.js +134 -0
- package/lib/feedback-tick.js.map +1 -0
- package/{src/delivery/index.ts → lib/index.js} +129 -211
- package/lib/index.js.map +1 -0
- package/lib/main.js +63 -0
- package/lib/main.js.map +1 -0
- package/lib/multiple-choice.js +412 -0
- package/lib/multiple-choice.js.map +1 -0
- package/lib/print.js +94 -0
- package/lib/print.js.map +1 -0
- package/{src/delivery/session-updater.ts → lib/session-updater.js} +13 -17
- package/lib/session-updater.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +3045 -0
- package/module/demo.js +86 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +124 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +26 -58
- package/dist/author/defaults.d.ts +0 -206
- package/dist/author/defaults.d.ts.map +0 -1
- package/dist/author/defaults.js +0 -151
- package/dist/author/index.d.ts +0 -27
- package/dist/author/index.d.ts.map +0 -1
- package/dist/author/index.js +0 -116
- package/dist/author/main.d.ts +0 -35
- package/dist/author/main.d.ts.map +0 -1
- package/dist/author/main.js +0 -290
- package/dist/author/utils.d.ts +0 -10
- package/dist/author/utils.d.ts.map +0 -1
- package/dist/author/utils.js +0 -7
- package/dist/controller/defaults.d.ts +0 -36
- package/dist/controller/defaults.d.ts.map +0 -1
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -66
- package/dist/controller/index.d.ts.map +0 -1
- package/dist/controller/index.js +0 -124
- 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/choice-input.d.ts +0 -45
- package/dist/delivery/choice-input.d.ts.map +0 -1
- package/dist/delivery/choice-input.js +0 -274
- package/dist/delivery/choice.d.ts +0 -21
- package/dist/delivery/choice.d.ts.map +0 -1
- package/dist/delivery/choice.js +0 -109
- package/dist/delivery/feedback-tick.d.ts +0 -21
- package/dist/delivery/feedback-tick.d.ts.map +0 -1
- package/dist/delivery/feedback-tick.js +0 -104
- package/dist/delivery/index.d.ts +0 -38
- package/dist/delivery/index.d.ts.map +0 -1
- package/dist/delivery/index.js +0 -217
- package/dist/delivery/main.d.ts +0 -32
- package/dist/delivery/main.d.ts.map +0 -1
- package/dist/delivery/main.js +0 -51
- package/dist/delivery/multiple-choice.d.ts +0 -63
- package/dist/delivery/multiple-choice.d.ts.map +0 -1
- package/dist/delivery/multiple-choice.js +0 -252
- package/dist/delivery/session-updater.d.ts +0 -11
- package/dist/delivery/session-updater.d.ts.map +0 -1
- package/dist/delivery/session-updater.js +0 -9
- 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 -148
- 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/_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/_assignMergeValue.js +0 -8
- 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/_baseFor.js +0 -5
- 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/_baseMerge.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- 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/_baseTrim.js +0 -8
- 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/_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/_createAssigner.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +0 -12
- 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/_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/_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/_safeGet.js +0 -6
- 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/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
- 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/debounce.js +0 -50
- 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/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/isArrayLikeObject.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/isPlainObject.js +0 -14
- 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/merge.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +0 -7
- 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/toNumber.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +0 -8
- package/dist/print/index.d.ts +0 -16
- package/dist/print/index.d.ts.map +0 -1
- package/dist/print/index.js +0 -44
- package/src/author/main.tsx +0 -509
- package/src/author/utils.ts +0 -25
- package/src/controller/utils.ts +0 -22
- package/src/delivery/choice-input.tsx +0 -413
- package/src/delivery/choice.tsx +0 -203
- package/src/delivery/feedback-tick.tsx +0 -156
- package/src/delivery/main.tsx +0 -85
- package/src/delivery/multiple-choice.tsx +0 -485
- package/src/index.iife.ts +0 -16
- package/src/index.ts +0 -1
- package/src/print/index.tsx +0 -112
package/dist/print/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import e from "../delivery/main.js";
|
|
2
|
-
import t from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js";
|
|
3
|
-
import n from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import { createRoot as i } from "react-dom/client";
|
|
6
|
-
import a from "debug";
|
|
7
|
-
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
8
|
-
//#region src/print/index.tsx
|
|
9
|
-
var s = a("pie-element:multiple-choice:print"), c = (e, n) => {
|
|
10
|
-
let r = n.role === "instructor";
|
|
11
|
-
return e.prompt = e.promptEnabled === !1 ? void 0 : e.prompt, e.teacherInstructions = r && e.teacherInstructionsEnabled !== !1 ? e.teacherInstructions : void 0, e.showTeacherInstructions = r, e.alwaysShowCorrect = r, e.mode = r ? "evaluate" : e.mode, e.disabled = !0, e.animationsDisabled = !0, e.lockChoiceOrder = !0, e.choicesLayout = e.choicesLayout || "vertical", e.choices = t(e.choices).map((t) => (t.rationale = r && e.rationaleEnabled !== !1 ? t.rationale : void 0, t.hideTick = r, t.feedback = void 0, t)), e.keyMode = e.choicePrefix || "letters", e;
|
|
12
|
-
}, l = class extends HTMLElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender = n(() => {
|
|
15
|
-
if (this._model && this._session) {
|
|
16
|
-
let t = c(this._model, this._options), n = this._options && r.createElement(e, {
|
|
17
|
-
model: t,
|
|
18
|
-
session: {},
|
|
19
|
-
options: this._options
|
|
20
|
-
});
|
|
21
|
-
this._root ||= i(this), this._root.render(n), requestAnimationFrame(() => {
|
|
22
|
-
requestAnimationFrame(() => {
|
|
23
|
-
s("render complete - render math"), o(this);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
} else s("skip");
|
|
27
|
-
}, 50, {
|
|
28
|
-
leading: !1,
|
|
29
|
-
trailing: !0
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
set options(e) {
|
|
33
|
-
this._options = e;
|
|
34
|
-
}
|
|
35
|
-
set model(e) {
|
|
36
|
-
this._model = e, this._rerender();
|
|
37
|
-
}
|
|
38
|
-
connectedCallback() {}
|
|
39
|
-
disconnectedCallback() {
|
|
40
|
-
this._root && this._root.unmount();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
//#endregion
|
|
44
|
-
export { l as default };
|
package/src/author/main.tsx
DELETED
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/multiple-choice/configure/src/main.jsx
|
|
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 React from 'react';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
|
-
import { styled } from '@mui/material/styles';
|
|
14
|
-
import EditableHtml from '@pie-lib/editable-html-tip-tap';
|
|
15
|
-
import {
|
|
16
|
-
AlertDialog,
|
|
17
|
-
InputContainer,
|
|
18
|
-
ChoiceConfiguration,
|
|
19
|
-
settings,
|
|
20
|
-
layout,
|
|
21
|
-
choiceUtils as utils,
|
|
22
|
-
} from '@pie-lib/config-ui';
|
|
23
|
-
import { color } from '@pie-lib/render-ui';
|
|
24
|
-
import Button from '@mui/material/Button';
|
|
25
|
-
import Tooltip from '@mui/material/Tooltip';
|
|
26
|
-
import Typography from '@mui/material/Typography';
|
|
27
|
-
import Box from '@mui/material/Box';
|
|
28
|
-
import Info from '@mui/icons-material/Info';
|
|
29
|
-
import { merge } from 'lodash-es';
|
|
30
|
-
import { generateValidationMessage } from './utils.js';
|
|
31
|
-
|
|
32
|
-
const { Panel, toggle, radio, dropdown } = settings;
|
|
33
|
-
|
|
34
|
-
const MAX_CHOICES = 9;
|
|
35
|
-
|
|
36
|
-
const PromptHolder: any = styled(InputContainer)(({ theme }) => ({
|
|
37
|
-
width: '100%',
|
|
38
|
-
paddingTop: theme.spacing(2),
|
|
39
|
-
marginBottom: theme.spacing(2),
|
|
40
|
-
}));
|
|
41
|
-
|
|
42
|
-
const RationaleHolder: any = styled(InputContainer)(({ theme }) => ({
|
|
43
|
-
flex: 1,
|
|
44
|
-
marginTop: theme.spacing(1.5),
|
|
45
|
-
paddingTop: theme.spacing(2),
|
|
46
|
-
marginLeft: theme.spacing(3.5),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
const ChoiceConfigurationHolder: any = styled(InputContainer)(({ theme }) => ({
|
|
50
|
-
display: 'flex',
|
|
51
|
-
flexDirection: 'column',
|
|
52
|
-
marginBottom: theme.spacing(1),
|
|
53
|
-
width: '100%',
|
|
54
|
-
}));
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const AddButton: any = styled(Button)(({ theme }) => ({
|
|
58
|
-
marginTop: theme.spacing(1),
|
|
59
|
-
float: 'right',
|
|
60
|
-
}));
|
|
61
|
-
|
|
62
|
-
const DisableButton: any = styled(AddButton)({
|
|
63
|
-
cursor: 'not-allowed',
|
|
64
|
-
pointerEvents: 'all',
|
|
65
|
-
backgroundColor: color.disabled(),
|
|
66
|
-
'&:hover': {
|
|
67
|
-
backgroundColor: color.disabled(),
|
|
68
|
-
},
|
|
69
|
-
'&:focus': {
|
|
70
|
-
backgroundColor: color.disabled(),
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const FlexContainer: any = styled(Box)({
|
|
75
|
-
display: 'flex',
|
|
76
|
-
alignItems: 'center',
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const TitleText: any = styled(Typography)(({ theme }) => ({
|
|
80
|
-
fontSize: theme.typography.fontSize + 2,
|
|
81
|
-
marginRight: theme.spacing(1),
|
|
82
|
-
}));
|
|
83
|
-
|
|
84
|
-
const StyledTooltip: any = styled(Tooltip)(({ theme }) => ({
|
|
85
|
-
'& .MuiTooltip-tooltip': {
|
|
86
|
-
fontSize: theme.typography.fontSize - 2,
|
|
87
|
-
whiteSpace: 'pre',
|
|
88
|
-
maxWidth: '500px',
|
|
89
|
-
},
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
const ErrorText: any = styled('div')(({ theme }) => ({
|
|
93
|
-
fontSize: theme.typography.fontSize - 2,
|
|
94
|
-
color: theme.palette.error.main,
|
|
95
|
-
paddingTop: theme.spacing(1),
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
const Design = (props) => {
|
|
99
|
-
const {
|
|
100
|
-
model,
|
|
101
|
-
configuration,
|
|
102
|
-
onPromptChanged,
|
|
103
|
-
onChoiceChanged,
|
|
104
|
-
onRemoveChoice,
|
|
105
|
-
onAddChoice,
|
|
106
|
-
imageSupport,
|
|
107
|
-
uploadSoundSupport,
|
|
108
|
-
onChangeModel,
|
|
109
|
-
onConfigurationChanged,
|
|
110
|
-
onTeacherInstructionsChanged,
|
|
111
|
-
} = props;
|
|
112
|
-
|
|
113
|
-
const {
|
|
114
|
-
addChoiceButton = {},
|
|
115
|
-
contentDimensions = {},
|
|
116
|
-
feedback = {},
|
|
117
|
-
deleteChoice = {},
|
|
118
|
-
choiceMode = {},
|
|
119
|
-
choicePrefix = {},
|
|
120
|
-
partialScoring = {},
|
|
121
|
-
lockChoiceOrder = {},
|
|
122
|
-
teacherInstructions = {},
|
|
123
|
-
studentInstructions = {},
|
|
124
|
-
rationale = {},
|
|
125
|
-
scoringType = {},
|
|
126
|
-
sequentialChoiceLabels = {},
|
|
127
|
-
settingsPanelDisabled,
|
|
128
|
-
choicesLayout,
|
|
129
|
-
spellCheck = {},
|
|
130
|
-
gridColumns,
|
|
131
|
-
maxImageWidth = {},
|
|
132
|
-
maxImageHeight = {},
|
|
133
|
-
prompt = {},
|
|
134
|
-
withRubric = {},
|
|
135
|
-
mathMlOptions = {},
|
|
136
|
-
language = {},
|
|
137
|
-
languageChoices = {},
|
|
138
|
-
} = configuration || {};
|
|
139
|
-
let { maxAnswerChoices } = configuration || {};
|
|
140
|
-
const {
|
|
141
|
-
limitChoicesNumber,
|
|
142
|
-
teacherInstructionsEnabled,
|
|
143
|
-
rationaleEnabled,
|
|
144
|
-
feedbackEnabled,
|
|
145
|
-
promptEnabled,
|
|
146
|
-
spellCheckEnabled,
|
|
147
|
-
choices,
|
|
148
|
-
errors,
|
|
149
|
-
toolbarEditorPosition,
|
|
150
|
-
extraCSSRules,
|
|
151
|
-
} = model || {};
|
|
152
|
-
|
|
153
|
-
const {
|
|
154
|
-
answerChoices: answerChoicesError,
|
|
155
|
-
choices: choicesErrors,
|
|
156
|
-
correctResponse: correctResponseError,
|
|
157
|
-
prompt: promptError,
|
|
158
|
-
rationale: rationaleErrors,
|
|
159
|
-
teacherInstructions: teacherInstructionsError,
|
|
160
|
-
} = errors || {};
|
|
161
|
-
const nrOfColumnsAvailable = choices?.length ? Array.from({ length: choices.length }, (_, i) => `${i + 1}`) : [];
|
|
162
|
-
|
|
163
|
-
const { baseInputConfiguration = {} } = configuration;
|
|
164
|
-
const toolbarOpts = {
|
|
165
|
-
position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// if old property is used, set maxAnswerChoices to 9
|
|
169
|
-
if (limitChoicesNumber) {
|
|
170
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const getPluginProps = (props = {}) => ({
|
|
174
|
-
...baseInputConfiguration,
|
|
175
|
-
...props,
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const validationMessage = generateValidationMessage(configuration);
|
|
179
|
-
const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
|
|
180
|
-
const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
|
|
181
|
-
const addChoiceButtonTooltip =
|
|
182
|
-
maxAnswerChoices && choices?.length >= maxAnswerChoices ? `Only ${maxAnswerChoices} allowed maximum` : '';
|
|
183
|
-
|
|
184
|
-
const panelSettings = {
|
|
185
|
-
choiceMode: choiceMode.settings && radio(choiceMode.label, ['checkbox', 'radio']),
|
|
186
|
-
'sequentialChoiceLabels.enabled': sequentialChoiceLabels.settings && toggle(sequentialChoiceLabels.label, true),
|
|
187
|
-
choicePrefix: choicePrefix.settings && radio(choicePrefix.label, ['numbers', 'letters']),
|
|
188
|
-
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
189
|
-
lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
|
|
190
|
-
feedbackEnabled: feedback.settings && toggle(feedback.label),
|
|
191
|
-
choicesLayout: choicesLayout.settings && dropdown(choicesLayout.label, ['vertical', 'grid', 'horizontal']),
|
|
192
|
-
gridColumns:
|
|
193
|
-
choicesLayout.settings &&
|
|
194
|
-
model.choicesLayout === 'grid' &&
|
|
195
|
-
nrOfColumnsAvailable.length > 0 &&
|
|
196
|
-
dropdown(gridColumns.label, nrOfColumnsAvailable),
|
|
197
|
-
'language.enabled': language.settings && toggle(language.label, true),
|
|
198
|
-
language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
const panelProperties = {
|
|
202
|
-
teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
|
|
203
|
-
studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
|
|
204
|
-
promptEnabled: prompt.settings && toggle(prompt.label),
|
|
205
|
-
rationaleEnabled: rationale.settings && toggle(rationale.label),
|
|
206
|
-
spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
|
|
207
|
-
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
|
|
208
|
-
rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<layout.ConfigLayout
|
|
213
|
-
dimensions={contentDimensions}
|
|
214
|
-
hideSettings={settingsPanelDisabled}
|
|
215
|
-
extraCSSRules={extraCSSRules}
|
|
216
|
-
classes={{}}
|
|
217
|
-
settings={
|
|
218
|
-
<Panel
|
|
219
|
-
model={model}
|
|
220
|
-
onChangeModel={onChangeModel}
|
|
221
|
-
configuration={configuration}
|
|
222
|
-
onChangeConfiguration={onConfigurationChanged}
|
|
223
|
-
groups={{
|
|
224
|
-
Settings: panelSettings,
|
|
225
|
-
Properties: panelProperties,
|
|
226
|
-
}}
|
|
227
|
-
/>
|
|
228
|
-
}
|
|
229
|
-
>
|
|
230
|
-
{teacherInstructionsEnabled && (
|
|
231
|
-
<PromptHolder label={teacherInstructions.label}>
|
|
232
|
-
<EditableHtml
|
|
233
|
-
markup={model.teacherInstructions || ''}
|
|
234
|
-
onChange={onTeacherInstructionsChanged}
|
|
235
|
-
imageSupport={imageSupport}
|
|
236
|
-
nonEmpty={false}
|
|
237
|
-
disableUnderline
|
|
238
|
-
error={teacherInstructionsError}
|
|
239
|
-
toolbarOpts={toolbarOpts}
|
|
240
|
-
pluginProps={getPluginProps(configuration?.teacherInstructions?.inputConfiguration)}
|
|
241
|
-
spellCheck={spellCheckEnabled}
|
|
242
|
-
maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}
|
|
243
|
-
maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}
|
|
244
|
-
uploadSoundSupport={uploadSoundSupport}
|
|
245
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
246
|
-
mathMlOptions={mathMlOptions}
|
|
247
|
-
/>
|
|
248
|
-
{teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
|
|
249
|
-
</PromptHolder>
|
|
250
|
-
)}
|
|
251
|
-
|
|
252
|
-
{promptEnabled && (
|
|
253
|
-
<PromptHolder label={prompt.label}>
|
|
254
|
-
<EditableHtml
|
|
255
|
-
markup={model.prompt}
|
|
256
|
-
onChange={onPromptChanged}
|
|
257
|
-
imageSupport={imageSupport}
|
|
258
|
-
nonEmpty={false}
|
|
259
|
-
disableUnderline
|
|
260
|
-
error={promptError}
|
|
261
|
-
toolbarOpts={toolbarOpts}
|
|
262
|
-
pluginProps={getPluginProps(configuration?.prompt?.inputConfiguration)}
|
|
263
|
-
spellCheck={spellCheckEnabled}
|
|
264
|
-
maxImageWidth={maxImageWidth && maxImageWidth.prompt}
|
|
265
|
-
maxImageHeight={maxImageHeight && maxImageHeight.prompt}
|
|
266
|
-
uploadSoundSupport={uploadSoundSupport}
|
|
267
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
268
|
-
mathMlOptions={mathMlOptions}
|
|
269
|
-
/>
|
|
270
|
-
{promptError && <ErrorText>{promptError}</ErrorText>}
|
|
271
|
-
</PromptHolder>
|
|
272
|
-
)}
|
|
273
|
-
|
|
274
|
-
<FlexContainer>
|
|
275
|
-
<TitleText component={'div'}>
|
|
276
|
-
Choices
|
|
277
|
-
</TitleText>
|
|
278
|
-
<StyledTooltip
|
|
279
|
-
disableFocusListener
|
|
280
|
-
disableTouchListener
|
|
281
|
-
placement={'right'}
|
|
282
|
-
title={validationMessage}
|
|
283
|
-
>
|
|
284
|
-
<Info fontSize={'small'} color={'primary'} />
|
|
285
|
-
</StyledTooltip>
|
|
286
|
-
</FlexContainer>
|
|
287
|
-
|
|
288
|
-
{choices.map((choice, index) => (
|
|
289
|
-
<ChoiceConfigurationHolder key={`choice-${index}`}>
|
|
290
|
-
<ChoiceConfiguration
|
|
291
|
-
key={index}
|
|
292
|
-
index={index + 1}
|
|
293
|
-
useLetterOrdering={model.choicePrefix === 'letters'}
|
|
294
|
-
mode={model.choiceMode}
|
|
295
|
-
data={choice}
|
|
296
|
-
defaultFeedback={{}}
|
|
297
|
-
imageSupport={imageSupport}
|
|
298
|
-
disableImageAlignmentButtons={true}
|
|
299
|
-
onDelete={() => onRemoveChoice(index)}
|
|
300
|
-
onChange={(c) => onChoiceChanged(index, c)}
|
|
301
|
-
allowFeedBack={feedbackEnabled}
|
|
302
|
-
allowDelete={deleteChoice.settings}
|
|
303
|
-
noLabels
|
|
304
|
-
pluginOpts={getPluginProps(configuration?.choices?.inputConfiguration)}
|
|
305
|
-
toolbarOpts={toolbarOpts}
|
|
306
|
-
spellCheck={spellCheckEnabled}
|
|
307
|
-
error={choicesErrors?.[choice.value] || null}
|
|
308
|
-
noCorrectAnswerError={correctResponseError}
|
|
309
|
-
maxImageWidth={(maxImageWidth && maxImageWidth.choices) || defaultImageMaxWidth}
|
|
310
|
-
maxImageHeight={(maxImageHeight && maxImageHeight.choices) || defaultImageMaxHeight}
|
|
311
|
-
uploadSoundSupport={uploadSoundSupport}
|
|
312
|
-
mathMlOptions={mathMlOptions}
|
|
313
|
-
/>
|
|
314
|
-
|
|
315
|
-
{rationaleEnabled && (
|
|
316
|
-
<RationaleHolder key={`rationale-${index}`} label={rationale.label}>
|
|
317
|
-
<EditableHtml
|
|
318
|
-
markup={choice.rationale || ''}
|
|
319
|
-
onChange={(c) => onChoiceChanged(index, { ...choice, rationale: c })}
|
|
320
|
-
imageSupport={imageSupport}
|
|
321
|
-
error={rationaleErrors?.[choice.value] || null}
|
|
322
|
-
toolbarOpts={toolbarOpts}
|
|
323
|
-
pluginProps={getPluginProps(configuration?.rationale?.inputConfiguration)}
|
|
324
|
-
spellCheck={spellCheckEnabled}
|
|
325
|
-
maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
|
|
326
|
-
maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
|
|
327
|
-
uploadSoundSupport={uploadSoundSupport}
|
|
328
|
-
languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
|
|
329
|
-
mathMlOptions={mathMlOptions}
|
|
330
|
-
/>
|
|
331
|
-
{rationaleErrors?.[choice.value] && (
|
|
332
|
-
<ErrorText>{rationaleErrors?.[choice.value]}</ErrorText>
|
|
333
|
-
)}
|
|
334
|
-
</RationaleHolder>
|
|
335
|
-
)}
|
|
336
|
-
</ChoiceConfigurationHolder>
|
|
337
|
-
))}
|
|
338
|
-
|
|
339
|
-
{correctResponseError && <ErrorText>{correctResponseError}</ErrorText>}
|
|
340
|
-
{answerChoicesError && <ErrorText>{answerChoicesError}</ErrorText>}
|
|
341
|
-
|
|
342
|
-
{addChoiceButton.settings && (
|
|
343
|
-
<StyledTooltip title={addChoiceButtonTooltip}>
|
|
344
|
-
{maxAnswerChoices && choices?.length >= maxAnswerChoices ? (
|
|
345
|
-
<DisableButton
|
|
346
|
-
variant="contained"
|
|
347
|
-
color="primary"
|
|
348
|
-
onClick={onAddChoice}
|
|
349
|
-
disabled
|
|
350
|
-
>
|
|
351
|
-
{addChoiceButton.label}
|
|
352
|
-
</DisableButton>
|
|
353
|
-
) : (
|
|
354
|
-
<AddButton
|
|
355
|
-
variant="contained"
|
|
356
|
-
color="primary"
|
|
357
|
-
onClick={onAddChoice}
|
|
358
|
-
>
|
|
359
|
-
{addChoiceButton.label}
|
|
360
|
-
</AddButton>
|
|
361
|
-
)}
|
|
362
|
-
</StyledTooltip>
|
|
363
|
-
)}
|
|
364
|
-
</layout.ConfigLayout>
|
|
365
|
-
);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
export class Main extends React.Component {
|
|
369
|
-
static propTypes = {
|
|
370
|
-
model: PropTypes.object.isRequired,
|
|
371
|
-
configuration: PropTypes.object.isRequired,
|
|
372
|
-
disableSidePanel: PropTypes.bool,
|
|
373
|
-
onModelChanged: PropTypes.func.isRequired,
|
|
374
|
-
onConfigurationChanged: PropTypes.func.isRequired,
|
|
375
|
-
imageSupport: PropTypes.shape({
|
|
376
|
-
add: PropTypes.func.isRequired,
|
|
377
|
-
delete: PropTypes.func.isRequired,
|
|
378
|
-
}),
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
state = { showWarning: false };
|
|
382
|
-
|
|
383
|
-
onRemoveChoice: any = (index) => {
|
|
384
|
-
const { model, configuration, onModelChanged } = this.props;
|
|
385
|
-
const { minAnswerChoices } = configuration || {};
|
|
386
|
-
|
|
387
|
-
if (minAnswerChoices && model.choices.length === minAnswerChoices) {
|
|
388
|
-
this.setState({ showWarning: true });
|
|
389
|
-
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
model.choices.splice(index, 1);
|
|
394
|
-
onModelChanged(model);
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
onAddChoice: any = () => {
|
|
398
|
-
const { model, configuration, onModelChanged } = this.props;
|
|
399
|
-
let { maxAnswerChoices } = configuration || {};
|
|
400
|
-
const { limitChoicesNumber } = model || {};
|
|
401
|
-
|
|
402
|
-
// if old property is used, set maxAnswerChoices to 9
|
|
403
|
-
if (limitChoicesNumber) {
|
|
404
|
-
maxAnswerChoices = MAX_CHOICES;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
if (maxAnswerChoices && model.choices.length >= maxAnswerChoices) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
model.choices.push({
|
|
412
|
-
label: '',
|
|
413
|
-
value: utils.firstAvailableIndex(
|
|
414
|
-
model.choices.map((c) => c.value),
|
|
415
|
-
0,
|
|
416
|
-
),
|
|
417
|
-
feedback: { type: 'none' },
|
|
418
|
-
});
|
|
419
|
-
|
|
420
|
-
onModelChanged(model);
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
onChoiceChanged: any = (index, choice) => {
|
|
424
|
-
const { model, onModelChanged } = this.props;
|
|
425
|
-
|
|
426
|
-
if (choice.correct && model.choiceMode === 'radio') {
|
|
427
|
-
model.choices = model.choices.map((c) => merge({}, c, { correct: false }));
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
model.choices.splice(index, 1, choice);
|
|
431
|
-
onModelChanged(model);
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
onPromptChanged: any = (prompt) => {
|
|
435
|
-
this.props.onModelChanged({
|
|
436
|
-
...this.props.model,
|
|
437
|
-
prompt,
|
|
438
|
-
});
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
onTeacherInstructionsChanged: any = (teacherInstructions) => {
|
|
442
|
-
this.props.onModelChanged({
|
|
443
|
-
...this.props.model,
|
|
444
|
-
teacherInstructions,
|
|
445
|
-
});
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
onModelChanged: any = (model, key) => {
|
|
449
|
-
const { onModelChanged } = this.props;
|
|
450
|
-
|
|
451
|
-
switch (key) {
|
|
452
|
-
case 'choiceMode': {
|
|
453
|
-
let value = model.choiceMode;
|
|
454
|
-
|
|
455
|
-
if (value === 'radio') {
|
|
456
|
-
let correctFound = false;
|
|
457
|
-
|
|
458
|
-
model.choices = model.choices.map((c) => {
|
|
459
|
-
if (correctFound) {
|
|
460
|
-
c.correct = false;
|
|
461
|
-
|
|
462
|
-
return c;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
if (c.correct) {
|
|
466
|
-
correctFound = true;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
return c;
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
onModelChanged(model, true);
|
|
474
|
-
break;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
default:
|
|
478
|
-
onModelChanged(model);
|
|
479
|
-
break;
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
|
|
483
|
-
render() {
|
|
484
|
-
const { configuration: { minAnswerChoices } = {} } = this.props;
|
|
485
|
-
const { showWarning } = this.state;
|
|
486
|
-
|
|
487
|
-
return (
|
|
488
|
-
<React.Fragment>
|
|
489
|
-
<AlertDialog
|
|
490
|
-
open={showWarning}
|
|
491
|
-
title="Warning"
|
|
492
|
-
text={`There can't be less than ${minAnswerChoices || 0} choices.`}
|
|
493
|
-
onConfirm={() => this.setState({ showWarning: false })}
|
|
494
|
-
/>
|
|
495
|
-
<Design
|
|
496
|
-
{...this.props}
|
|
497
|
-
onChangeModel={this.onModelChanged}
|
|
498
|
-
onRemoveChoice={this.onRemoveChoice}
|
|
499
|
-
onChoiceChanged={this.onChoiceChanged}
|
|
500
|
-
onAddChoice={this.onAddChoice}
|
|
501
|
-
onPromptChanged={this.onPromptChanged}
|
|
502
|
-
onTeacherInstructionsChanged={this.onTeacherInstructionsChanged}
|
|
503
|
-
/>
|
|
504
|
-
</React.Fragment>
|
|
505
|
-
);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
export default Main;
|
package/src/author/utils.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/multiple-choice/configure/src/utils.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
|
-
export const generateValidationMessage = (config) => {
|
|
12
|
-
const { minAnswerChoices, maxAnswerChoices } = config;
|
|
13
|
-
|
|
14
|
-
const answerChoicesMessage =
|
|
15
|
-
`\nThere should be at least ${minAnswerChoices} ` +
|
|
16
|
-
(maxAnswerChoices ? `and at most ${maxAnswerChoices} ` : '') +
|
|
17
|
-
'answer choices defined.' +
|
|
18
|
-
'\nEvery answer choice should be non-blank and unique.';
|
|
19
|
-
|
|
20
|
-
const correctAnswerMessage = '\nA correct answer must be defined.';
|
|
21
|
-
|
|
22
|
-
const message = 'Validation requirements:' + answerChoicesMessage + correctAnswerMessage;
|
|
23
|
-
|
|
24
|
-
return message;
|
|
25
|
-
};
|
package/src/controller/utils.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
/**
|
|
3
|
-
* @synced-from pie-elements/packages/multiple-choice/controller/src/utils.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 { isEqual } from 'lodash-es';
|
|
12
|
-
|
|
13
|
-
export const getCorrectResponse = (choices) =>
|
|
14
|
-
choices
|
|
15
|
-
.filter((c) => c.correct)
|
|
16
|
-
.map((c) => c.value)
|
|
17
|
-
.sort();
|
|
18
|
-
|
|
19
|
-
export const isResponseCorrect = (question, session) => {
|
|
20
|
-
let correctResponse = getCorrectResponse(question.choices);
|
|
21
|
-
return session && isEqual((session.value || []).sort(), correctResponse);
|
|
22
|
-
};
|