@pie-element/categorize 13.1.1-next.1 → 13.1.1-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +1637 -0
- package/CHANGELOG.md +2532 -0
- package/LICENSE.md +5 -0
- package/README.md +5 -0
- package/configure/CHANGELOG.json +1202 -0
- package/configure/CHANGELOG.md +2115 -0
- package/configure/lib/defaults.js +222 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/design/builder.js +55 -0
- package/configure/lib/design/builder.js.map +1 -0
- package/configure/lib/design/buttons.js +59 -0
- package/configure/lib/design/buttons.js.map +1 -0
- package/configure/lib/design/categories/RowLabel.js +66 -0
- package/configure/lib/design/categories/RowLabel.js.map +1 -0
- package/configure/lib/design/categories/alternateResponses.js +116 -0
- package/configure/lib/design/categories/alternateResponses.js.map +1 -0
- package/configure/lib/design/categories/category.js +153 -0
- package/configure/lib/design/categories/category.js.map +1 -0
- package/configure/lib/design/categories/choice-preview.js +79 -0
- package/configure/lib/design/categories/choice-preview.js.map +1 -0
- package/configure/lib/design/categories/droppable-placeholder.js +93 -0
- package/configure/lib/design/categories/droppable-placeholder.js.map +1 -0
- package/configure/lib/design/categories/index.js +256 -0
- package/configure/lib/design/categories/index.js.map +1 -0
- package/configure/lib/design/choices/choice.js +187 -0
- package/configure/lib/design/choices/choice.js.map +1 -0
- package/configure/lib/design/choices/config.js +58 -0
- package/configure/lib/design/choices/config.js.map +1 -0
- package/configure/lib/design/choices/index.js +197 -0
- package/configure/lib/design/choices/index.js.map +1 -0
- package/configure/lib/design/header.js +71 -0
- package/configure/lib/design/header.js.map +1 -0
- package/configure/lib/design/index.js +727 -0
- package/configure/lib/design/index.js.map +1 -0
- package/configure/lib/design/input-header.js +105 -0
- package/configure/lib/design/input-header.js.map +1 -0
- package/configure/lib/design/utils.js +12 -0
- package/configure/lib/design/utils.js.map +1 -0
- package/configure/lib/index.js +147 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +44 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/utils.js +43 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +32 -0
- package/controller/CHANGELOG.json +452 -0
- package/controller/CHANGELOG.md +1373 -0
- package/controller/lib/defaults.js +33 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +479 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +69 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +18 -0
- package/docs/config-schema.json +2897 -0
- package/docs/config-schema.json.md +2138 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +357 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +12 -0
- package/docs/pie-schema.json +1784 -0
- package/docs/pie-schema.json.md +1046 -0
- package/lib/categorize/categories.js +135 -0
- package/lib/categorize/categories.js.map +1 -0
- package/lib/categorize/category.js +67 -0
- package/lib/categorize/category.js.map +1 -0
- package/lib/categorize/choice.js +140 -0
- package/lib/categorize/choice.js.map +1 -0
- package/lib/categorize/choices.js +99 -0
- package/lib/categorize/choices.js.map +1 -0
- package/lib/categorize/droppable-placeholder.js +84 -0
- package/lib/categorize/droppable-placeholder.js.map +1 -0
- package/lib/categorize/grid-content.js +55 -0
- package/lib/categorize/grid-content.js.map +1 -0
- package/lib/categorize/index.js +450 -0
- package/lib/categorize/index.js.map +1 -0
- package/lib/index.js +316 -0
- package/lib/index.js.map +1 -0
- package/package.json +21 -57
- package/dist/author/defaults.d.ts +0 -223
- package/dist/author/defaults.js +0 -170
- package/dist/author/design/builder.d.ts +0 -10
- package/dist/author/design/builder.js +0 -24
- package/dist/author/design/buttons.d.ts +0 -28
- package/dist/author/design/buttons.js +0 -36
- package/dist/author/design/categories/RowLabel.d.ts +0 -23
- package/dist/author/design/categories/RowLabel.js +0 -47
- package/dist/author/design/categories/alternateResponses.d.ts +0 -31
- package/dist/author/design/categories/alternateResponses.js +0 -62
- package/dist/author/design/categories/category.d.ts +0 -44
- package/dist/author/design/categories/category.js +0 -98
- package/dist/author/design/categories/choice-preview.d.ts +0 -25
- package/dist/author/design/categories/choice-preview.js +0 -60
- package/dist/author/design/categories/droppable-placeholder.d.ts +0 -11
- package/dist/author/design/categories/droppable-placeholder.js +0 -71
- package/dist/author/design/categories/index.d.ts +0 -41
- package/dist/author/design/categories/index.js +0 -146
- package/dist/author/design/choices/choice.d.ts +0 -11
- package/dist/author/design/choices/choice.js +0 -129
- package/dist/author/design/choices/config.d.ts +0 -21
- package/dist/author/design/choices/config.js +0 -33
- package/dist/author/design/choices/index.d.ts +0 -41
- package/dist/author/design/choices/index.js +0 -110
- package/dist/author/design/header.d.ts +0 -24
- package/dist/author/design/header.js +0 -49
- package/dist/author/design/index.d.ts +0 -52
- package/dist/author/design/index.js +0 -417
- package/dist/author/design/input-header.d.ts +0 -39
- package/dist/author/design/input-header.js +0 -69
- package/dist/author/design/utils.d.ts +0 -9
- package/dist/author/design/utils.js +0 -7
- package/dist/author/index.d.ts +0 -51
- package/dist/author/index.js +0 -87
- package/dist/author/main.d.ts +0 -23
- package/dist/author/main.js +0 -30
- package/dist/author/utils.d.ts +0 -16
- package/dist/author/utils.js +0 -17
- package/dist/controller/defaults.d.ts +0 -34
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -61
- package/dist/controller/index.js +0 -155
- package/dist/controller/utils.d.ts +0 -20
- package/dist/controller/utils.js +0 -35
- package/dist/delivery/categorize/categories.d.ts +0 -34
- package/dist/delivery/categorize/categories.js +0 -66
- package/dist/delivery/categorize/category.d.ts +0 -28
- package/dist/delivery/categorize/category.js +0 -48
- package/dist/delivery/categorize/choice.d.ts +0 -27
- package/dist/delivery/categorize/choice.js +0 -94
- package/dist/delivery/categorize/choices.d.ts +0 -39
- package/dist/delivery/categorize/choices.js +0 -51
- package/dist/delivery/categorize/droppable-placeholder.d.ts +0 -32
- package/dist/delivery/categorize/droppable-placeholder.js +0 -64
- package/dist/delivery/categorize/grid-content.d.ts +0 -25
- package/dist/delivery/categorize/grid-content.js +0 -39
- package/dist/delivery/categorize/index.d.ts +0 -57
- package/dist/delivery/categorize/index.js +0 -260
- package/dist/delivery/index.d.ts +0 -27
- package/dist/delivery/index.js +0 -152
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -152
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import e from "./choice-preview.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import r from "debug";
|
|
5
|
-
import { styled as i } from "@mui/material/styles";
|
|
6
|
-
import { useDroppable as a } from "@dnd-kit/core";
|
|
7
|
-
import { PlaceHolder as o, uid as s } from "@pie-lib/drag";
|
|
8
|
-
import { jsx as c } from "react/jsx-runtime";
|
|
9
|
-
//#region src/author/design/categories/droppable-placeholder.tsx
|
|
10
|
-
r("@pie-element:categorize:configure");
|
|
11
|
-
var l = i("div")(({ theme: e }) => ({
|
|
12
|
-
display: "flex",
|
|
13
|
-
alignItems: "center",
|
|
14
|
-
justifyContent: "center",
|
|
15
|
-
fontSize: e.typography.fontSize - 2,
|
|
16
|
-
color: `rgba(${e.palette.common.black}, 0.4)`,
|
|
17
|
-
width: "100%",
|
|
18
|
-
height: "100%"
|
|
19
|
-
})), u = () => /* @__PURE__ */ c(l, { children: "Drag your correct answers here" }), d = ({ alternateResponseIndex: n, category: r, choices: i, onDeleteChoice: a }) => /* @__PURE__ */ c(t.Fragment, { children: (i || []).map((t, i) => t && /* @__PURE__ */ c(e, {
|
|
20
|
-
alternateResponseIndex: n,
|
|
21
|
-
category: r,
|
|
22
|
-
choice: t,
|
|
23
|
-
choiceIndex: i,
|
|
24
|
-
onDelete: (e) => a(e, i)
|
|
25
|
-
}, i)) });
|
|
26
|
-
d.propTypes = {
|
|
27
|
-
alternateResponseIndex: n.number,
|
|
28
|
-
category: n.object,
|
|
29
|
-
choices: n.array,
|
|
30
|
-
onDeleteChoice: n.func
|
|
31
|
-
};
|
|
32
|
-
var f = ({ alternateResponseIndex: e, category: t, choices: n, onDeleteChoice: r, categoryId: i, isAlternate: s }) => {
|
|
33
|
-
let { setNodeRef: l, isOver: f } = a({
|
|
34
|
-
id: `${i}-${s ? "alternate" : "standard"}`,
|
|
35
|
-
data: {
|
|
36
|
-
accepts: ["choice", "choice-preview"],
|
|
37
|
-
alternateResponseIndex: e,
|
|
38
|
-
categoryId: i,
|
|
39
|
-
type: s ? "category-alternate" : "category",
|
|
40
|
-
id: i
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return /* @__PURE__ */ c("div", {
|
|
44
|
-
ref: l,
|
|
45
|
-
children: /* @__PURE__ */ c(o, {
|
|
46
|
-
isOver: f,
|
|
47
|
-
extraStyles: {
|
|
48
|
-
width: "100%",
|
|
49
|
-
minHeight: "100px",
|
|
50
|
-
height: "auto"
|
|
51
|
-
},
|
|
52
|
-
children: (n || []).length === 0 ? /* @__PURE__ */ c(u, {}) : /* @__PURE__ */ c(d, {
|
|
53
|
-
alternateResponseIndex: e,
|
|
54
|
-
category: t,
|
|
55
|
-
choices: n,
|
|
56
|
-
onDeleteChoice: r
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
f.propTypes = {
|
|
62
|
-
alternateResponseIndex: n.number,
|
|
63
|
-
category: n.object,
|
|
64
|
-
choices: n.array,
|
|
65
|
-
onDeleteChoice: n.func,
|
|
66
|
-
categoryId: n.string.isRequired,
|
|
67
|
-
isAlternate: n.bool
|
|
68
|
-
};
|
|
69
|
-
var p = s.withUid(f);
|
|
70
|
-
//#endregion
|
|
71
|
-
export { p as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/categorize/configure/src/design/categories/index.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 Categories extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
defaultImageMaxHeight: PropTypes.Requireable<number>;
|
|
14
|
-
defaultImageMaxWidth: PropTypes.Requireable<number>;
|
|
15
|
-
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
-
}>>;
|
|
19
|
-
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
}>>;
|
|
23
|
-
categories: PropTypes.Requireable<any[]>;
|
|
24
|
-
onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
-
model: PropTypes.Validator<object>;
|
|
26
|
-
configuration: PropTypes.Validator<object>;
|
|
27
|
-
toolbarOpts: PropTypes.Requireable<object>;
|
|
28
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
29
|
-
};
|
|
30
|
-
state: {
|
|
31
|
-
focusedEl: null;
|
|
32
|
-
};
|
|
33
|
-
add: any;
|
|
34
|
-
deleteFocusedEl: any;
|
|
35
|
-
delete: any;
|
|
36
|
-
change: any;
|
|
37
|
-
deleteChoiceFromCategory: any;
|
|
38
|
-
changeRowLabel: any;
|
|
39
|
-
render(): React.JSX.Element;
|
|
40
|
-
}
|
|
41
|
-
export default Categories;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import e from "./category.js";
|
|
2
|
-
import t from "../header.js";
|
|
3
|
-
import { generateValidationMessage as n } from "../../utils.js";
|
|
4
|
-
import { RowLabel as r } from "./RowLabel.js";
|
|
5
|
-
import i from "react";
|
|
6
|
-
import a from "prop-types";
|
|
7
|
-
import { styled as o } from "@mui/material/styles";
|
|
8
|
-
import { removeCategory as s, removeChoiceFromCategory as c } from "@pie-lib/categorize";
|
|
9
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
10
|
-
import { choiceUtils as d } from "@pie-lib/config-ui";
|
|
11
|
-
import f from "@mui/icons-material/Info";
|
|
12
|
-
import p from "@mui/material/Tooltip";
|
|
13
|
-
//#region src/author/design/categories/index.tsx
|
|
14
|
-
var m = o("div")(({ theme: e }) => ({ marginBottom: e.spacing(3) })), h = o("div")(({ theme: e }) => ({
|
|
15
|
-
display: "grid",
|
|
16
|
-
gridRowGap: e.spacing(1),
|
|
17
|
-
gridColumnGap: e.spacing(1)
|
|
18
|
-
})), g = o(p)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
19
|
-
fontSize: e.typography.fontSize - 2,
|
|
20
|
-
whiteSpace: "pre",
|
|
21
|
-
maxWidth: "500px"
|
|
22
|
-
} })), _ = o("div")(({ theme: e }) => ({
|
|
23
|
-
fontSize: e.typography.fontSize - 2,
|
|
24
|
-
color: e.palette.error.main,
|
|
25
|
-
paddingTop: e.spacing(.5)
|
|
26
|
-
})), v = class extends i.Component {
|
|
27
|
-
static propTypes = {
|
|
28
|
-
defaultImageMaxHeight: a.number,
|
|
29
|
-
defaultImageMaxWidth: a.number,
|
|
30
|
-
imageSupport: a.shape({
|
|
31
|
-
add: a.func.isRequired,
|
|
32
|
-
delete: a.func.isRequired
|
|
33
|
-
}),
|
|
34
|
-
uploadSoundSupport: a.shape({
|
|
35
|
-
add: a.func.isRequired,
|
|
36
|
-
delete: a.func.isRequired
|
|
37
|
-
}),
|
|
38
|
-
categories: a.array,
|
|
39
|
-
onModelChanged: a.func,
|
|
40
|
-
model: a.object.isRequired,
|
|
41
|
-
configuration: a.object.isRequired,
|
|
42
|
-
toolbarOpts: a.object,
|
|
43
|
-
spellCheck: a.bool
|
|
44
|
-
};
|
|
45
|
-
state = { focusedEl: null };
|
|
46
|
-
add = () => {
|
|
47
|
-
let { model: e, categories: t } = this.props, { categoriesPerRow: n, correctResponse: r, allowAlternateEnabled: i } = e, a = d.firstAvailableIndex(e.categories.map((e) => e.id), 1), o = {
|
|
48
|
-
id: a,
|
|
49
|
-
label: "Category " + a
|
|
50
|
-
}, s = e.categories.length % n === 0, c = [...e.rowLabels];
|
|
51
|
-
s && c.push(""), this.setState({ focusedEl: t.length }, () => {
|
|
52
|
-
this.props.onModelChanged({
|
|
53
|
-
rowLabels: c,
|
|
54
|
-
categories: e.categories.concat([o]),
|
|
55
|
-
correctResponse: i ? [...r, {
|
|
56
|
-
category: a,
|
|
57
|
-
choices: [],
|
|
58
|
-
alternateResponses: []
|
|
59
|
-
}] : r
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
deleteFocusedEl = () => {
|
|
64
|
-
this.setState({ focusedEl: null });
|
|
65
|
-
};
|
|
66
|
-
delete = (e) => {
|
|
67
|
-
let { model: t, onModelChanged: n } = this.props, r = t.categories.findIndex((t) => t.id === e.id);
|
|
68
|
-
r !== -1 && (t.categories.splice(r, 1), t.correctResponse = s(e.id, t.correctResponse), n(t));
|
|
69
|
-
};
|
|
70
|
-
change = (e) => {
|
|
71
|
-
let { categories: t } = this.props, n = t.findIndex((t) => t.id === e.id);
|
|
72
|
-
n !== -1 && (t.splice(n, 1, e), this.props.onModelChanged({ categories: t }));
|
|
73
|
-
};
|
|
74
|
-
deleteChoiceFromCategory = (e, t, n) => {
|
|
75
|
-
let { model: r, onModelChanged: i } = this.props;
|
|
76
|
-
i({ correctResponse: c(t.id, e.id, n, r.correctResponse) });
|
|
77
|
-
};
|
|
78
|
-
changeRowLabel = (e, t) => {
|
|
79
|
-
let { model: n } = this.props, { rowLabels: r } = n, i = [...r];
|
|
80
|
-
i.length < t ? i.push(e) : i[t] = e, this.props.onModelChanged({ rowLabels: i });
|
|
81
|
-
};
|
|
82
|
-
render() {
|
|
83
|
-
let { model: a, categories: o, imageSupport: s, uploadSoundSupport: c, toolbarOpts: d, spellCheck: p, configuration: v, defaultImageMaxHeight: y, defaultImageMaxWidth: b, mathMlOptions: x = {} } = this.props, { categoriesPerRow: S, rowLabels: C, errors: w } = a, { associationError: T, categoriesError: E, categoriesErrors: D } = w || {}, { maxCategories: O, maxImageWidth: k = {}, maxImageHeight: A = {} } = v || {}, j = { gridTemplateColumns: `repeat(${S}, 1fr)` }, M = n(v);
|
|
84
|
-
return /* @__PURE__ */ u(m, { children: [
|
|
85
|
-
/* @__PURE__ */ l(t, {
|
|
86
|
-
label: "Categories",
|
|
87
|
-
buttonLabel: "ADD A CATEGORY",
|
|
88
|
-
onAdd: this.add,
|
|
89
|
-
info: /* @__PURE__ */ l(g, {
|
|
90
|
-
disableFocusListener: !0,
|
|
91
|
-
disableTouchListener: !0,
|
|
92
|
-
placement: "right",
|
|
93
|
-
title: M,
|
|
94
|
-
children: /* @__PURE__ */ l(f, {
|
|
95
|
-
fontSize: "small",
|
|
96
|
-
color: "primary",
|
|
97
|
-
style: { marginLeft: "5px" }
|
|
98
|
-
})
|
|
99
|
-
}),
|
|
100
|
-
buttonDisabled: O && o && O === o.length
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ l(h, {
|
|
103
|
-
style: j,
|
|
104
|
-
children: o.map((t, n) => {
|
|
105
|
-
let a = n % S === 0, o = n / S;
|
|
106
|
-
return /* @__PURE__ */ u(i.Fragment, { children: [a && /* @__PURE__ */ l(r, {
|
|
107
|
-
categoriesPerRow: S,
|
|
108
|
-
disabled: !1,
|
|
109
|
-
rowIndex: o,
|
|
110
|
-
markup: C[o] || "",
|
|
111
|
-
onChange: (e) => this.changeRowLabel(e, o),
|
|
112
|
-
imageSupport: s,
|
|
113
|
-
toolbarOpts: d,
|
|
114
|
-
spellCheck: p,
|
|
115
|
-
maxImageWidth: k && k.rowLabel || b,
|
|
116
|
-
maxImageHeight: A && A.rowLabel || y,
|
|
117
|
-
uploadSoundSupport: c,
|
|
118
|
-
mathMlOptions: x,
|
|
119
|
-
configuration: v
|
|
120
|
-
}), /* @__PURE__ */ l(e, {
|
|
121
|
-
imageSupport: s,
|
|
122
|
-
focusedEl: this.state.focusedEl,
|
|
123
|
-
deleteFocusedEl: this.deleteFocusedEl,
|
|
124
|
-
index: n,
|
|
125
|
-
category: t,
|
|
126
|
-
error: D && D[t.id],
|
|
127
|
-
onChange: this.change,
|
|
128
|
-
onDelete: () => this.delete(t),
|
|
129
|
-
toolbarOpts: d,
|
|
130
|
-
spellCheck: p,
|
|
131
|
-
onDeleteChoice: (e, n) => this.deleteChoiceFromCategory(t, e, n),
|
|
132
|
-
maxImageWidth: k && k.categoryLabel || b,
|
|
133
|
-
maxImageHeight: A && A.categoryLabel || y,
|
|
134
|
-
uploadSoundSupport: c,
|
|
135
|
-
configuration: v,
|
|
136
|
-
alternateResponseIndex: void 0
|
|
137
|
-
})] }, n);
|
|
138
|
-
})
|
|
139
|
-
}),
|
|
140
|
-
T && /* @__PURE__ */ l(_, { children: T }),
|
|
141
|
-
E && /* @__PURE__ */ l(_, { children: E })
|
|
142
|
-
] });
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
//#endregion
|
|
146
|
-
export { v as default };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/categorize/configure/src/design/choices/choice.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
|
-
declare const _default: (props: any) => React.JSX.Element;
|
|
11
|
-
export default _default;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import e from "../input-header.js";
|
|
2
|
-
import { DeleteButton as t } from "../buttons.js";
|
|
3
|
-
import { multiplePlacements as n } from "../../utils.js";
|
|
4
|
-
import "react";
|
|
5
|
-
import r from "prop-types";
|
|
6
|
-
import i from "debug";
|
|
7
|
-
import { styled as a } from "@mui/material/styles";
|
|
8
|
-
import { useDraggable as o, useDroppable as s } from "@dnd-kit/core";
|
|
9
|
-
import { uid as c } from "@pie-lib/drag";
|
|
10
|
-
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
-
import { Checkbox as d } from "@pie-lib/config-ui";
|
|
12
|
-
import f from "@mui/material/Card";
|
|
13
|
-
import p from "@mui/material/CardActions";
|
|
14
|
-
import m from "@mui/icons-material/DragHandle";
|
|
15
|
-
//#region src/author/design/choices/choice.tsx
|
|
16
|
-
i("@pie-element:categorize:configure:choice");
|
|
17
|
-
var h = (e) => {
|
|
18
|
-
if (e.lockChoiceOrder) return !0;
|
|
19
|
-
let t = e.choice.categoryCount || 0;
|
|
20
|
-
return t === 0 ? !0 : e.correctResponseCount < t;
|
|
21
|
-
}, g = a(f)(({ theme: e }) => ({
|
|
22
|
-
minWidth: "196px",
|
|
23
|
-
padding: e.spacing(1),
|
|
24
|
-
overflow: "visible"
|
|
25
|
-
})), _ = a(p)({
|
|
26
|
-
padding: 0,
|
|
27
|
-
justifyContent: "space-between"
|
|
28
|
-
}), v = a("span", { shouldForwardProp: (e) => e !== "draggable" })(({ draggable: e }) => ({
|
|
29
|
-
cursor: e ? "move" : "inherit",
|
|
30
|
-
touchAction: "none"
|
|
31
|
-
})), y = a("div")(({ theme: e }) => ({
|
|
32
|
-
fontSize: e.typography.fontSize - 2,
|
|
33
|
-
color: e.palette.error.main,
|
|
34
|
-
paddingBottom: e.spacing(1)
|
|
35
|
-
})), b = ({ allowMultiplePlacements: r, configuration: i, choice: a, deleteFocusedEl: c, focusedEl: f, index: p, onDelete: b, onChange: x, correctResponseCount: S, lockChoiceOrder: C, imageSupport: w, spellCheck: T, toolbarOpts: E, error: D, maxImageWidth: O, maxImageHeight: k, uploadSoundSupport: A }) => {
|
|
36
|
-
let j = h({
|
|
37
|
-
choice: a,
|
|
38
|
-
correctResponseCount: S,
|
|
39
|
-
lockChoiceOrder: C
|
|
40
|
-
}), { attributes: M, listeners: N, setNodeRef: P, isDragging: F } = o({
|
|
41
|
-
id: `choice-${a.id}`,
|
|
42
|
-
data: {
|
|
43
|
-
id: a.id,
|
|
44
|
-
index: p,
|
|
45
|
-
type: "choice"
|
|
46
|
-
},
|
|
47
|
-
disabled: !j
|
|
48
|
-
}), { setNodeRef: I } = s({
|
|
49
|
-
id: `choice-drop-${a.id}`,
|
|
50
|
-
data: {
|
|
51
|
-
id: a.id,
|
|
52
|
-
index: p,
|
|
53
|
-
type: "choice"
|
|
54
|
-
}
|
|
55
|
-
}), L = (e) => {
|
|
56
|
-
a.content = e, x(a);
|
|
57
|
-
}, R = () => {
|
|
58
|
-
a.categoryCount === 1 ? a.categoryCount = 0 : a.categoryCount = 1, x(a);
|
|
59
|
-
}, z = ((e) => e === n.perChoice)(r);
|
|
60
|
-
return /* @__PURE__ */ u(g, {
|
|
61
|
-
ref: (e) => {
|
|
62
|
-
P(e), I(e);
|
|
63
|
-
},
|
|
64
|
-
style: { opacity: F ? .5 : 1 },
|
|
65
|
-
children: [
|
|
66
|
-
/* @__PURE__ */ l(_, { children: /* @__PURE__ */ l(v, {
|
|
67
|
-
draggable: j,
|
|
68
|
-
...M,
|
|
69
|
-
...N,
|
|
70
|
-
children: /* @__PURE__ */ l(m, { color: j ? "primary" : "disabled" })
|
|
71
|
-
}) }),
|
|
72
|
-
/* @__PURE__ */ l(e, {
|
|
73
|
-
imageSupport: w,
|
|
74
|
-
focusedEl: f,
|
|
75
|
-
deleteFocusedEl: c,
|
|
76
|
-
index: p,
|
|
77
|
-
label: a.content,
|
|
78
|
-
onChange: L,
|
|
79
|
-
onDelete: b,
|
|
80
|
-
toolbarOpts: E,
|
|
81
|
-
spellCheck: T,
|
|
82
|
-
error: D,
|
|
83
|
-
maxImageWidth: O,
|
|
84
|
-
maxImageHeight: k,
|
|
85
|
-
uploadSoundSupport: A,
|
|
86
|
-
configuration: i
|
|
87
|
-
}),
|
|
88
|
-
D && /* @__PURE__ */ l(y, { children: D }),
|
|
89
|
-
/* @__PURE__ */ u(_, { children: [/* @__PURE__ */ l(t, {
|
|
90
|
-
label: "delete",
|
|
91
|
-
onClick: b
|
|
92
|
-
}), z && /* @__PURE__ */ l(d, {
|
|
93
|
-
mini: !0,
|
|
94
|
-
label: "Remove after placing",
|
|
95
|
-
checked: a.categoryCount === 1,
|
|
96
|
-
onChange: R
|
|
97
|
-
})] })
|
|
98
|
-
]
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
b.propTypes = {
|
|
102
|
-
allowMultiplePlacements: r.string,
|
|
103
|
-
configuration: r.object.isRequired,
|
|
104
|
-
choice: r.object.isRequired,
|
|
105
|
-
deleteFocusedEl: r.func,
|
|
106
|
-
focusedEl: r.number,
|
|
107
|
-
index: r.number,
|
|
108
|
-
lockChoiceOrder: r.bool,
|
|
109
|
-
maxImageHeight: r.object,
|
|
110
|
-
maxImageWidth: r.object,
|
|
111
|
-
onChange: r.func.isRequired,
|
|
112
|
-
onDelete: r.func.isRequired,
|
|
113
|
-
correctResponseCount: r.number.isRequired,
|
|
114
|
-
imageSupport: r.shape({
|
|
115
|
-
add: r.func.isRequired,
|
|
116
|
-
delete: r.func.isRequired
|
|
117
|
-
}),
|
|
118
|
-
toolbarOpts: r.object,
|
|
119
|
-
error: r.string,
|
|
120
|
-
uploadSoundSupport: r.shape({
|
|
121
|
-
add: r.func.isRequired,
|
|
122
|
-
delete: r.func.isRequired
|
|
123
|
-
}),
|
|
124
|
-
spellCheck: r.bool,
|
|
125
|
-
rearrangeChoices: r.func
|
|
126
|
-
};
|
|
127
|
-
var x = c.withUid(b);
|
|
128
|
-
//#endregion
|
|
129
|
-
export { x as default };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/categorize/configure/src/design/choices/config.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 Config extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
config: PropTypes.Requireable<object>;
|
|
14
|
-
onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
16
|
-
};
|
|
17
|
-
static defaultProps: {};
|
|
18
|
-
changeLabel: any;
|
|
19
|
-
render(): React.JSX.Element;
|
|
20
|
-
}
|
|
21
|
-
export default Config;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { styled as n } from "@mui/material/styles";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
import i from "@mui/material/TextField";
|
|
6
|
-
//#region src/author/design/choices/config.tsx
|
|
7
|
-
var a = n("div")(({ theme: e }) => ({
|
|
8
|
-
paddingTop: e.spacing(1),
|
|
9
|
-
marginBottom: e.spacing(1)
|
|
10
|
-
})), o = n(i)({ width: "100%" }), s = class extends e.Component {
|
|
11
|
-
static propTypes = {
|
|
12
|
-
config: t.object,
|
|
13
|
-
onModelChanged: t.func,
|
|
14
|
-
spellCheck: t.bool
|
|
15
|
-
};
|
|
16
|
-
static defaultProps = {};
|
|
17
|
-
changeLabel = ({ target: e }) => {
|
|
18
|
-
this.props.onModelChanged({ choicesLabel: e.value });
|
|
19
|
-
};
|
|
20
|
-
render() {
|
|
21
|
-
let { config: e, spellCheck: t } = this.props;
|
|
22
|
-
return /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(o, {
|
|
23
|
-
InputLabelProps: { shrink: !0 },
|
|
24
|
-
variant: "outlined",
|
|
25
|
-
label: "Label",
|
|
26
|
-
value: e.choicesLabel,
|
|
27
|
-
onChange: this.changeLabel,
|
|
28
|
-
spellCheck: t
|
|
29
|
-
}) });
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { s as default };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/categorize/configure/src/design/choices/index.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 Choices extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
model: PropTypes.Validator<object>;
|
|
14
|
-
configuration: PropTypes.Validator<object>;
|
|
15
|
-
choices: PropTypes.Validator<any[]>;
|
|
16
|
-
defaultImageMaxWidth: PropTypes.Requireable<number>;
|
|
17
|
-
defaultImageMaxHeight: PropTypes.Requireable<number>;
|
|
18
|
-
onModelChanged: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
-
imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
21
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
-
}>>;
|
|
23
|
-
uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
|
|
24
|
-
add: PropTypes.Validator<(...args: any[]) => any>;
|
|
25
|
-
delete: PropTypes.Validator<(...args: any[]) => any>;
|
|
26
|
-
}>>;
|
|
27
|
-
toolbarOpts: PropTypes.Requireable<object>;
|
|
28
|
-
spellCheck: PropTypes.Requireable<boolean>;
|
|
29
|
-
};
|
|
30
|
-
static defaultProps: {};
|
|
31
|
-
state: {
|
|
32
|
-
focusedEl: null;
|
|
33
|
-
};
|
|
34
|
-
changeChoice: any;
|
|
35
|
-
allChoicesHaveCount: any;
|
|
36
|
-
addChoice: any;
|
|
37
|
-
deleteFocusedEl: any;
|
|
38
|
-
deleteChoice: any;
|
|
39
|
-
render(): React.JSX.Element;
|
|
40
|
-
}
|
|
41
|
-
export default Choices;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import e from "../header.js";
|
|
2
|
-
import t from "./choice.js";
|
|
3
|
-
import n from "./config.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import { removeAllChoices as o } from "@pie-lib/categorize";
|
|
8
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
-
import { choiceUtils as l } from "@pie-lib/config-ui";
|
|
10
|
-
//#region src/author/design/choices/index.tsx
|
|
11
|
-
var u = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(2.5) })), d = a("div")(({ theme: e }) => ({
|
|
12
|
-
paddingTop: e.spacing(1),
|
|
13
|
-
paddingBottom: e.spacing(1),
|
|
14
|
-
display: "grid",
|
|
15
|
-
gridRowGap: e.spacing(1),
|
|
16
|
-
gridColumnGap: e.spacing(1)
|
|
17
|
-
})), f = a("div")(({ theme: e }) => ({
|
|
18
|
-
fontSize: e.typography.fontSize - 2,
|
|
19
|
-
color: e.palette.error.main,
|
|
20
|
-
paddingTop: e.spacing(.5)
|
|
21
|
-
})), p = class extends r.Component {
|
|
22
|
-
static propTypes = {
|
|
23
|
-
model: i.object.isRequired,
|
|
24
|
-
configuration: i.object.isRequired,
|
|
25
|
-
choices: i.array.isRequired,
|
|
26
|
-
defaultImageMaxWidth: i.number,
|
|
27
|
-
defaultImageMaxHeight: i.number,
|
|
28
|
-
onModelChanged: i.func.isRequired,
|
|
29
|
-
imageSupport: i.shape({
|
|
30
|
-
add: i.func.isRequired,
|
|
31
|
-
delete: i.func.isRequired
|
|
32
|
-
}),
|
|
33
|
-
uploadSoundSupport: i.shape({
|
|
34
|
-
add: i.func.isRequired,
|
|
35
|
-
delete: i.func.isRequired
|
|
36
|
-
}),
|
|
37
|
-
toolbarOpts: i.object,
|
|
38
|
-
spellCheck: i.bool
|
|
39
|
-
};
|
|
40
|
-
static defaultProps = {};
|
|
41
|
-
state = { focusedEl: null };
|
|
42
|
-
changeChoice = (e) => {
|
|
43
|
-
let { choices: t, onModelChanged: n } = this.props, r = t.findIndex((t) => t.id === e.id);
|
|
44
|
-
r !== -1 && (t.splice(r, 1, e), n({ choices: t }));
|
|
45
|
-
};
|
|
46
|
-
allChoicesHaveCount = (e) => {
|
|
47
|
-
let { choices: t } = this.props;
|
|
48
|
-
return Array.isArray(t) && t.every((t) => t.categoryCount === e);
|
|
49
|
-
};
|
|
50
|
-
addChoice = () => {
|
|
51
|
-
let { onModelChanged: e, model: t, choices: n } = this.props, { maxAnswerChoices: r } = t || {};
|
|
52
|
-
if (r && t.choices?.length >= r) return;
|
|
53
|
-
let i = l.firstAvailableIndex(t.choices.map((e) => e.id), 1), a = {
|
|
54
|
-
id: i,
|
|
55
|
-
content: "Choice " + i
|
|
56
|
-
};
|
|
57
|
-
this.setState({ focusedEl: n.length }, () => {
|
|
58
|
-
e({ choices: t.choices.concat([a]) });
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
deleteFocusedEl = () => {
|
|
62
|
-
this.setState({ focusedEl: null });
|
|
63
|
-
};
|
|
64
|
-
deleteChoice = (e) => {
|
|
65
|
-
let { model: t, onModelChanged: n } = this.props, r = t.choices.findIndex((t) => t.id === e.id);
|
|
66
|
-
r !== -1 && (t.choices.splice(r, 1), t.correctResponse = o(e.id, t.correctResponse), n(t));
|
|
67
|
-
};
|
|
68
|
-
render() {
|
|
69
|
-
let { focusedEl: r } = this.state, { choices: i, model: a, imageSupport: o, uploadSoundSupport: l, onModelChanged: p, spellCheck: m, toolbarOpts: h, configuration: g, defaultImageMaxWidth: _, defaultImageMaxHeight: v } = this.props, { errors: y, allowMultiplePlacementsEnabled: b, lockChoiceOrder: x, maxAnswerChoices: S } = a, { choicesError: C, choicesErrors: w } = y || {}, { maxImageWidth: T = {}, maxImageHeight: E = {} } = g || {}, D = { gridTemplateColumns: `repeat(${a.categoriesPerRow}, 1fr)` }, O = S && i?.length >= S ? `Only ${S} allowed maximum` : "";
|
|
70
|
-
return /* @__PURE__ */ c(u, { children: [
|
|
71
|
-
/* @__PURE__ */ s(e, {
|
|
72
|
-
label: "Choices",
|
|
73
|
-
buttonLabel: "ADD A CHOICE",
|
|
74
|
-
onAdd: this.addChoice,
|
|
75
|
-
buttonDisabled: S && i && i?.length >= S,
|
|
76
|
-
tooltip: O
|
|
77
|
-
}),
|
|
78
|
-
/* @__PURE__ */ s(n, {
|
|
79
|
-
config: a,
|
|
80
|
-
onModelChanged: p,
|
|
81
|
-
spellCheck: m
|
|
82
|
-
}),
|
|
83
|
-
/* @__PURE__ */ s(d, {
|
|
84
|
-
style: D,
|
|
85
|
-
children: i.map((e, n) => /* @__PURE__ */ s(t, {
|
|
86
|
-
choice: e,
|
|
87
|
-
focusedEl: r,
|
|
88
|
-
deleteFocusedEl: this.deleteFocusedEl,
|
|
89
|
-
correctResponseCount: e.correctResponseCount,
|
|
90
|
-
allowMultiplePlacements: b,
|
|
91
|
-
lockChoiceOrder: x,
|
|
92
|
-
index: n,
|
|
93
|
-
imageSupport: o,
|
|
94
|
-
onChange: this.changeChoice,
|
|
95
|
-
onDelete: () => this.deleteChoice(e),
|
|
96
|
-
toolbarOpts: h,
|
|
97
|
-
spellCheck: m,
|
|
98
|
-
error: w && w[e.id],
|
|
99
|
-
maxImageWidth: T && T.choice || _,
|
|
100
|
-
maxImageHeight: E && E.choice || v,
|
|
101
|
-
uploadSoundSupport: l,
|
|
102
|
-
configuration: g
|
|
103
|
-
}, e.id))
|
|
104
|
-
}),
|
|
105
|
-
C && /* @__PURE__ */ s(f, { children: C })
|
|
106
|
-
] });
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
//#endregion
|
|
110
|
-
export { p as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/categorize/configure/src/design/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 Header extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
buttonLabel: PropTypes.Requireable<string>;
|
|
14
|
-
onAdd: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
-
label: PropTypes.Validator<string>;
|
|
16
|
-
info: PropTypes.Requireable<any>;
|
|
17
|
-
buttonDisabled: PropTypes.Requireable<boolean>;
|
|
18
|
-
variant: PropTypes.Requireable<string>;
|
|
19
|
-
tooltip: PropTypes.Requireable<string>;
|
|
20
|
-
};
|
|
21
|
-
static defaultProps: {};
|
|
22
|
-
render(): React.JSX.Element;
|
|
23
|
-
}
|
|
24
|
-
export default Header;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { AddButton as e } from "./buttons.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, jsxs as a } from "react/jsx-runtime";
|
|
6
|
-
import o from "@mui/material/Tooltip";
|
|
7
|
-
import s from "@mui/material/Typography";
|
|
8
|
-
//#region src/author/design/header.tsx
|
|
9
|
-
var c = r("div")(({ theme: e }) => ({
|
|
10
|
-
display: "flex",
|
|
11
|
-
justifyContent: "space-between",
|
|
12
|
-
marginBottom: e.spacing(1)
|
|
13
|
-
})), l = r("div")({
|
|
14
|
-
display: "flex",
|
|
15
|
-
alignItems: "center"
|
|
16
|
-
}), u = r(o)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
|
|
17
|
-
fontSize: e.typography.fontSize - 2,
|
|
18
|
-
whiteSpace: "pre",
|
|
19
|
-
maxWidth: "500px"
|
|
20
|
-
} })), d = class extends t.Component {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
buttonLabel: n.string,
|
|
23
|
-
onAdd: n.func.isRequired,
|
|
24
|
-
label: n.string.isRequired,
|
|
25
|
-
info: n.any,
|
|
26
|
-
buttonDisabled: n.bool,
|
|
27
|
-
variant: n.string,
|
|
28
|
-
tooltip: n.string
|
|
29
|
-
};
|
|
30
|
-
static defaultProps = {};
|
|
31
|
-
render() {
|
|
32
|
-
let { onAdd: t, label: n, buttonLabel: r, info: o, buttonDisabled: d, variant: f, tooltip: p } = this.props;
|
|
33
|
-
return /* @__PURE__ */ a(c, { children: [/* @__PURE__ */ a(l, { children: [/* @__PURE__ */ i(s, {
|
|
34
|
-
variant: f || "title",
|
|
35
|
-
children: n
|
|
36
|
-
}), o] }), /* @__PURE__ */ i(u, {
|
|
37
|
-
title: p || "",
|
|
38
|
-
enterTouchDelay: 50,
|
|
39
|
-
leaveTouchDelay: 3e3,
|
|
40
|
-
children: /* @__PURE__ */ i("span", { children: /* @__PURE__ */ i(e, {
|
|
41
|
-
onClick: t,
|
|
42
|
-
label: r,
|
|
43
|
-
disabled: d
|
|
44
|
-
}) })
|
|
45
|
-
})] });
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
//#endregion
|
|
49
|
-
export { d as default };
|