@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,333 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/graphing/configure/src/graphing-config.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 PropTypes from 'prop-types';
|
|
13
|
+
import { GraphContainer, GridSetup } from '@pie-lib/graphing';
|
|
14
|
+
import { AlertDialog } from '@pie-lib/config-ui';
|
|
15
|
+
import { MenuItem, Select, Typography, OutlinedInput } from '@mui/material';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { applyConstraints, filterPlotableMarks, getGridValues, getLabelValues } from './utils.js';
|
|
18
|
+
import { isEqual } from 'lodash-es';
|
|
19
|
+
|
|
20
|
+
const Container: any = styled('div')(({ theme }) => ({
|
|
21
|
+
display: 'flex',
|
|
22
|
+
flexWrap: 'wrap',
|
|
23
|
+
marginBottom: theme.spacing(2.5),
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
const GridConfigWrapper: any = styled('div')(({ theme }) => ({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
marginRight: theme.spacing(3),
|
|
30
|
+
marginBottom: theme.spacing(2.5),
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
const GraphConfig: any = styled('div')({
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const SubtitleText: any = styled(Typography)(({ theme }) => ({
|
|
39
|
+
marginTop: theme.spacing(1.5),
|
|
40
|
+
marginBottom: theme.spacing(1),
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const GridConfig: any = styled('div')(({ theme }) => ({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
flexWrap: 'wrap',
|
|
46
|
+
alignItems: 'center',
|
|
47
|
+
width: '100%',
|
|
48
|
+
marginBottom: theme.spacing(2.5),
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
const GridConfigLabel: any = styled(Typography)(({ theme }) => ({
|
|
52
|
+
padding: `0 ${theme.spacing(1)}`,
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
const GridConfigSelect: any = styled(Select)({
|
|
56
|
+
flex: '1',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export class GraphingConfig extends React.Component {
|
|
60
|
+
static propTypes = {
|
|
61
|
+
availableTools: PropTypes.array,
|
|
62
|
+
authoring: PropTypes.object,
|
|
63
|
+
dimensionsEnabled: PropTypes.bool,
|
|
64
|
+
graphDimensions: PropTypes.object,
|
|
65
|
+
gridConfigurations: PropTypes.array,
|
|
66
|
+
labelsPlaceholders: PropTypes.object,
|
|
67
|
+
model: PropTypes.object.isRequired,
|
|
68
|
+
onChange: PropTypes.func.isRequired,
|
|
69
|
+
showLabels: PropTypes.bool,
|
|
70
|
+
showTitle: PropTypes.bool,
|
|
71
|
+
titlePlaceholder: PropTypes.string,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
constructor(props) {
|
|
75
|
+
super(props);
|
|
76
|
+
const { domain, range, graph } = props.model || {};
|
|
77
|
+
|
|
78
|
+
const gridValues = {
|
|
79
|
+
domain: getGridValues(domain, graph.width, true),
|
|
80
|
+
range: getGridValues(range, graph.height, true),
|
|
81
|
+
};
|
|
82
|
+
const labelValues = {
|
|
83
|
+
domain: getLabelValues(domain.step),
|
|
84
|
+
range: getLabelValues(range.step),
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
this.state = {
|
|
88
|
+
gridValues,
|
|
89
|
+
labelValues,
|
|
90
|
+
showPixelGuides: false,
|
|
91
|
+
dialog: { isOpened: false },
|
|
92
|
+
domain: { ...domain },
|
|
93
|
+
range: { ...range },
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
changeBackgroundMarks: any = (backgroundMarks) => {
|
|
98
|
+
const model = { ...this.props.model, backgroundMarks };
|
|
99
|
+
|
|
100
|
+
this.props.onChange(model);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
changeLabels: any = (labels) => {
|
|
104
|
+
const { model, onChange } = this.props;
|
|
105
|
+
|
|
106
|
+
onChange({ ...model, labels });
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
changeTitle: any = (title) => {
|
|
110
|
+
const { model, onChange } = this.props;
|
|
111
|
+
|
|
112
|
+
onChange({ ...model, title });
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
onConfigChange: any = (config, newSelectedGrid) => {
|
|
116
|
+
const { model, onChange } = this.props;
|
|
117
|
+
const { defaultGridConfiguration: oldSelectedGrid = 0 } = model;
|
|
118
|
+
const { gridValues: oldGridValues, labelValues: oldLabelValues, domain: oldDomain, range: oldRange } = this.state;
|
|
119
|
+
const updatedModel = { ...model, ...config };
|
|
120
|
+
const { answers, domain, includeAxes, graph, range, standardGrid } = updatedModel;
|
|
121
|
+
const gridValues = { domain: [], range: [] };
|
|
122
|
+
const labelValues = { domain: [], range: [] };
|
|
123
|
+
const selectedGrid = newSelectedGrid >= 0 ? newSelectedGrid : oldSelectedGrid;
|
|
124
|
+
|
|
125
|
+
if (includeAxes) {
|
|
126
|
+
const domainConstraints = applyConstraints(domain, graph.width, oldGridValues.domain, oldLabelValues.domain);
|
|
127
|
+
|
|
128
|
+
gridValues.domain = domainConstraints.gridValues || [];
|
|
129
|
+
labelValues.domain = domainConstraints.labelValues || [];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (standardGrid) {
|
|
133
|
+
gridValues.range = gridValues.domain;
|
|
134
|
+
labelValues.range = labelValues.domain;
|
|
135
|
+
range.step = domain.step;
|
|
136
|
+
range.labelStep = domain.labelStep;
|
|
137
|
+
} else {
|
|
138
|
+
if (includeAxes) {
|
|
139
|
+
const rangeConstraints = applyConstraints(range, graph.height, oldGridValues.range, oldLabelValues.range);
|
|
140
|
+
|
|
141
|
+
gridValues.range = rangeConstraints.gridValues || [];
|
|
142
|
+
labelValues.range = rangeConstraints.labelValues || [];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const plotableAnswers = filterPlotableMarks(domain, range, answers);
|
|
147
|
+
|
|
148
|
+
if (!isEqual(answers, plotableAnswers)) {
|
|
149
|
+
this.setState({
|
|
150
|
+
dialog: {
|
|
151
|
+
isOpened: true,
|
|
152
|
+
onClose: () =>
|
|
153
|
+
this.setState({ dialog: { isOpened: false } }, onChange({ ...model, domain: oldDomain, range: oldRange })),
|
|
154
|
+
onConfirm: () => {
|
|
155
|
+
this.setState(
|
|
156
|
+
{
|
|
157
|
+
gridValues,
|
|
158
|
+
labelValues,
|
|
159
|
+
dialog: { isOpened: false },
|
|
160
|
+
domain: { ...domain },
|
|
161
|
+
range: { ...range },
|
|
162
|
+
},
|
|
163
|
+
onChange({ ...updatedModel, answers: plotableAnswers, defaultGridConfiguration: selectedGrid }),
|
|
164
|
+
);
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
this.setState({ gridValues, labelValues, domain: { ...domain }, range: { ...range } });
|
|
173
|
+
onChange({ ...updatedModel, defaultGridConfiguration: selectedGrid });
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
onChangeView: any = (event, expanded) => {
|
|
177
|
+
const { graphDimensions: { enabled } = {} } = this.props;
|
|
178
|
+
|
|
179
|
+
if (enabled) {
|
|
180
|
+
this.setState({ showPixelGuides: expanded });
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
changeGridConfiguration: any = (event) => {
|
|
185
|
+
const { gridConfigurations } = this.props;
|
|
186
|
+
const { value } = event.target;
|
|
187
|
+
|
|
188
|
+
this.onConfigChange(gridConfigurations?.[value] || {}, value);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
render() {
|
|
192
|
+
const {
|
|
193
|
+
authoring = {},
|
|
194
|
+
availableTools = [],
|
|
195
|
+
gridConfigurations = [],
|
|
196
|
+
graphDimensions = {},
|
|
197
|
+
labelsPlaceholders,
|
|
198
|
+
model,
|
|
199
|
+
showLabels,
|
|
200
|
+
dimensionsEnabled,
|
|
201
|
+
showTitle,
|
|
202
|
+
titlePlaceholder,
|
|
203
|
+
mathMlOptions = {},
|
|
204
|
+
removeIncompleteTool,
|
|
205
|
+
} = this.props;
|
|
206
|
+
const {
|
|
207
|
+
arrows,
|
|
208
|
+
backgroundMarks,
|
|
209
|
+
coordinatesOnHover,
|
|
210
|
+
defaultGridConfiguration,
|
|
211
|
+
domain,
|
|
212
|
+
includeAxes,
|
|
213
|
+
labels,
|
|
214
|
+
range,
|
|
215
|
+
standardGrid,
|
|
216
|
+
title,
|
|
217
|
+
} = model || {};
|
|
218
|
+
const graph = (model || {}).graph || {};
|
|
219
|
+
const { min, max, step } = graphDimensions || {};
|
|
220
|
+
const { dialog = {}, gridValues, labelValues, showPixelGuides } = this.state;
|
|
221
|
+
|
|
222
|
+
const sizeConstraints = {
|
|
223
|
+
min: Math.max(150, min),
|
|
224
|
+
max: Math.min(800, max),
|
|
225
|
+
step: step >= 1 ? Math.min(200, step) : 20,
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const displayedFields = {
|
|
229
|
+
axisLabel: authoring.axisLabel,
|
|
230
|
+
dimensionsEnabled,
|
|
231
|
+
includeAxesEnabled: authoring.includeAxesEnabled,
|
|
232
|
+
labelStep: authoring.labelStep,
|
|
233
|
+
min: authoring.min,
|
|
234
|
+
max: authoring.max,
|
|
235
|
+
standardGridEnabled: authoring.standardGridEnabled,
|
|
236
|
+
step: authoring.step,
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const displayGridSetup =
|
|
240
|
+
authoring.enabled &&
|
|
241
|
+
Object.values(displayedFields).some((field) => (typeof field === 'object' ? field.enabled : field));
|
|
242
|
+
|
|
243
|
+
return (
|
|
244
|
+
<Container>
|
|
245
|
+
<GridConfigWrapper>
|
|
246
|
+
{gridConfigurations && gridConfigurations.length ? (
|
|
247
|
+
<GridConfig>
|
|
248
|
+
<GridConfigLabel component="div" variant="h6">
|
|
249
|
+
Grid Configuration
|
|
250
|
+
</GridConfigLabel>
|
|
251
|
+
|
|
252
|
+
<GridConfigSelect
|
|
253
|
+
input={<OutlinedInput />}
|
|
254
|
+
displayEmpty
|
|
255
|
+
onChange={this.changeGridConfiguration}
|
|
256
|
+
value={defaultGridConfiguration}
|
|
257
|
+
MenuProps={{ transitionDuration: { enter: 225, exit: 195 } }}
|
|
258
|
+
>
|
|
259
|
+
{(gridConfigurations || []).map((config, index) => (
|
|
260
|
+
<MenuItem key={index} value={index}>
|
|
261
|
+
{config.label}
|
|
262
|
+
</MenuItem>
|
|
263
|
+
))}
|
|
264
|
+
</GridConfigSelect>
|
|
265
|
+
</GridConfig>
|
|
266
|
+
) : null}
|
|
267
|
+
|
|
268
|
+
{displayGridSetup && (
|
|
269
|
+
<GridSetup
|
|
270
|
+
displayedFields={displayedFields}
|
|
271
|
+
domain={domain}
|
|
272
|
+
gridValues={gridValues}
|
|
273
|
+
includeAxes={includeAxes}
|
|
274
|
+
labelValues={labelValues}
|
|
275
|
+
range={range}
|
|
276
|
+
size={graph}
|
|
277
|
+
sizeConstraints={sizeConstraints}
|
|
278
|
+
standardGrid={standardGrid}
|
|
279
|
+
onChange={this.onConfigChange}
|
|
280
|
+
onChangeView={this.onChangeView}
|
|
281
|
+
/>
|
|
282
|
+
)}
|
|
283
|
+
</GridConfigWrapper>
|
|
284
|
+
|
|
285
|
+
<GraphConfig key="graph">
|
|
286
|
+
<Typography component="div" variant="h6">
|
|
287
|
+
Define Graph Attributes
|
|
288
|
+
</Typography>
|
|
289
|
+
|
|
290
|
+
<SubtitleText component="div" variant="body1">
|
|
291
|
+
Use this interface to add/edit a title and/or labels, and to set background shapes
|
|
292
|
+
</SubtitleText>
|
|
293
|
+
|
|
294
|
+
<GraphContainer
|
|
295
|
+
axesSettings={{ includeArrows: arrows }}
|
|
296
|
+
backgroundMarks={[]}
|
|
297
|
+
coordinatesOnHover={coordinatesOnHover}
|
|
298
|
+
collapsibleToolbar={true}
|
|
299
|
+
collapsibleToolbarTitle={'Add Background Shapes to Graph'}
|
|
300
|
+
domain={domain}
|
|
301
|
+
key="graphing-config"
|
|
302
|
+
labels={labels}
|
|
303
|
+
labelsPlaceholders={labelsPlaceholders}
|
|
304
|
+
marks={backgroundMarks}
|
|
305
|
+
onChangeLabels={this.changeLabels}
|
|
306
|
+
onChangeMarks={this.changeBackgroundMarks}
|
|
307
|
+
onChangeTitle={this.changeTitle}
|
|
308
|
+
range={range}
|
|
309
|
+
showLabels={showLabels}
|
|
310
|
+
showPixelGuides={showPixelGuides}
|
|
311
|
+
showTitle={showTitle}
|
|
312
|
+
size={{ width: graph.width, height: graph.height }}
|
|
313
|
+
title={title}
|
|
314
|
+
titlePlaceholder={titlePlaceholder}
|
|
315
|
+
toolbarTools={availableTools}
|
|
316
|
+
mathMlOptions={mathMlOptions}
|
|
317
|
+
removeIncompleteTool={removeIncompleteTool}
|
|
318
|
+
/>
|
|
319
|
+
</GraphConfig>
|
|
320
|
+
|
|
321
|
+
<AlertDialog
|
|
322
|
+
open={dialog.isOpened}
|
|
323
|
+
title="Warning"
|
|
324
|
+
text="This change would make it impossible for students to plot one or more graph objects in the current correct answers. If you proceed, all such graph objects will be removed from the correct answers."
|
|
325
|
+
onClose={dialog.onClose}
|
|
326
|
+
onConfirm={dialog.onConfirm}
|
|
327
|
+
/>
|
|
328
|
+
</Container>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export default GraphingConfig;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/graphing/configure/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 React from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
13
|
+
import Configure from './configure.js';
|
|
14
|
+
import {
|
|
15
|
+
DeleteImageEvent,
|
|
16
|
+
DeleteSoundEvent,
|
|
17
|
+
InsertImageEvent,
|
|
18
|
+
InsertSoundEvent,
|
|
19
|
+
ModelUpdatedEvent,
|
|
20
|
+
} from '@pie-element/shared-configure-events';
|
|
21
|
+
import debug from 'debug';
|
|
22
|
+
import defaultValues from './defaults.js';
|
|
23
|
+
import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
|
|
24
|
+
import { cloneDeep } from 'lodash-es';
|
|
25
|
+
|
|
26
|
+
const log = debug('pie-elements:graphing:configure');
|
|
27
|
+
|
|
28
|
+
// this function is implemented in controller as well
|
|
29
|
+
const sortedAnswers = (answers) =>
|
|
30
|
+
Object.keys(answers || {})
|
|
31
|
+
.sort()
|
|
32
|
+
.reduce((result, key) => {
|
|
33
|
+
if (key !== 'correctAnswer') {
|
|
34
|
+
result[key] = answers[key];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return result;
|
|
38
|
+
}, {});
|
|
39
|
+
|
|
40
|
+
export default class GraphLinesConfigure extends HTMLElement {
|
|
41
|
+
static createDefaultModel = (model = {}) => {
|
|
42
|
+
const normalizedModel = { ...defaultValues.model, ...model };
|
|
43
|
+
const {
|
|
44
|
+
answers = {},
|
|
45
|
+
domain = {},
|
|
46
|
+
defaultTool,
|
|
47
|
+
graph = {},
|
|
48
|
+
range = {},
|
|
49
|
+
standardGrid,
|
|
50
|
+
toolbarTools,
|
|
51
|
+
} = normalizedModel;
|
|
52
|
+
|
|
53
|
+
// added support for models without defaultTool defined; also used in packages/graphing/controller/src/index.js
|
|
54
|
+
const toolbarToolsNoLabel = (toolbarTools || []).filter((tool) => tool !== 'label');
|
|
55
|
+
const normalizedDefaultTool = defaultTool || (toolbarToolsNoLabel.length && toolbarToolsNoLabel[0]) || '';
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
...normalizedModel,
|
|
59
|
+
answers:
|
|
60
|
+
(answers &&
|
|
61
|
+
answers.correctAnswer && {
|
|
62
|
+
correctAnswer: answers.correctAnswer,
|
|
63
|
+
...sortedAnswers(answers),
|
|
64
|
+
}) ||
|
|
65
|
+
answers,
|
|
66
|
+
defaultTool: normalizedDefaultTool,
|
|
67
|
+
range:
|
|
68
|
+
(standardGrid && {
|
|
69
|
+
...range,
|
|
70
|
+
min: domain.min,
|
|
71
|
+
max: domain.max,
|
|
72
|
+
step: domain.step,
|
|
73
|
+
labelStep: domain.labelStep,
|
|
74
|
+
}) ||
|
|
75
|
+
range,
|
|
76
|
+
graph: (standardGrid && { ...graph, height: graph.width }) || graph,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
constructor() {
|
|
81
|
+
super();
|
|
82
|
+
this._root = null;
|
|
83
|
+
this._model = GraphLinesConfigure.createDefaultModel();
|
|
84
|
+
this._configuration = defaultValues.configuration;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set model(m) {
|
|
88
|
+
this._model = GraphLinesConfigure.createDefaultModel(m);
|
|
89
|
+
this._modelCopy = cloneDeep(this._model);
|
|
90
|
+
|
|
91
|
+
this._render();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resetModelAfterConfigurationIsSet: any = () => {
|
|
95
|
+
// In environments that use pie-player-components, model is set before configuration.
|
|
96
|
+
// This is the reason why sometimes the model gets altered non-reversible
|
|
97
|
+
// (altered using default configuration instead of client configuration, because at that point client configuration was not set yet)
|
|
98
|
+
// Therefore, in such environments, we will make sure to keep a modelCopy (initialised in set model) and use it to reset
|
|
99
|
+
// the model in set configuration (resetModelAfterConfigurationIsSet) if set configuration is ever called
|
|
100
|
+
const pieAuthors = document.querySelectorAll('pie-author');
|
|
101
|
+
this.hasPlayerAsParent = Array.from(pieAuthors).some((author) => author.contains(this));
|
|
102
|
+
|
|
103
|
+
if (this.hasPlayerAsParent) {
|
|
104
|
+
if (this._modelCopy) {
|
|
105
|
+
this._model = this._modelCopy;
|
|
106
|
+
} else {
|
|
107
|
+
delete this._modelCopy;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
set configuration(c) {
|
|
113
|
+
this._configuration = {
|
|
114
|
+
...defaultValues.configuration,
|
|
115
|
+
...c,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
this.resetModelAfterConfigurationIsSet();
|
|
119
|
+
|
|
120
|
+
// if language:enabled is true, then the corresponding default item model should include a language value;
|
|
121
|
+
// if it is false, then the language field should be omitted from the item model.
|
|
122
|
+
// if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
|
|
123
|
+
// then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
|
|
124
|
+
//TODO: add logic in controller and add tests
|
|
125
|
+
if (c.language?.enabled) {
|
|
126
|
+
if (c.languageChoices?.options?.length) {
|
|
127
|
+
this._model.language = c.languageChoices.options[0].value;
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
if (c.language.settings) {
|
|
131
|
+
if (this._model.language) {
|
|
132
|
+
this._configuration.language.enabled = true;
|
|
133
|
+
}
|
|
134
|
+
} else {
|
|
135
|
+
delete this._model.language;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this._render();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
onModelChanged: any = (model) => {
|
|
143
|
+
this._model = model;
|
|
144
|
+
this._render();
|
|
145
|
+
|
|
146
|
+
log('[onModelChanged]: ', this._model);
|
|
147
|
+
|
|
148
|
+
this.dispatchEvent(new ModelUpdatedEvent(this._model));
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
onConfigurationChanged: any = (config) => {
|
|
152
|
+
this._configuration = config;
|
|
153
|
+
this._render();
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
insertImage: any = (handler) => {
|
|
157
|
+
this.dispatchEvent(new InsertImageEvent(handler));
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
onDeleteImage: any = (src, done) => {
|
|
161
|
+
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
insertSound(handler) {
|
|
165
|
+
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
onDeleteSound(src, done) {
|
|
169
|
+
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
_render() {
|
|
173
|
+
if (this._model) {
|
|
174
|
+
const el = React.createElement(Configure, {
|
|
175
|
+
onModelChanged: this.onModelChanged,
|
|
176
|
+
onConfigurationChanged: this.onConfigurationChanged,
|
|
177
|
+
model: this._model,
|
|
178
|
+
configuration: this._configuration,
|
|
179
|
+
imageSupport: {
|
|
180
|
+
add: this.insertImage,
|
|
181
|
+
delete: this.onDeleteImage,
|
|
182
|
+
},
|
|
183
|
+
uploadSoundSupport: {
|
|
184
|
+
add: this.insertSound.bind(this),
|
|
185
|
+
delete: this.onDeleteSound.bind(this),
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
if (!this._root) {
|
|
190
|
+
this._root = createRoot(this);
|
|
191
|
+
}
|
|
192
|
+
this._root.render(el);
|
|
193
|
+
queueMicrotask(() => {
|
|
194
|
+
renderMath(this);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
disconnectedCallback() {
|
|
200
|
+
if (this._root) {
|
|
201
|
+
this._root.unmount();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/graphing/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
|
+
import { isEqual } from 'lodash-es';
|
|
12
|
+
|
|
13
|
+
const VALID_GRID_VALUES = [
|
|
14
|
+
0.01, 0.02, 0.04, 0.05, 0.0625, 0.1, 0.125, 0.2, 0.25, 0.5, 1, 2, 3, 4, 5, 8, 10, 12, 15, 20, 40, 50, 64, 100, 500,
|
|
15
|
+
1000,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// same as VALID_GRID_VALUES but next values are excluded: 0.04, 0.0625, 0.125, 3, 4, 8, 12, 15, 40, 64
|
|
19
|
+
const PREFERRED_VALID_GRID_VALUES = [0.01, 0.02, 0.05, 0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 20, 50, 100, 500, 1000];
|
|
20
|
+
|
|
21
|
+
export const VALID_LABEL_VALUES = {
|
|
22
|
+
0.01: [0, 0.01, 0.02, 0.04, 0.05, 0.1],
|
|
23
|
+
0.02: [0, 0.02, 0.04, 0.1],
|
|
24
|
+
0.04: [0, 0.04, 0.08, 0.16, 0.2],
|
|
25
|
+
0.05: [0, 0.05, 0.1, 0.2, 0.25],
|
|
26
|
+
0.0625: [0, 0.0625, 0.125, 0.25, 0.5],
|
|
27
|
+
0.1: [0, 0.1, 0.2, 0.4, 0.5, 1],
|
|
28
|
+
0.125: [0, 0.125, 0.25, 0.5, 1],
|
|
29
|
+
0.2: [0, 0.2, 0.5, 0.1],
|
|
30
|
+
0.25: [0, 0.25, 0.5, 1, 2],
|
|
31
|
+
0.5: [0, 0.5, 1, 2],
|
|
32
|
+
1: [0, 1, 2, 4, 5, 10],
|
|
33
|
+
2: [0, 2, 4, 8, 10],
|
|
34
|
+
3: [0, 3, 6, 12, 15],
|
|
35
|
+
4: [0, 4, 8, 16, 20],
|
|
36
|
+
5: [0, 5, 10, 20, 25],
|
|
37
|
+
8: [0, 8, 16, 32, 40, 64],
|
|
38
|
+
10: [0, 10, 20, 40, 50, 100],
|
|
39
|
+
12: [0, 12, 24],
|
|
40
|
+
15: [0, 15, 30, 60],
|
|
41
|
+
20: [0, 20, 40, 80, 100],
|
|
42
|
+
40: [0, 40, 80, 160, 200],
|
|
43
|
+
50: [0, 50, 100, 200, 250],
|
|
44
|
+
64: [0, 64, 128],
|
|
45
|
+
100: [0, 100, 200, 400, 500],
|
|
46
|
+
500: [0, 500, 1000, 2500],
|
|
47
|
+
1000: [0, 1000, 2000, 4000, 5000],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getGridValues = (axis, size, prefferedValues = false) => {
|
|
51
|
+
const minValue = (10 * (axis.max - axis.min)) / size;
|
|
52
|
+
const maxValue = minValue * 10;
|
|
53
|
+
|
|
54
|
+
// if preferred values should be used enforce all values to be used if the axis step
|
|
55
|
+
// is included in all supported values and not included in preferred values
|
|
56
|
+
const useAllValues =
|
|
57
|
+
prefferedValues && !PREFERRED_VALID_GRID_VALUES.includes(axis.step) && VALID_GRID_VALUES.includes(axis.step);
|
|
58
|
+
const values = !prefferedValues || useAllValues ? VALID_GRID_VALUES : PREFERRED_VALID_GRID_VALUES;
|
|
59
|
+
|
|
60
|
+
return values.filter((value) => value >= minValue && value <= maxValue);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const getLabelValues = (value) => VALID_LABEL_VALUES[value] || [];
|
|
64
|
+
|
|
65
|
+
export const applyConstraints = (axis, size, oldGridValues, oldLabelValues) => {
|
|
66
|
+
const gridValues = getGridValues(axis, size);
|
|
67
|
+
let labelValues = getLabelValues(axis.step);
|
|
68
|
+
|
|
69
|
+
if (!isEqual(oldGridValues, gridValues) && !gridValues.includes(axis.step)) {
|
|
70
|
+
const preferredValues = getGridValues(axis, size, true);
|
|
71
|
+
const lowestValue = preferredValues[0] || 1;
|
|
72
|
+
|
|
73
|
+
axis.step = lowestValue;
|
|
74
|
+
labelValues = getLabelValues(lowestValue);
|
|
75
|
+
|
|
76
|
+
if (!labelValues.includes(axis.labelStep)) {
|
|
77
|
+
axis.labelStep = lowestValue;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { gridValues, labelValues };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!isEqual(oldLabelValues, labelValues) && !labelValues.includes(axis.labelStep)) {
|
|
84
|
+
axis.labelStep = axis.step;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return { gridValues, labelValues };
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// also used in pie-lib/graphing/utils as 'getTickValues'
|
|
91
|
+
const getPlotablePoints = (prop) => {
|
|
92
|
+
const tickValues = [];
|
|
93
|
+
let tickVal = 0;
|
|
94
|
+
|
|
95
|
+
while (tickVal >= prop.min && tickValues.indexOf(tickVal) < 0) {
|
|
96
|
+
tickValues.push(tickVal);
|
|
97
|
+
tickVal = Math.round((tickVal - prop.step) * 10000) / 10000;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
tickVal = Math.round(prop.step * 10000) / 10000;
|
|
101
|
+
|
|
102
|
+
while (tickVal <= prop.max && tickValues.indexOf(tickVal) < 0) {
|
|
103
|
+
tickValues.push(tickVal);
|
|
104
|
+
tickVal = Math.round((tickVal + prop.step) * 10000) / 10000;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// return only ticks that are inside the min-max interval
|
|
108
|
+
if (tickValues) {
|
|
109
|
+
return tickValues.filter((tV) => tV >= prop.min && tV <= prop.max);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return [];
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const filterPlotableMarks = (domain, range, answers) => {
|
|
116
|
+
const domainValues = getPlotablePoints(domain);
|
|
117
|
+
const rangeValues = getPlotablePoints(range);
|
|
118
|
+
|
|
119
|
+
const isPointPlotable = (x, y) => domainValues.includes(x) && rangeValues.includes(y);
|
|
120
|
+
|
|
121
|
+
return Object.entries(answers || {}).reduce((newAnswers, [key, answer]) => {
|
|
122
|
+
newAnswers[key] = {
|
|
123
|
+
...answer,
|
|
124
|
+
marks: (answer.marks || []).filter((mark) => {
|
|
125
|
+
if (mark.type === 'point') {
|
|
126
|
+
return isPointPlotable(mark.x, mark.y);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (mark.type === 'polygon') {
|
|
130
|
+
return !mark.points.find((point) => !isPointPlotable(point.x, point.y));
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const from = mark.from || mark.root;
|
|
134
|
+
const to = mark.to || mark.edge;
|
|
135
|
+
|
|
136
|
+
return mark.building
|
|
137
|
+
? isPointPlotable(from.x, from.y)
|
|
138
|
+
: isPointPlotable(from.x, from.y) && isPointPlotable(to.x, to.y);
|
|
139
|
+
}),
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
return newAnswers;
|
|
143
|
+
}, {});
|
|
144
|
+
};
|