@pie-element/graphing 0.1.0
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/dist/author/configure.d.ts +27 -0
- package/dist/author/configure.d.ts.map +1 -0
- package/dist/author/configure.js +208 -0
- package/dist/author/correct-response.d.ts +55 -0
- package/dist/author/correct-response.d.ts.map +1 -0
- package/dist/author/correct-response.js +304 -0
- package/dist/author/defaults.d.ts +295 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +415 -0
- package/dist/author/graphing-config.d.ts +35 -0
- package/dist/author/graphing-config.d.ts.map +1 -0
- package/dist/author/graphing-config.js +244 -0
- package/dist/author/index.d.ts +60 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +96 -0
- package/dist/author/utils.d.ts +44 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +260 -0
- package/dist/controller/defaults.d.ts +60 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +61 -0
- package/dist/controller/index.d.ts +34 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +177 -0
- package/dist/controller/utils.d.ts +37 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +111 -0
- package/dist/delivery/index.d.ts +22 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +43 -0
- package/dist/delivery/main.d.ts +24 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +107 -0
- package/dist/delivery/utils.d.ts +23 -0
- package/dist/delivery/utils.d.ts.map +1 -0
- package/dist/graphing.css +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +374 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayIncludesWith.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseDifference.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFindIndex.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFlatten.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIndexOf.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIntersection.js +29 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNaN.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSet.js +22 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseToString.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUniq.js +27 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castArrayLikeObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_castPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isFlattenable.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKey.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_memoizeCapped.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_strictIndexOf.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stringToPath.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toKey.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/differenceWith.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/intersection.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/last.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/memoize.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/noop.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/set.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniq.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/uniqWith.js +7 -0
- package/package.json +72 -0
- package/src/author/configure.tsx +299 -0
- package/src/author/correct-response.tsx +490 -0
- package/src/author/defaults.tsx +434 -0
- package/src/author/graphing-config.tsx +333 -0
- package/src/author/index.ts +204 -0
- package/src/author/utils.ts +144 -0
- package/src/controller/defaults.ts +74 -0
- package/src/controller/index.ts +458 -0
- package/src/controller/utils.ts +361 -0
- package/src/delivery/index.ts +79 -0
- package/src/delivery/main.tsx +180 -0
- package/src/delivery/utils.ts +34 -0
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/graphing/configure/src/correct-response.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 * as React from 'react';
|
|
12
|
+
import ReactDOM from 'react-dom';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import { GraphContainer as Graph } from '@pie-lib/graphing';
|
|
16
|
+
import { AlertDialog } from '@pie-lib/config-ui';
|
|
17
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
18
|
+
import Delete from '@mui/icons-material/Delete';
|
|
19
|
+
import { set, isEqual } from 'lodash-es';
|
|
20
|
+
import { MenuItem, Select, Tooltip, Typography } from '@mui/material';
|
|
21
|
+
import Info from '@mui/icons-material/Info';
|
|
22
|
+
|
|
23
|
+
// custom grey values close to old v3 accents
|
|
24
|
+
const GREY_A100 = '#D5D5D5';
|
|
25
|
+
const GREY_A200 = '#AAAAAA';
|
|
26
|
+
|
|
27
|
+
const GraphingTools: any = styled('div')({
|
|
28
|
+
color: GREY_A200,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const Button: any = styled('div')(({ theme }) => ({
|
|
32
|
+
margin: `${theme.spacing(2.5)} 0`,
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
background: theme.palette.grey[200],
|
|
35
|
+
padding: theme.spacing(1.5),
|
|
36
|
+
width: 'fit-content',
|
|
37
|
+
borderRadius: '4px',
|
|
38
|
+
'&:hover': {
|
|
39
|
+
background: GREY_A100,
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const AvailableTools: any = styled('div')(({ theme }) => ({
|
|
44
|
+
marginTop: theme.spacing(1),
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexWrap: 'wrap',
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
const AvailableTool: any = styled('div')(({ theme }) => ({
|
|
50
|
+
cursor: 'pointer',
|
|
51
|
+
margin: theme.spacing(1),
|
|
52
|
+
padding: theme.spacing(1),
|
|
53
|
+
border: `2px solid ${theme.palette.common.white}`,
|
|
54
|
+
textTransform: 'capitalize',
|
|
55
|
+
'&:hover': {
|
|
56
|
+
color: theme.palette.grey[800],
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
const SelectedTool: any = styled(AvailableTool)({
|
|
61
|
+
background: GREY_A100,
|
|
62
|
+
border: `2px solid ${GREY_A200}`,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const ResponseTitle: any = styled('div')(({ theme }) => ({
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
marginTop: theme.spacing(2.5),
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
const IconButton: any = styled('div')(({ theme }) => ({
|
|
72
|
+
marginLeft: '6px',
|
|
73
|
+
color: theme.palette.grey[600],
|
|
74
|
+
'&:hover': {
|
|
75
|
+
cursor: 'pointer',
|
|
76
|
+
color: theme.palette.common.black,
|
|
77
|
+
},
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const Name: any = styled('div')(({ theme }) => ({
|
|
81
|
+
marginBottom: theme.spacing(0.5),
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
const StyledTooltip: any = styled(({ className, ...props }) => (
|
|
85
|
+
<Tooltip {...props} classes={{ tooltip: className }} />
|
|
86
|
+
))(({ theme }) => ({
|
|
87
|
+
'& .MuiTooltip-tooltip': {
|
|
88
|
+
fontSize: theme.typography.fontSize - 2,
|
|
89
|
+
whiteSpace: 'pre',
|
|
90
|
+
maxWidth: '500px',
|
|
91
|
+
},
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
const SubtitleText: any = styled(Typography)(({ theme }) => ({
|
|
95
|
+
marginTop: theme.spacing(1.5),
|
|
96
|
+
marginBottom: theme.spacing(1),
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const ToolsHeader: any = styled('div')({
|
|
100
|
+
display: 'flex',
|
|
101
|
+
alignItems: 'center',
|
|
102
|
+
justifyContent: 'space-between',
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const DefaultTool: any = styled('div')({
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
width: '300px',
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const DefaultToolSelect: any = styled(Select)(({ theme }) => ({
|
|
112
|
+
marginLeft: theme.spacing(1),
|
|
113
|
+
textTransform: 'uppercase',
|
|
114
|
+
color: theme.palette.grey[800],
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
const StyledMenuItem: any = styled(MenuItem)({
|
|
118
|
+
textTransform: 'uppercase',
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const ErrorMessage: any = styled('div')(({ theme }) => ({
|
|
122
|
+
fontSize: theme.typography.fontSize - 2,
|
|
123
|
+
color: theme.palette.error.main,
|
|
124
|
+
marginTop: theme.spacing(1),
|
|
125
|
+
}));
|
|
126
|
+
|
|
127
|
+
export const Tools = ({
|
|
128
|
+
availableTools,
|
|
129
|
+
defaultTool,
|
|
130
|
+
hasErrors,
|
|
131
|
+
toolbarTools,
|
|
132
|
+
toggleToolBarTool,
|
|
133
|
+
onDefaultToolChange,
|
|
134
|
+
}) => {
|
|
135
|
+
let allTools = availableTools || [];
|
|
136
|
+
const isLabelAvailable = allTools.includes('label');
|
|
137
|
+
const toolbarToolsNoLabel = (toolbarTools || []).filter((tool) => tool !== 'label');
|
|
138
|
+
|
|
139
|
+
if (isLabelAvailable) {
|
|
140
|
+
// label has to be placed at the end of the list
|
|
141
|
+
const allToolsNoLabel = allTools.filter((tool) => tool !== 'label');
|
|
142
|
+
allTools = [...allToolsNoLabel, 'label'];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<GraphingTools>
|
|
147
|
+
<ToolsHeader>
|
|
148
|
+
<span>GRAPHING TOOLS</span>
|
|
149
|
+
{toolbarToolsNoLabel.length > 0 && (
|
|
150
|
+
<DefaultTool>
|
|
151
|
+
<span>Default graphing tool:</span>
|
|
152
|
+
<DefaultToolSelect
|
|
153
|
+
variant="standard"
|
|
154
|
+
onChange={onDefaultToolChange}
|
|
155
|
+
value={defaultTool}
|
|
156
|
+
disableUnderline
|
|
157
|
+
MenuProps={{ transitionDuration: { enter: 225, exit: 195 } }}
|
|
158
|
+
>
|
|
159
|
+
{toolbarToolsNoLabel.map((tool, index) => (
|
|
160
|
+
<StyledMenuItem key={index} value={tool}>
|
|
161
|
+
{tool}
|
|
162
|
+
</StyledMenuItem>
|
|
163
|
+
))}
|
|
164
|
+
</DefaultToolSelect>
|
|
165
|
+
</DefaultTool>
|
|
166
|
+
)}
|
|
167
|
+
</ToolsHeader>
|
|
168
|
+
<AvailableTools>
|
|
169
|
+
{allTools.map((tool) => {
|
|
170
|
+
const selected = toolbarTools.find((t) => t === tool);
|
|
171
|
+
const ToolComponent = selected ? SelectedTool : AvailableTool;
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<ToolComponent
|
|
175
|
+
key={tool}
|
|
176
|
+
style={{
|
|
177
|
+
...(hasErrors && tool !== 'label' && { color: 'red' }),
|
|
178
|
+
}}
|
|
179
|
+
onClick={() => toggleToolBarTool(tool)}
|
|
180
|
+
>
|
|
181
|
+
{tool.toUpperCase()}
|
|
182
|
+
</ToolComponent>
|
|
183
|
+
);
|
|
184
|
+
})}
|
|
185
|
+
</AvailableTools>
|
|
186
|
+
</GraphingTools>
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
Tools.propTypes = {
|
|
191
|
+
toolbarTools: PropTypes.arrayOf(PropTypes.string),
|
|
192
|
+
toggleToolBarTool: PropTypes.func,
|
|
193
|
+
availableTools: PropTypes.array,
|
|
194
|
+
defaultTool: PropTypes.string,
|
|
195
|
+
hasErrors: PropTypes.number,
|
|
196
|
+
onDefaultToolChange: PropTypes.func,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export class CorrectResponse extends React.Component {
|
|
200
|
+
static propTypes = {
|
|
201
|
+
availableTools: PropTypes.array,
|
|
202
|
+
errors: PropTypes.object,
|
|
203
|
+
model: PropTypes.object.isRequired,
|
|
204
|
+
onChange: PropTypes.func.isRequired,
|
|
205
|
+
toolbarTools: PropTypes.arrayOf(PropTypes.String),
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
state = {
|
|
209
|
+
dialog: {
|
|
210
|
+
open: false,
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
componentDidMount() {
|
|
215
|
+
try {
|
|
216
|
+
// eslint-disable-next-line react/no-find-dom-node
|
|
217
|
+
const domNode = ReactDOM.findDOMNode(this);
|
|
218
|
+
|
|
219
|
+
renderMath(domNode);
|
|
220
|
+
} catch (e) {
|
|
221
|
+
// Added try-catch block to handle "Unable to find node on an unmounted component" error from tests, thrown because of the usage of shallow
|
|
222
|
+
console.error('DOM not mounted');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
handleAlertDialog = (open, callback) =>
|
|
227
|
+
this.setState(
|
|
228
|
+
{
|
|
229
|
+
dialog: { open },
|
|
230
|
+
},
|
|
231
|
+
callback,
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
changeMarks: any = (key, marks) => {
|
|
235
|
+
const { model, onChange } = this.props;
|
|
236
|
+
|
|
237
|
+
set(model, `answers.${key}.marks`, marks);
|
|
238
|
+
onChange(model);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
filterMarks: any = (tool) => {
|
|
242
|
+
const {
|
|
243
|
+
model: { answers },
|
|
244
|
+
} = this.props;
|
|
245
|
+
|
|
246
|
+
return Object.entries(answers || {}).reduce((object, [key, answer]) => {
|
|
247
|
+
object[key] = {
|
|
248
|
+
...answer,
|
|
249
|
+
marks: (answer.marks || []).filter((mark) => mark.type !== tool),
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
return object;
|
|
253
|
+
}, {});
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
changeToolbarTools: any = (toolbarTools) => {
|
|
257
|
+
const { model, onChange } = this.props;
|
|
258
|
+
model.toolbarTools = toolbarTools;
|
|
259
|
+
|
|
260
|
+
onChange(model);
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
updateModel: any = (props) => {
|
|
264
|
+
const { model, onChange } = this.props;
|
|
265
|
+
|
|
266
|
+
onChange({
|
|
267
|
+
...model,
|
|
268
|
+
...props,
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
toggleToolBarTool: any = (tool) => {
|
|
273
|
+
const {
|
|
274
|
+
model: { defaultTool, toolbarTools, answers = {} },
|
|
275
|
+
} = this.props;
|
|
276
|
+
const updatedToolbarTools = [...toolbarTools];
|
|
277
|
+
let newDefaultTool = defaultTool;
|
|
278
|
+
|
|
279
|
+
const index = toolbarTools.findIndex((t) => tool === t);
|
|
280
|
+
|
|
281
|
+
if (index >= 0) {
|
|
282
|
+
const updatedAnswers = this.filterMarks(tool);
|
|
283
|
+
updatedToolbarTools.splice(index, 1);
|
|
284
|
+
if (tool === defaultTool) {
|
|
285
|
+
const toolbarToolsNoLabel = (updatedToolbarTools || []).filter((tool) => tool !== 'label');
|
|
286
|
+
newDefaultTool = (toolbarToolsNoLabel.length && toolbarToolsNoLabel[0]) || '';
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (!isEqual(answers, updatedAnswers)) {
|
|
290
|
+
this.setState({
|
|
291
|
+
dialog: {
|
|
292
|
+
open: true,
|
|
293
|
+
title: 'Warning',
|
|
294
|
+
text: `Correct answer includes one or more ${tool} objects and all of them will be deleted.`,
|
|
295
|
+
onConfirm: () =>
|
|
296
|
+
this.handleAlertDialog(
|
|
297
|
+
false,
|
|
298
|
+
this.updateModel({
|
|
299
|
+
toolbarTools: updatedToolbarTools,
|
|
300
|
+
answers: updatedAnswers,
|
|
301
|
+
defaultTool: newDefaultTool,
|
|
302
|
+
}),
|
|
303
|
+
),
|
|
304
|
+
onClose: () => this.handleAlertDialog(false),
|
|
305
|
+
},
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
} else {
|
|
311
|
+
updatedToolbarTools.push(tool);
|
|
312
|
+
|
|
313
|
+
if (defaultTool === '' && tool !== 'label') {
|
|
314
|
+
newDefaultTool = tool;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
this.updateModel({
|
|
319
|
+
toolbarTools: updatedToolbarTools,
|
|
320
|
+
defaultTool: newDefaultTool,
|
|
321
|
+
});
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
onDefaultToolChange: any = (event) => {
|
|
325
|
+
const { value } = event.target;
|
|
326
|
+
|
|
327
|
+
this.updateModel({ defaultTool: value });
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
addAlternateResponse: any = () => {
|
|
331
|
+
const { model, onChange } = this.props;
|
|
332
|
+
const { answers } = model || {};
|
|
333
|
+
const answersKeys = Object.keys(answers || {});
|
|
334
|
+
|
|
335
|
+
set(model, `answers.${`alternate${answersKeys.length}`}`, {
|
|
336
|
+
name: `Alternate ${answersKeys.length}`,
|
|
337
|
+
marks: [],
|
|
338
|
+
});
|
|
339
|
+
onChange(model);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
deleteAlternateResponse: any = (answerKey, answer) => {
|
|
343
|
+
const { model, onChange } = this.props;
|
|
344
|
+
const { answers } = model || {};
|
|
345
|
+
const { marks = [], name } = answer || {};
|
|
346
|
+
|
|
347
|
+
const deleteAnswer = () => {
|
|
348
|
+
delete answers[answerKey];
|
|
349
|
+
// rebuild answers based on new alternate positions after deletion
|
|
350
|
+
const newAnswers = Object.entries(answers).reduce((acc, currentValue, index) => {
|
|
351
|
+
const [key, value] = currentValue;
|
|
352
|
+
const newAnswer =
|
|
353
|
+
key === 'correctAnswer'
|
|
354
|
+
? { ...acc, [key]: value }
|
|
355
|
+
: { ...acc, ['alternate' + index]: { ...value, name: `Alternate ${index}` } };
|
|
356
|
+
return newAnswer;
|
|
357
|
+
}, {});
|
|
358
|
+
|
|
359
|
+
onChange({ ...model, answers: newAnswers });
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
if (marks.length) {
|
|
363
|
+
this.setState({
|
|
364
|
+
dialog: {
|
|
365
|
+
open: true,
|
|
366
|
+
title: 'Warning',
|
|
367
|
+
text: `${name} includes one or more shapes and the entire response will be deleted.`,
|
|
368
|
+
onConfirm: () => this.handleAlertDialog(false, deleteAnswer),
|
|
369
|
+
onClose: () => this.handleAlertDialog(false),
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
deleteAnswer();
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
render() {
|
|
380
|
+
const { availableTools, errors, model, mathMlOptions = {}, removeIncompleteTool } = this.props;
|
|
381
|
+
const { dialog } = this.state;
|
|
382
|
+
const {
|
|
383
|
+
answers = {},
|
|
384
|
+
arrows,
|
|
385
|
+
backgroundMarks,
|
|
386
|
+
coordinatesOnHover,
|
|
387
|
+
defaultTool,
|
|
388
|
+
domain,
|
|
389
|
+
graph = {},
|
|
390
|
+
labels,
|
|
391
|
+
labelsEnabled,
|
|
392
|
+
range,
|
|
393
|
+
title,
|
|
394
|
+
titleEnabled,
|
|
395
|
+
toolbarTools,
|
|
396
|
+
} = model || {};
|
|
397
|
+
const { correctAnswerErrors = {}, toolbarToolsError } = errors || {};
|
|
398
|
+
|
|
399
|
+
return (
|
|
400
|
+
<div>
|
|
401
|
+
<Typography component="div" variant="h6">
|
|
402
|
+
Define Tool Set and Correct Response
|
|
403
|
+
</Typography>
|
|
404
|
+
|
|
405
|
+
<SubtitleText component="div" variant="body1">
|
|
406
|
+
Use this interface to choose which graphing tools students will be able to use, and to define the correct
|
|
407
|
+
answer
|
|
408
|
+
</SubtitleText>
|
|
409
|
+
|
|
410
|
+
<Tools
|
|
411
|
+
availableTools={availableTools}
|
|
412
|
+
defaultTool={defaultTool}
|
|
413
|
+
hasErrors={!!toolbarToolsError}
|
|
414
|
+
onDefaultToolChange={this.onDefaultToolChange}
|
|
415
|
+
toggleToolBarTool={this.toggleToolBarTool}
|
|
416
|
+
toolbarTools={toolbarTools}
|
|
417
|
+
/>
|
|
418
|
+
|
|
419
|
+
{toolbarToolsError && <ErrorMessage>{toolbarToolsError}</ErrorMessage>}
|
|
420
|
+
|
|
421
|
+
{Object.entries(answers || {}).map(([key, answer]) => {
|
|
422
|
+
const { marks = [], name } = answer || {};
|
|
423
|
+
|
|
424
|
+
return (
|
|
425
|
+
<React.Fragment key={`correct-response-graph-${name}`}>
|
|
426
|
+
<ResponseTitle>
|
|
427
|
+
<Name>{name}</Name>
|
|
428
|
+
{key === 'correctAnswer' && (
|
|
429
|
+
<StyledTooltip
|
|
430
|
+
disableFocusListener
|
|
431
|
+
disableTouchListener
|
|
432
|
+
placement={'right'}
|
|
433
|
+
title={'At least 1 graph object should be defined.'}
|
|
434
|
+
>
|
|
435
|
+
<Info fontSize={'small'} color={'primary'} style={{ marginLeft: '8px', marginBottom: 'auto' }} />
|
|
436
|
+
</StyledTooltip>
|
|
437
|
+
)}
|
|
438
|
+
{key !== 'correctAnswer' && (
|
|
439
|
+
<IconButton onClick={() => this.deleteAlternateResponse(key, answer)}>
|
|
440
|
+
<Delete />
|
|
441
|
+
</IconButton>
|
|
442
|
+
)}
|
|
443
|
+
</ResponseTitle>
|
|
444
|
+
|
|
445
|
+
<Graph
|
|
446
|
+
style={correctAnswerErrors[key] && { border: '2px solid red' }}
|
|
447
|
+
axesSettings={{ includeArrows: arrows }}
|
|
448
|
+
backgroundMarks={backgroundMarks.filter((mark) => !mark.building)}
|
|
449
|
+
coordinatesOnHover={coordinatesOnHover}
|
|
450
|
+
disabledLabels={true}
|
|
451
|
+
disabledTitle={true}
|
|
452
|
+
domain={domain}
|
|
453
|
+
draggableTools={key === 'correctAnswer'}
|
|
454
|
+
labels={labels}
|
|
455
|
+
marks={marks}
|
|
456
|
+
onChangeMarks={(newMarks) => this.changeMarks(key, newMarks)}
|
|
457
|
+
range={range}
|
|
458
|
+
showLabels={labelsEnabled}
|
|
459
|
+
showTitle={titleEnabled}
|
|
460
|
+
size={{ width: graph.width, height: graph.height }}
|
|
461
|
+
title={title}
|
|
462
|
+
toolbarTools={toolbarTools}
|
|
463
|
+
onChangeTools={(toolbarTools) => this.updateModel({ toolbarTools })}
|
|
464
|
+
mathMlOptions={mathMlOptions}
|
|
465
|
+
removeIncompleteTool={removeIncompleteTool}
|
|
466
|
+
limitLabeling={true}
|
|
467
|
+
/>
|
|
468
|
+
|
|
469
|
+
{correctAnswerErrors[key] && <ErrorMessage>{correctAnswerErrors[key]}</ErrorMessage>}
|
|
470
|
+
</React.Fragment>
|
|
471
|
+
);
|
|
472
|
+
})}
|
|
473
|
+
|
|
474
|
+
<Button onClick={this.addAlternateResponse}>
|
|
475
|
+
ADD ALTERNATE
|
|
476
|
+
</Button>
|
|
477
|
+
|
|
478
|
+
<AlertDialog
|
|
479
|
+
open={dialog.open}
|
|
480
|
+
title={dialog.title}
|
|
481
|
+
text={dialog.text}
|
|
482
|
+
onClose={dialog.onClose}
|
|
483
|
+
onConfirm={dialog.onConfirm}
|
|
484
|
+
/>
|
|
485
|
+
</div>
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export default CorrectResponse;
|