@pie-element/categorize 13.1.0-next.28 → 13.1.1-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/dist/author/defaults.d.ts +223 -0
- package/dist/author/defaults.js +170 -0
- package/dist/author/design/builder.d.ts +10 -0
- package/dist/author/design/builder.js +24 -0
- package/dist/author/design/buttons.d.ts +28 -0
- package/dist/author/design/buttons.js +36 -0
- package/dist/author/design/categories/RowLabel.d.ts +23 -0
- package/dist/author/design/categories/RowLabel.js +47 -0
- package/dist/author/design/categories/alternateResponses.d.ts +31 -0
- package/dist/author/design/categories/alternateResponses.js +62 -0
- package/dist/author/design/categories/category.d.ts +44 -0
- package/dist/author/design/categories/category.js +98 -0
- package/dist/author/design/categories/choice-preview.d.ts +25 -0
- package/dist/author/design/categories/choice-preview.js +60 -0
- package/dist/author/design/categories/droppable-placeholder.d.ts +11 -0
- package/dist/author/design/categories/droppable-placeholder.js +71 -0
- package/dist/author/design/categories/index.d.ts +41 -0
- package/dist/author/design/categories/index.js +146 -0
- package/dist/author/design/choices/choice.d.ts +11 -0
- package/dist/author/design/choices/choice.js +129 -0
- package/dist/author/design/choices/config.d.ts +21 -0
- package/dist/author/design/choices/config.js +33 -0
- package/dist/author/design/choices/index.d.ts +41 -0
- package/dist/author/design/choices/index.js +110 -0
- package/dist/author/design/header.d.ts +24 -0
- package/dist/author/design/header.js +49 -0
- package/dist/author/design/index.d.ts +52 -0
- package/dist/author/design/index.js +417 -0
- package/dist/author/design/input-header.d.ts +39 -0
- package/dist/author/design/input-header.js +69 -0
- package/dist/author/design/utils.d.ts +9 -0
- package/dist/author/design/utils.js +7 -0
- package/dist/author/index.d.ts +51 -0
- package/dist/author/index.js +87 -0
- package/dist/author/main.d.ts +23 -0
- package/dist/author/main.js +30 -0
- package/dist/author/utils.d.ts +16 -0
- package/dist/author/utils.js +17 -0
- package/dist/controller/defaults.d.ts +34 -0
- package/dist/controller/defaults.js +29 -0
- package/dist/controller/index.d.ts +61 -0
- package/dist/controller/index.js +155 -0
- package/dist/controller/utils.d.ts +20 -0
- package/dist/controller/utils.js +35 -0
- package/dist/delivery/categorize/categories.d.ts +34 -0
- package/dist/delivery/categorize/categories.js +66 -0
- package/dist/delivery/categorize/category.d.ts +28 -0
- package/dist/delivery/categorize/category.js +48 -0
- package/dist/delivery/categorize/choice.d.ts +27 -0
- package/dist/delivery/categorize/choice.js +94 -0
- package/dist/delivery/categorize/choices.d.ts +39 -0
- package/dist/delivery/categorize/choices.js +51 -0
- package/dist/delivery/categorize/droppable-placeholder.d.ts +32 -0
- package/dist/delivery/categorize/droppable-placeholder.js +64 -0
- package/dist/delivery/categorize/grid-content.d.ts +25 -0
- package/dist/delivery/categorize/grid-content.js +39 -0
- package/dist/delivery/categorize/index.d.ts +57 -0
- package/dist/delivery/categorize/index.js +260 -0
- package/dist/delivery/index.d.ts +27 -0
- package/dist/delivery/index.js +152 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +152 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
- package/package.json +52 -16
- package/CHANGELOG.json +0 -1637
- package/CHANGELOG.md +0 -2524
- package/LICENSE.md +0 -5
- package/README.md +0 -5
- package/configure/CHANGELOG.json +0 -1202
- package/configure/CHANGELOG.md +0 -2107
- package/configure/lib/defaults.js +0 -222
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/design/builder.js +0 -55
- package/configure/lib/design/builder.js.map +0 -1
- package/configure/lib/design/buttons.js +0 -59
- package/configure/lib/design/buttons.js.map +0 -1
- package/configure/lib/design/categories/RowLabel.js +0 -66
- package/configure/lib/design/categories/RowLabel.js.map +0 -1
- package/configure/lib/design/categories/alternateResponses.js +0 -116
- package/configure/lib/design/categories/alternateResponses.js.map +0 -1
- package/configure/lib/design/categories/category.js +0 -153
- package/configure/lib/design/categories/category.js.map +0 -1
- package/configure/lib/design/categories/choice-preview.js +0 -79
- package/configure/lib/design/categories/choice-preview.js.map +0 -1
- package/configure/lib/design/categories/droppable-placeholder.js +0 -93
- package/configure/lib/design/categories/droppable-placeholder.js.map +0 -1
- package/configure/lib/design/categories/index.js +0 -256
- package/configure/lib/design/categories/index.js.map +0 -1
- package/configure/lib/design/choices/choice.js +0 -187
- package/configure/lib/design/choices/choice.js.map +0 -1
- package/configure/lib/design/choices/config.js +0 -58
- package/configure/lib/design/choices/config.js.map +0 -1
- package/configure/lib/design/choices/index.js +0 -197
- package/configure/lib/design/choices/index.js.map +0 -1
- package/configure/lib/design/header.js +0 -71
- package/configure/lib/design/header.js.map +0 -1
- package/configure/lib/design/index.js +0 -727
- package/configure/lib/design/index.js.map +0 -1
- package/configure/lib/design/input-header.js +0 -105
- package/configure/lib/design/input-header.js.map +0 -1
- package/configure/lib/design/utils.js +0 -12
- package/configure/lib/design/utils.js.map +0 -1
- package/configure/lib/index.js +0 -147
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -44
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/utils.js +0 -43
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -32
- package/controller/CHANGELOG.json +0 -452
- package/controller/CHANGELOG.md +0 -1366
- package/controller/lib/defaults.js +0 -33
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -479
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -69
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -18
- package/docs/config-schema.json +0 -2897
- package/docs/config-schema.json.md +0 -2138
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -357
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -12
- package/docs/pie-schema.json +0 -1784
- package/docs/pie-schema.json.md +0 -1046
- package/lib/categorize/categories.js +0 -135
- package/lib/categorize/categories.js.map +0 -1
- package/lib/categorize/category.js +0 -67
- package/lib/categorize/category.js.map +0 -1
- package/lib/categorize/choice.js +0 -140
- package/lib/categorize/choice.js.map +0 -1
- package/lib/categorize/choices.js +0 -99
- package/lib/categorize/choices.js.map +0 -1
- package/lib/categorize/droppable-placeholder.js +0 -84
- package/lib/categorize/droppable-placeholder.js.map +0 -1
- package/lib/categorize/grid-content.js +0 -55
- package/lib/categorize/grid-content.js.map +0 -1
- package/lib/categorize/index.js +0 -450
- package/lib/categorize/index.js.map +0 -1
- package/lib/index.js +0 -316
- package/lib/index.js.map +0 -1
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
import { getPluginProps as e } from "./utils.js";
|
|
2
|
+
import t from "./categories/choice-preview.js";
|
|
3
|
+
import n from "./header.js";
|
|
4
|
+
import { getMaxCategoryChoices as r, multiplePlacements as i } from "../utils.js";
|
|
5
|
+
import a from "./categories/index.js";
|
|
6
|
+
import o from "./categories/alternateResponses.js";
|
|
7
|
+
import s from "./choices/choice.js";
|
|
8
|
+
import c from "./choices/index.js";
|
|
9
|
+
import { buildAlternateResponses as l, buildCategories as u } from "./builder.js";
|
|
10
|
+
import d from "react";
|
|
11
|
+
import { renderMath as f } from "@pie-element/shared-math-rendering-mathjax";
|
|
12
|
+
import p from "prop-types";
|
|
13
|
+
import { styled as m } from "@mui/material/styles";
|
|
14
|
+
import { DragOverlay as ee } from "@dnd-kit/core";
|
|
15
|
+
import { countInAnswer as h, ensureNoExtraChoicesInAlternate as g, ensureNoExtraChoicesInAnswer as _, moveChoiceToAlternate as v, moveChoiceToCategory as y, removeChoiceFromAlternate as b, removeChoiceFromCategory as x, verifyAllowMultiplePlacements as S } from "@pie-lib/categorize";
|
|
16
|
+
import { DragProvider as te, uid as C } from "@pie-lib/drag";
|
|
17
|
+
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
18
|
+
import E from "@pie-lib/translator";
|
|
19
|
+
import { AlertDialog as ne, FeedbackConfig as re, InputContainer as D, layout as ie, settings as O } from "@pie-lib/config-ui";
|
|
20
|
+
import k from "@pie-lib/editable-html-tip-tap";
|
|
21
|
+
//#region src/author/design/index.tsx
|
|
22
|
+
var { translator: ae } = E, { dropdown: A, Panel: oe, toggle: j, radio: M, numberField: N } = O, { Provider: se } = C, ce = class extends d.Component {
|
|
23
|
+
containerRef = d.createRef();
|
|
24
|
+
componentDidMount() {
|
|
25
|
+
this.containerRef.current && setTimeout(() => f(this.containerRef.current), 0);
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return /* @__PURE__ */ w("div", {
|
|
29
|
+
ref: this.containerRef,
|
|
30
|
+
children: this.props.children
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}, P = m(n)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), F = m(D)(({ theme: e }) => ({
|
|
34
|
+
width: "100%",
|
|
35
|
+
paddingTop: e.spacing(1),
|
|
36
|
+
marginTop: e.spacing(1),
|
|
37
|
+
marginBottom: e.spacing(2)
|
|
38
|
+
})), I = m("div")(({ theme: e }) => ({
|
|
39
|
+
fontSize: e.typography.fontSize - 2,
|
|
40
|
+
color: e.palette.error.main,
|
|
41
|
+
paddingTop: e.spacing(1)
|
|
42
|
+
})), L = class extends d.Component {
|
|
43
|
+
static propTypes = {
|
|
44
|
+
configuration: p.object,
|
|
45
|
+
className: p.string,
|
|
46
|
+
onConfigurationChanged: p.func,
|
|
47
|
+
model: p.object.isRequired,
|
|
48
|
+
onChange: p.func.isRequired,
|
|
49
|
+
uid: p.string,
|
|
50
|
+
imageSupport: p.shape({
|
|
51
|
+
add: p.func.isRequired,
|
|
52
|
+
delete: p.func.isRequired
|
|
53
|
+
}),
|
|
54
|
+
uploadSoundSupport: p.shape({
|
|
55
|
+
add: p.func.isRequired,
|
|
56
|
+
delete: p.func.isRequired
|
|
57
|
+
})
|
|
58
|
+
};
|
|
59
|
+
constructor(e) {
|
|
60
|
+
super(e), this.uid = e.uid || C.generateId(), this.state = { activeDragItem: null };
|
|
61
|
+
}
|
|
62
|
+
updateModel = (e) => {
|
|
63
|
+
let { model: t, onChange: n } = this.props, r = {
|
|
64
|
+
...t,
|
|
65
|
+
...e
|
|
66
|
+
};
|
|
67
|
+
r.choices = r.choices.map((e) => ({
|
|
68
|
+
...e,
|
|
69
|
+
categoryCount: this.checkAllowMultiplePlacements(r.allowMultiplePlacementsEnabled, e)
|
|
70
|
+
})), r.correctResponse = _(r.correctResponse || [], r.choices), r.correctResponse = g(r.correctResponse || [], r.choices), r.categories = r.categories.map((e) => ({
|
|
71
|
+
id: e.id,
|
|
72
|
+
label: e.label
|
|
73
|
+
})), r.choices = r.choices.map((e) => ({
|
|
74
|
+
id: e.id,
|
|
75
|
+
content: e.content,
|
|
76
|
+
categoryCount: e.categoryCount
|
|
77
|
+
})), r.maxChoicesPerCategory = r.allowMaxChoicesPerCategory ? r.maxChoicesPerCategory : 0, n(r);
|
|
78
|
+
};
|
|
79
|
+
changeRationale = (e) => {
|
|
80
|
+
let { model: t, onChange: n } = this.props;
|
|
81
|
+
n({
|
|
82
|
+
...t,
|
|
83
|
+
rationale: e
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
changeTeacherInstructions = (e) => {
|
|
87
|
+
let { model: t, onChange: n } = this.props;
|
|
88
|
+
n({
|
|
89
|
+
...t,
|
|
90
|
+
teacherInstructions: e
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
changeFeedback = (e) => {
|
|
94
|
+
this.updateModel({ feedback: e });
|
|
95
|
+
};
|
|
96
|
+
onAddAlternateResponse = () => {
|
|
97
|
+
let { model: { correctResponse: e } } = this.props;
|
|
98
|
+
this.updateModel({ correctResponse: (e || []).map((e) => ({
|
|
99
|
+
...e,
|
|
100
|
+
alternateResponses: [...e.alternateResponses || [], []]
|
|
101
|
+
})) });
|
|
102
|
+
};
|
|
103
|
+
onPromptChanged = (e) => this.updateModel({ prompt: e });
|
|
104
|
+
onRemoveAlternateResponse = (e) => {
|
|
105
|
+
let { model: { correctResponse: t } } = this.props;
|
|
106
|
+
this.updateModel({ correctResponse: (t || []).map((t) => ({
|
|
107
|
+
...t,
|
|
108
|
+
alternateResponses: (t.alternateResponses || []).filter((t, n) => n !== e)
|
|
109
|
+
})) });
|
|
110
|
+
};
|
|
111
|
+
countChoiceInCorrectResponse = (e) => {
|
|
112
|
+
let { model: t } = this.props;
|
|
113
|
+
return h(e.id, t.correctResponse);
|
|
114
|
+
};
|
|
115
|
+
checkAllowMultiplePlacements = (e, t) => e === i.enabled ? 0 : e === i.disabled ? 1 : t.categoryCount || 0;
|
|
116
|
+
isAlertModalOpened = () => {
|
|
117
|
+
let { model: e } = this.props, { maxChoicesPerCategory: t = 0 } = e || {}, n = r(e);
|
|
118
|
+
return t === 0 ? !1 : n > t;
|
|
119
|
+
};
|
|
120
|
+
onAlertModalCancel = () => {
|
|
121
|
+
let { model: e } = this.props, t = r(e);
|
|
122
|
+
this.updateModel({ maxChoicesPerCategory: t });
|
|
123
|
+
};
|
|
124
|
+
onDragStart = (e) => {
|
|
125
|
+
let { active: t } = e, n = t.data.current;
|
|
126
|
+
this.setState({ activeDragItem: n });
|
|
127
|
+
};
|
|
128
|
+
onDragEnd = ({ active: e, over: t }) => {
|
|
129
|
+
let n = window.scrollX, r = window.scrollY;
|
|
130
|
+
if (this.setState({ activeDragItem: null }), !e) return;
|
|
131
|
+
requestAnimationFrame(() => {
|
|
132
|
+
requestAnimationFrame(() => {
|
|
133
|
+
window.scrollTo(n, r);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
let { model: i } = this.props, { allowAlternateEnabled: a, categories: o = [], choices: s = [] } = i, c = e?.data?.current, l = t?.data?.current;
|
|
137
|
+
if (!c) return;
|
|
138
|
+
let u = c.choiceIndex || 0, d = l?.type, f = c.type === "choice-preview", p = c.type === "choice", m = c.choice?.id || (typeof c.id == "string" ? c.id.split("-")[0] : c.id);
|
|
139
|
+
if (f && (!l || d === "choice")) {
|
|
140
|
+
this.removeChoiceFromSource(c, u, {
|
|
141
|
+
allowAlternateEnabled: a,
|
|
142
|
+
categories: o,
|
|
143
|
+
choices: s
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (f && d === "category") return this.moveChoice(m, c.categoryId, l.id, u);
|
|
148
|
+
if (p && d === "category") return this.addChoiceToCategory({ id: c.id }, l.id);
|
|
149
|
+
if (f && d === "category-alternate") return this.moveChoiceInAlternate(m, c.categoryId, l.id, u, l.alternateResponseIndex);
|
|
150
|
+
if (a && p && d === "category-alternate") return this.addChoiceToAlternateCategory({ id: c.id }, l.id, l.alternateResponseIndex);
|
|
151
|
+
};
|
|
152
|
+
removeChoiceFromSource = (e, t, { allowAlternateEnabled: n, categories: r, choices: i }) => {
|
|
153
|
+
if (e.alternateResponseIndex === void 0) {
|
|
154
|
+
this.deleteChoiceFromCategory(e.categoryId, e.choiceId, t);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (!n) return;
|
|
158
|
+
let a = r?.find((t) => t.id === e.categoryId), o = i?.find((t) => t.id === e.choiceId);
|
|
159
|
+
a && o && this.deleteChoiceFromAlternateCategory(a, o, t, e.alternateResponseIndex);
|
|
160
|
+
};
|
|
161
|
+
addChoiceToCategory = (e, t) => {
|
|
162
|
+
let { model: n } = this.props, { choices: i = [], correctResponse: a = [], maxChoicesPerCategory: o = 0 } = n || {}, s = (i || []).find((t) => t.id === e.id), c = y(e.id, void 0, t, 0, a);
|
|
163
|
+
s.categoryCount !== 0 && (c = S(e, t, c));
|
|
164
|
+
let l = r(n);
|
|
165
|
+
this.updateModel({
|
|
166
|
+
correctResponse: c,
|
|
167
|
+
maxChoicesPerCategory: o !== 0 && o < l ? o + 1 : o
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
deleteChoiceFromCategory = (e, t, n) => {
|
|
171
|
+
let { model: r } = this.props, i = x(t, e, n, r.correctResponse);
|
|
172
|
+
this.updateModel({ correctResponse: i });
|
|
173
|
+
};
|
|
174
|
+
moveChoice = (e, t, n, i) => {
|
|
175
|
+
let { model: a } = this.props, { choices: o, correctResponse: s = [], maxChoicesPerCategory: c = 0 } = a || {}, l = (o || []).find((t) => t.id === e);
|
|
176
|
+
if (n === t || !l) return;
|
|
177
|
+
l.categoryCount === 0 ? l.categoryCount === 0 && (s = y(l.id, void 0, n, 0, s)) : (s = y(l.id, t, n, i, s), s = S(l, n, s));
|
|
178
|
+
let u = r(a);
|
|
179
|
+
this.updateModel({
|
|
180
|
+
correctResponse: s,
|
|
181
|
+
maxChoicesPerCategory: c !== 0 && c < u ? c + 1 : c
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
addChoiceToAlternateCategory = (e, t, n) => {
|
|
185
|
+
let { model: i } = this.props, { correctResponse: a, choices: o, maxChoicesPerCategory: s = 0 } = i, c = o.find((t) => t.id === e.id);
|
|
186
|
+
a.forEach((r) => r.category === t ? (r.alternateResponses = r.alternateResponses || [], r.alternateResponses[n] === void 0 && (r.alternateResponses[n] = []), r.alternateResponses[n].push(e.id), c.categoryCount && c.categoryCount !== 0 && (r.alternateResponses[n] = r.alternateResponses[n].reduce((e, t) => (t === c.id ? e.findIndex((e) => e === c.id) === -1 && e.push(t) : e.push(t), e), [])), r) : (r.alternateResponses[n] && c.categoryCount !== 0 && (r.alternateResponses[n] = r.alternateResponses[n].filter((t) => t !== e.id)), r));
|
|
187
|
+
let l = r(i);
|
|
188
|
+
this.updateModel({
|
|
189
|
+
correctResponse: a,
|
|
190
|
+
maxChoicesPerCategory: s !== 0 && s < l ? s + 1 : s
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
moveChoiceInAlternate = (e, t, n, i, a) => {
|
|
194
|
+
let { model: o } = this.props, { choices: s, correctResponse: c = [], maxChoicesPerCategory: l = 0 } = o || {}, u = (s || []).find((t) => t.id === e);
|
|
195
|
+
c = v(e, t, n, i, c, a, u?.categoryCount);
|
|
196
|
+
let d = r(o);
|
|
197
|
+
this.updateModel({
|
|
198
|
+
correctResponse: c,
|
|
199
|
+
maxChoicesPerCategory: l !== 0 && l < d ? l + 1 : l
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
deleteChoiceFromAlternateCategory = (e, t, n, r) => {
|
|
203
|
+
let { model: i } = this.props, a = b(t.id, e.id, n, r, i.correctResponse);
|
|
204
|
+
this.updateModel({ correctResponse: a });
|
|
205
|
+
};
|
|
206
|
+
renderDragOverlay = () => {
|
|
207
|
+
let { activeDragItem: e } = this.state, { model: n, configuration: r } = this.props;
|
|
208
|
+
if (!e) return null;
|
|
209
|
+
if (e.type === "choice") {
|
|
210
|
+
let t = n.choices?.find((t) => t.id === e.id);
|
|
211
|
+
return t ? /* @__PURE__ */ w(s, {
|
|
212
|
+
choice: t,
|
|
213
|
+
configuration: r
|
|
214
|
+
}) : null;
|
|
215
|
+
} else if (e.type === "choice-preview" && e.alternateResponseIndex === void 0) {
|
|
216
|
+
let r = n.choices?.find((t) => t.id === e.id);
|
|
217
|
+
return r ? /* @__PURE__ */ w(t, { choice: r }) : null;
|
|
218
|
+
} else if (e.type === "choice-preview" && e.alternateResponseIndex !== void 0) {
|
|
219
|
+
let r = n.choices?.find((t) => t.id === e.id);
|
|
220
|
+
return r ? /* @__PURE__ */ w(t, {
|
|
221
|
+
choice: r,
|
|
222
|
+
alternateResponseIndex: e.alternateResponseIndex
|
|
223
|
+
}) : null;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
};
|
|
227
|
+
render() {
|
|
228
|
+
let { configuration: t, imageSupport: n, model: r, uploadSoundSupport: s, onConfigurationChanged: f } = this.props, { allowAlternate: p = {}, allowMultiplePlacements: m = {}, baseInputConfiguration: h = {}, categoriesPerRow: g = {}, choicesPosition: _ = {}, contentDimensions: v = {}, feedback: y = {}, lockChoiceOrder: b = {}, maxImageHeight: x = {}, maxImageWidth: S = {}, maxPlacements: C = {}, minCategoriesPerRow: E = 1, partialScoring: D = {}, prompt: O = {}, rationale: L = {}, scoringType: R = {}, settingsPanelDisabled: le, spellCheck: z = {}, studentInstructions: B = {}, teacherInstructions: V = {}, withRubric: H = {}, mathMlOptions: U = {}, language: W = {}, languageChoices: G = {}, allowMaxAnswerChoices: K = {} } = t || {}, { allowAlternateEnabled: ue, allowMaxChoicesPerCategory: de, errors: fe, feedbackEnabled: pe, maxChoicesPerCategory: me, promptEnabled: he, rationaleEnabled: ge, spellCheckEnabled: q, teacherInstructionsEnabled: _e, toolbarEditorPosition: ve, extraCSSRules: ye } = r || {}, { prompt: J, rationale: Y, teacherInstructions: X } = fe || {}, Z = { position: ve === "top" ? "top" : "bottom" }, be = r.config || {};
|
|
229
|
+
be.choices = be.choices || {
|
|
230
|
+
label: "",
|
|
231
|
+
columns: 2
|
|
232
|
+
};
|
|
233
|
+
let xe = u(r.categories || [], r.choices || [], r.correctResponse || []), Se = l(r.categories || [], r.choices || [], r.correctResponse || []), Ce = r.choices.map((e) => (e.correctResponseCount = this.countChoiceInCorrectResponse(e), e.categoryCount = this.checkAllowMultiplePlacements(r.allowMultiplePlacementsEnabled, e), e)), Q = S && S.prompt, $ = x && x.prompt, we = {
|
|
234
|
+
partialScoring: D.settings && j(D.label),
|
|
235
|
+
lockChoiceOrder: b.settings && j(b.label),
|
|
236
|
+
categoriesPerRow: g.settings && N(g.label, {
|
|
237
|
+
label: g.label,
|
|
238
|
+
min: E,
|
|
239
|
+
max: 6
|
|
240
|
+
}),
|
|
241
|
+
choicesPosition: _.settings && M(_.label, [
|
|
242
|
+
"below",
|
|
243
|
+
"above",
|
|
244
|
+
"left",
|
|
245
|
+
"right"
|
|
246
|
+
]),
|
|
247
|
+
allowMultiplePlacementsEnabled: m.settings && A(m.label, [
|
|
248
|
+
i.enabled,
|
|
249
|
+
i.disabled,
|
|
250
|
+
i.perChoice
|
|
251
|
+
]),
|
|
252
|
+
maxAnswerChoices: K.settings && N(K.label, {
|
|
253
|
+
label: "",
|
|
254
|
+
min: Ce?.length || 0,
|
|
255
|
+
max: 30
|
|
256
|
+
}),
|
|
257
|
+
allowMaxChoicesPerCategory: C.settings && j(C.label),
|
|
258
|
+
maxChoicesPerCategory: de === !0 && N(C.label, {
|
|
259
|
+
label: "",
|
|
260
|
+
min: 0,
|
|
261
|
+
max: 30
|
|
262
|
+
}),
|
|
263
|
+
promptEnabled: O.settings && j(O.label),
|
|
264
|
+
feedbackEnabled: y.settings && j(y.label),
|
|
265
|
+
allowAlternateEnabled: p.settings && j(p.label),
|
|
266
|
+
"language.enabled": W.settings && j(W.label, !0),
|
|
267
|
+
language: W.settings && W.enabled && A(G.label, G.options)
|
|
268
|
+
}, Te = {
|
|
269
|
+
teacherInstructionsEnabled: V.settings && j(V.label),
|
|
270
|
+
studentInstructionsEnabled: B.settings && j(B.label),
|
|
271
|
+
rationaleEnabled: L.settings && j(L.label),
|
|
272
|
+
spellCheckEnabled: z.settings && j(z.label),
|
|
273
|
+
scoringType: R.settings && M(R.label, ["auto", "rubric"]),
|
|
274
|
+
rubricEnabled: H?.settings && j(H?.label)
|
|
275
|
+
}, Ee = this.isAlertModalOpened(), De = ae.t("translation:categorize:maxChoicesPerCategoryRestriction", {
|
|
276
|
+
lng: r.language,
|
|
277
|
+
maxChoicesPerCategory: me
|
|
278
|
+
});
|
|
279
|
+
return /* @__PURE__ */ w(te, {
|
|
280
|
+
onDragStart: this.onDragStart,
|
|
281
|
+
onDragEnd: this.onDragEnd,
|
|
282
|
+
children: /* @__PURE__ */ T(se, {
|
|
283
|
+
value: this.uid,
|
|
284
|
+
children: [/* @__PURE__ */ T(ie.ConfigLayout, {
|
|
285
|
+
extraCSSRules: ye,
|
|
286
|
+
dimensions: v,
|
|
287
|
+
hideSettings: le,
|
|
288
|
+
settings: /* @__PURE__ */ w(oe, {
|
|
289
|
+
model: r,
|
|
290
|
+
onChangeModel: this.updateModel,
|
|
291
|
+
configuration: t,
|
|
292
|
+
onChangeConfiguration: f,
|
|
293
|
+
groups: {
|
|
294
|
+
Settings: we,
|
|
295
|
+
Properties: Te
|
|
296
|
+
},
|
|
297
|
+
modal: /* @__PURE__ */ w(ne, {
|
|
298
|
+
title: "Warning",
|
|
299
|
+
text: De,
|
|
300
|
+
open: Ee,
|
|
301
|
+
onClose: this.onAlertModalCancel
|
|
302
|
+
})
|
|
303
|
+
}),
|
|
304
|
+
children: [
|
|
305
|
+
_e && /* @__PURE__ */ T(F, {
|
|
306
|
+
label: V.label,
|
|
307
|
+
children: [/* @__PURE__ */ w(k, {
|
|
308
|
+
markup: r.teacherInstructions || "",
|
|
309
|
+
onChange: this.changeTeacherInstructions,
|
|
310
|
+
imageSupport: n,
|
|
311
|
+
error: X,
|
|
312
|
+
nonEmpty: !1,
|
|
313
|
+
toolbarOpts: Z,
|
|
314
|
+
pluginProps: e(V?.inputConfiguration, h),
|
|
315
|
+
spellCheck: q,
|
|
316
|
+
maxImageWidth: S && S.teacherInstructions || Q,
|
|
317
|
+
maxImageHeight: x && x.teacherInstructions || $,
|
|
318
|
+
uploadSoundSupport: s,
|
|
319
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
320
|
+
mathMlOptions: U
|
|
321
|
+
}), X && /* @__PURE__ */ w(I, { children: X })]
|
|
322
|
+
}),
|
|
323
|
+
he && /* @__PURE__ */ T(F, {
|
|
324
|
+
label: O.label,
|
|
325
|
+
children: [/* @__PURE__ */ w(k, {
|
|
326
|
+
markup: r.prompt || "",
|
|
327
|
+
onChange: this.onPromptChanged,
|
|
328
|
+
imageSupport: n,
|
|
329
|
+
error: J,
|
|
330
|
+
nonEmpty: !1,
|
|
331
|
+
disableUnderline: !0,
|
|
332
|
+
toolbarOpts: Z,
|
|
333
|
+
pluginProps: e(O?.inputConfiguration, h),
|
|
334
|
+
spellCheck: q,
|
|
335
|
+
maxImageWidth: S && S.prompt,
|
|
336
|
+
maxImageHeight: x && x.prompt,
|
|
337
|
+
uploadSoundSupport: s,
|
|
338
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
339
|
+
mathMlOptions: U
|
|
340
|
+
}), J && /* @__PURE__ */ w(I, { children: J })]
|
|
341
|
+
}),
|
|
342
|
+
/* @__PURE__ */ w(a, {
|
|
343
|
+
imageSupport: n,
|
|
344
|
+
uploadSoundSupport: s,
|
|
345
|
+
model: r,
|
|
346
|
+
categories: xe || [],
|
|
347
|
+
onModelChanged: this.updateModel,
|
|
348
|
+
toolbarOpts: Z,
|
|
349
|
+
spellCheck: q,
|
|
350
|
+
configuration: t,
|
|
351
|
+
defaultImageMaxWidth: Q,
|
|
352
|
+
defaultImageMaxHeight: $,
|
|
353
|
+
mathMlOptions: U
|
|
354
|
+
}),
|
|
355
|
+
/* @__PURE__ */ w(c, {
|
|
356
|
+
imageSupport: n,
|
|
357
|
+
uploadSoundSupport: s,
|
|
358
|
+
choices: Ce,
|
|
359
|
+
model: r,
|
|
360
|
+
onModelChanged: this.updateModel,
|
|
361
|
+
toolbarOpts: Z,
|
|
362
|
+
spellCheck: q,
|
|
363
|
+
configuration: t,
|
|
364
|
+
defaultImageMaxWidth: Q,
|
|
365
|
+
defaultImageMaxHeight: $
|
|
366
|
+
}),
|
|
367
|
+
ue && /* @__PURE__ */ w(P, {
|
|
368
|
+
label: "Alternate Responses",
|
|
369
|
+
buttonLabel: "ADD AN ALTERNATE RESPONSE",
|
|
370
|
+
onAdd: this.onAddAlternateResponse
|
|
371
|
+
}),
|
|
372
|
+
ue && Se.map((e, i) => /* @__PURE__ */ T(d.Fragment, { children: [/* @__PURE__ */ w(P, {
|
|
373
|
+
variant: "subtitle1",
|
|
374
|
+
label: "Alternate Response",
|
|
375
|
+
buttonLabel: "REMOVE ALTERNATE RESPONSE",
|
|
376
|
+
onAdd: () => this.onRemoveAlternateResponse(i)
|
|
377
|
+
}), /* @__PURE__ */ w(o, {
|
|
378
|
+
altIndex: i,
|
|
379
|
+
imageSupport: n,
|
|
380
|
+
model: r,
|
|
381
|
+
configuration: t,
|
|
382
|
+
categories: e,
|
|
383
|
+
onModelChanged: this.updateModel,
|
|
384
|
+
uploadSoundSupport: s,
|
|
385
|
+
mathMlOptions: U
|
|
386
|
+
})] }, i)),
|
|
387
|
+
ge && /* @__PURE__ */ T(F, {
|
|
388
|
+
label: L.label,
|
|
389
|
+
children: [/* @__PURE__ */ w(k, {
|
|
390
|
+
markup: r.rationale || "",
|
|
391
|
+
onChange: this.changeRationale,
|
|
392
|
+
imageSupport: n,
|
|
393
|
+
error: Y,
|
|
394
|
+
nonEmpty: !1,
|
|
395
|
+
toolbarOpts: Z,
|
|
396
|
+
pluginProps: e(O?.inputConfiguration, h),
|
|
397
|
+
spellCheck: q,
|
|
398
|
+
maxImageWidth: S && S.rationale || Q,
|
|
399
|
+
maxImageHeight: x && x.rationale || $,
|
|
400
|
+
uploadSoundSupport: s,
|
|
401
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
402
|
+
mathMlOptions: U
|
|
403
|
+
}), Y && /* @__PURE__ */ w(I, { children: Y })]
|
|
404
|
+
}),
|
|
405
|
+
pe && /* @__PURE__ */ w(re, {
|
|
406
|
+
feedback: r.feedback,
|
|
407
|
+
onChange: this.changeFeedback,
|
|
408
|
+
toolbarOpts: Z
|
|
409
|
+
})
|
|
410
|
+
]
|
|
411
|
+
}), /* @__PURE__ */ w(ee, { children: /* @__PURE__ */ w(ce, { children: this.renderDragOverlay() }) })]
|
|
412
|
+
})
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
//#endregion
|
|
417
|
+
export { L as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/categorize/configure/src/design/input-header.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class InputHeader extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
configuration: PropTypes.Validator<object>;
|
|
14
|
+
deleteFocusedEl: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
16
|
+
focusedEl: PropTypes.Requireable<number>;
|
|
17
|
+
index: PropTypes.Requireable<number>;
|
|
18
|
+
label: PropTypes.Requireable<string>;
|
|
19
|
+
maxImageWidth: PropTypes.Requireable<object>;
|
|
20
|
+
maxImageHeight: PropTypes.Requireable<object>;
|
|
21
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
onDelete: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
24
|
+
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
+
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
26
|
+
}>>;
|
|
27
|
+
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
28
|
+
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
29
|
+
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
30
|
+
}>>;
|
|
31
|
+
toolbarOpts: PropTypes.Requireable<object>;
|
|
32
|
+
error: PropTypes.Requireable<string>;
|
|
33
|
+
spellCheck: PropTypes.Requireable<boolean>;
|
|
34
|
+
};
|
|
35
|
+
static defaultProps: {};
|
|
36
|
+
constructor(props: any);
|
|
37
|
+
render(): React.JSX.Element;
|
|
38
|
+
}
|
|
39
|
+
export default InputHeader;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getPluginProps as e } from "./utils.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import a from "@pie-lib/editable-html-tip-tap";
|
|
7
|
+
//#region src/author/design/input-header.tsx
|
|
8
|
+
var o = r(a)({
|
|
9
|
+
flex: "1",
|
|
10
|
+
maxWidth: "100%"
|
|
11
|
+
}), s = r("div")(({ theme: e }) => ({
|
|
12
|
+
display: "flex",
|
|
13
|
+
justifyContent: "space-between",
|
|
14
|
+
paddingBottom: e.spacing(1)
|
|
15
|
+
})), c = class extends t.Component {
|
|
16
|
+
static propTypes = {
|
|
17
|
+
configuration: n.object.isRequired,
|
|
18
|
+
deleteFocusedEl: n.func,
|
|
19
|
+
disabled: n.bool,
|
|
20
|
+
focusedEl: n.number,
|
|
21
|
+
index: n.number,
|
|
22
|
+
label: n.string,
|
|
23
|
+
maxImageWidth: n.object,
|
|
24
|
+
maxImageHeight: n.object,
|
|
25
|
+
onChange: n.func,
|
|
26
|
+
onDelete: n.func,
|
|
27
|
+
imageSupport: n.shape({
|
|
28
|
+
add: n.func.isRequired,
|
|
29
|
+
delete: n.func.isRequired
|
|
30
|
+
}),
|
|
31
|
+
uploadSoundSupport: n.shape({
|
|
32
|
+
add: n.func.isRequired,
|
|
33
|
+
delete: n.func.isRequired
|
|
34
|
+
}),
|
|
35
|
+
toolbarOpts: n.object,
|
|
36
|
+
error: n.string,
|
|
37
|
+
spellCheck: n.bool
|
|
38
|
+
};
|
|
39
|
+
static defaultProps = {};
|
|
40
|
+
constructor(e) {
|
|
41
|
+
super(e);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
let { onChange: t, configuration: n, label: r, deleteFocusedEl: a, disabled: c, imageSupport: l, toolbarOpts: u, spellCheck: d, error: f, maxImageWidth: p, maxImageHeight: m, uploadSoundSupport: h, mathMlOptions: g = {}, focusedEl: _, index: v } = this.props, { headers: y, baseInputConfiguration: b } = n;
|
|
45
|
+
return /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(o, {
|
|
46
|
+
imageSupport: l,
|
|
47
|
+
disabled: c,
|
|
48
|
+
autoFocus: _ != null && _ === v,
|
|
49
|
+
autoWidthToolbar: !0,
|
|
50
|
+
label: "label",
|
|
51
|
+
markup: r,
|
|
52
|
+
onChange: t,
|
|
53
|
+
pluginProps: e(y?.inputConfiguration, b),
|
|
54
|
+
toolbarOpts: u,
|
|
55
|
+
spellCheck: d,
|
|
56
|
+
error: f,
|
|
57
|
+
maxImageWidth: p,
|
|
58
|
+
maxImageHeight: m,
|
|
59
|
+
uploadSoundSupport: h,
|
|
60
|
+
languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
|
|
61
|
+
onDone: () => {
|
|
62
|
+
a && a();
|
|
63
|
+
},
|
|
64
|
+
mathMlOptions: g
|
|
65
|
+
}) });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { c as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/categorize/configure/src/design/utils.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getPluginProps: (props?: {}, baseInputConfiguration?: {}) => {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/categorize/configure/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export default class CategorizeConfigure extends HTMLElement {
|
|
10
|
+
static createDefaultModel: (model?: {}) => {
|
|
11
|
+
allowAlternateEnabled: boolean;
|
|
12
|
+
allowMaxChoicesPerCategory: boolean;
|
|
13
|
+
allowMultiplePlacementsEnabled: string;
|
|
14
|
+
alternates: never[];
|
|
15
|
+
categories: never[];
|
|
16
|
+
categoriesPerRow: number;
|
|
17
|
+
choices: never[];
|
|
18
|
+
choicesLabel: string;
|
|
19
|
+
choicesPosition: string;
|
|
20
|
+
correctResponse: never[];
|
|
21
|
+
feedbackEnabled: boolean;
|
|
22
|
+
lockChoiceOrder: boolean;
|
|
23
|
+
maxAnswerChoices: number;
|
|
24
|
+
maxChoicesPerCategory: number;
|
|
25
|
+
partialScoring: boolean;
|
|
26
|
+
promptEnabled: boolean;
|
|
27
|
+
rationaleEnabled: boolean;
|
|
28
|
+
rowLabels: string[];
|
|
29
|
+
studentInstructionsEnabled: boolean;
|
|
30
|
+
teacherInstructionsEnabled: boolean;
|
|
31
|
+
toolbarEditorPosition: string;
|
|
32
|
+
minRowHeight: string;
|
|
33
|
+
};
|
|
34
|
+
static disableAlternateResponses: (m: any) => any;
|
|
35
|
+
constructor();
|
|
36
|
+
set model(m: any);
|
|
37
|
+
set configuration(c: any);
|
|
38
|
+
onModelChanged(m: any): void;
|
|
39
|
+
onConfigurationChanged(c: any): void;
|
|
40
|
+
connectedCallback(): void;
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param {done, progress, file} handler
|
|
44
|
+
*/
|
|
45
|
+
insertImage(handler: any): void;
|
|
46
|
+
onDeleteImage(src: any, done: any): void;
|
|
47
|
+
insertSound(handler: any): void;
|
|
48
|
+
onDeleteSound(src: any, done: any): void;
|
|
49
|
+
render(): void;
|
|
50
|
+
disconnectedCallback(): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import e from "./main.js";
|
|
2
|
+
import t from "./defaults.js";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import { createRoot as r } from "react-dom/client";
|
|
5
|
+
import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
+
import { DeleteImageEvent as a, DeleteSoundEvent as o, InsertImageEvent as s, InsertSoundEvent as c, ModelUpdatedEvent as l } from "@pie-element/shared-configure-events";
|
|
7
|
+
//#region src/author/index.ts
|
|
8
|
+
var u = class u extends HTMLElement {
|
|
9
|
+
static createDefaultModel = (e = {}) => ({
|
|
10
|
+
...t.model,
|
|
11
|
+
...e
|
|
12
|
+
});
|
|
13
|
+
static disableAlternateResponses = (e) => {
|
|
14
|
+
let { correctResponse: t } = e || {};
|
|
15
|
+
t ||= [];
|
|
16
|
+
let n = t.map((e) => {
|
|
17
|
+
let { alternateResponses: t, ...n } = e;
|
|
18
|
+
return n;
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
...e,
|
|
22
|
+
correctResponse: n,
|
|
23
|
+
allowAlternateEnabled: !1
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
constructor() {
|
|
27
|
+
super(), this._root = null, this._model = u.createDefaultModel(), this._configuration = t.configuration;
|
|
28
|
+
}
|
|
29
|
+
set model(e) {
|
|
30
|
+
this._model = u.createDefaultModel(e), e.choices && e.choices.length >= e.maxAnswerChoices && (this._model.maxAnswerChoices = e.choices.length, console.warn("Max Answer Choices can't be less than choices length!")), this.render();
|
|
31
|
+
}
|
|
32
|
+
set configuration(e) {
|
|
33
|
+
let n = {
|
|
34
|
+
...t.configuration,
|
|
35
|
+
...e
|
|
36
|
+
};
|
|
37
|
+
this._configuration = n, n?.language?.enabled ? n?.languageChoices?.options?.length && (this._model.language = n?.languageChoices.options[0].value) : n.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
|
|
38
|
+
value: this._model.language,
|
|
39
|
+
label: this._model.language
|
|
40
|
+
})) : delete this._model.language, this.render();
|
|
41
|
+
}
|
|
42
|
+
onModelChanged(e) {
|
|
43
|
+
this._model = e, this.render(), this.dispatchEvent(new l(this._model, !1));
|
|
44
|
+
}
|
|
45
|
+
onConfigurationChanged(e) {
|
|
46
|
+
this._configuration = e, this.render();
|
|
47
|
+
}
|
|
48
|
+
connectedCallback() {
|
|
49
|
+
this.render();
|
|
50
|
+
}
|
|
51
|
+
insertImage(e) {
|
|
52
|
+
this.dispatchEvent(new s(e));
|
|
53
|
+
}
|
|
54
|
+
onDeleteImage(e, t) {
|
|
55
|
+
this.dispatchEvent(new a(e, t));
|
|
56
|
+
}
|
|
57
|
+
insertSound(e) {
|
|
58
|
+
this.dispatchEvent(new c(e));
|
|
59
|
+
}
|
|
60
|
+
onDeleteSound(e, t) {
|
|
61
|
+
this.dispatchEvent(new o(e, t));
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
let t = n.createElement(e, {
|
|
65
|
+
model: this._model,
|
|
66
|
+
configuration: this._configuration,
|
|
67
|
+
onModelChanged: this.onModelChanged.bind(this),
|
|
68
|
+
onConfigurationChanged: this.onConfigurationChanged.bind(this),
|
|
69
|
+
imageSupport: {
|
|
70
|
+
add: this.insertImage.bind(this),
|
|
71
|
+
delete: this.onDeleteImage.bind(this)
|
|
72
|
+
},
|
|
73
|
+
uploadSoundSupport: {
|
|
74
|
+
add: this.insertSound.bind(this),
|
|
75
|
+
delete: this.onDeleteSound.bind(this)
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
this._root ||= r(this), this._root.render(t), setTimeout(() => {
|
|
79
|
+
i(this);
|
|
80
|
+
}, 0);
|
|
81
|
+
}
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
this._root && this._root.unmount();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { u as default };
|