@pie-element/match 12.4.0-beta.7 → 13.0.0-next.20261002100925

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.
Files changed (110) hide show
  1. package/author.js +2 -0
  2. package/configure.js +2 -0
  3. package/controller.js +1 -0
  4. package/dist/author/add-row.d.ts +17 -0
  5. package/dist/author/add-row.js +24 -0
  6. package/dist/author/answer-config-block.d.ts +36 -0
  7. package/dist/author/answer-config-block.js +177 -0
  8. package/dist/author/configure.d.ts +48 -0
  9. package/dist/author/configure.js +259 -0
  10. package/dist/author/defaults.d.ts +203 -0
  11. package/dist/author/defaults.js +151 -0
  12. package/dist/author/general-config-block.d.ts +22 -0
  13. package/dist/author/general-config-block.js +93 -0
  14. package/dist/author/index.d.ts +45 -0
  15. package/dist/author/index.js +79 -0
  16. package/dist/author/row.d.ts +51 -0
  17. package/dist/author/row.js +208 -0
  18. package/dist/author/utils.d.ts +10 -0
  19. package/dist/author/utils.js +10 -0
  20. package/dist/browser/Typography-C2S9t4p_.js +9414 -0
  21. package/dist/browser/Typography-C2S9t4p_.js.map +1 -0
  22. package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
  23. package/dist/browser/author/index.js +36948 -0
  24. package/dist/browser/author/index.js.map +1 -0
  25. package/dist/browser/browser-kkT1XVKw.js +219 -0
  26. package/dist/browser/browser-kkT1XVKw.js.map +1 -0
  27. package/dist/browser/controller/index.js +267 -0
  28. package/dist/browser/controller/index.js.map +1 -0
  29. package/dist/browser/delivery/index.js +2092 -0
  30. package/dist/browser/delivery/index.js.map +1 -0
  31. package/dist/browser/dist-C4gh2n2Z.js +104 -0
  32. package/dist/browser/dist-C4gh2n2Z.js.map +1 -0
  33. package/dist/browser/editor-runtime/Typography-CyFhrWHw.js +9414 -0
  34. package/dist/browser/editor-runtime/Typography-CyFhrWHw.js.map +1 -0
  35. package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
  36. package/dist/browser/editor-runtime/author/index.js +20539 -0
  37. package/dist/browser/editor-runtime/author/index.js.map +1 -0
  38. package/dist/browser/editor-runtime/browser-jJGxjKdp.js +219 -0
  39. package/dist/browser/editor-runtime/browser-jJGxjKdp.js.map +1 -0
  40. package/dist/browser/editor-runtime/controller/index.js +267 -0
  41. package/dist/browser/editor-runtime/controller/index.js.map +1 -0
  42. package/dist/browser/editor-runtime/delivery/index.js +2092 -0
  43. package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
  44. package/dist/browser/editor-runtime/dist-C4gh2n2Z.js +104 -0
  45. package/dist/browser/editor-runtime/dist-C4gh2n2Z.js.map +1 -0
  46. package/dist/controller/defaults.d.ts +27 -0
  47. package/dist/controller/defaults.js +25 -0
  48. package/dist/controller/index.d.ts +29 -0
  49. package/dist/controller/index.js +154 -0
  50. package/dist/delivery/answer-grid.d.ts +29 -0
  51. package/dist/delivery/answer-grid.js +107 -0
  52. package/dist/delivery/index.d.ts +21 -0
  53. package/dist/delivery/index.js +51 -0
  54. package/dist/delivery/main.d.ts +26 -0
  55. package/dist/delivery/main.js +112 -0
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.iife.d.ts +8 -0
  58. package/dist/index.iife.js +148 -0
  59. package/dist/index.js +2 -0
  60. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  61. package/dist/runtime-support.d.ts +12 -0
  62. package/dist/runtime-support.js +12 -0
  63. package/package.json +96 -22
  64. package/CHANGELOG.json +0 -1462
  65. package/CHANGELOG.md +0 -2380
  66. package/LICENSE.md +0 -5
  67. package/README.md +0 -1
  68. package/configure/CHANGELOG.json +0 -892
  69. package/configure/CHANGELOG.md +0 -2083
  70. package/configure/lib/add-row.js +0 -40
  71. package/configure/lib/add-row.js.map +0 -1
  72. package/configure/lib/answer-config-block.js +0 -288
  73. package/configure/lib/answer-config-block.js.map +0 -1
  74. package/configure/lib/common.js +0 -31
  75. package/configure/lib/common.js.map +0 -1
  76. package/configure/lib/configure.js +0 -410
  77. package/configure/lib/configure.js.map +0 -1
  78. package/configure/lib/defaults.js +0 -201
  79. package/configure/lib/defaults.js.map +0 -1
  80. package/configure/lib/general-config-block.js +0 -144
  81. package/configure/lib/general-config-block.js.map +0 -1
  82. package/configure/lib/index.js +0 -156
  83. package/configure/lib/index.js.map +0 -1
  84. package/configure/lib/row.js +0 -321
  85. package/configure/lib/row.js.map +0 -1
  86. package/configure/lib/utils.js +0 -12
  87. package/configure/lib/utils.js.map +0 -1
  88. package/configure/package.json +0 -29
  89. package/configure/utils.js +0 -19
  90. package/controller/CHANGELOG.json +0 -502
  91. package/controller/CHANGELOG.md +0 -1405
  92. package/controller/lib/defaults.js +0 -25
  93. package/controller/lib/defaults.js.map +0 -1
  94. package/controller/lib/index.js +0 -424
  95. package/controller/lib/index.js.map +0 -1
  96. package/controller/package.json +0 -24
  97. package/docs/config-schema.json +0 -2929
  98. package/docs/config-schema.json.md +0 -2162
  99. package/docs/demo/config.js +0 -8
  100. package/docs/demo/generate.js +0 -49
  101. package/docs/demo/index.html +0 -1
  102. package/docs/demo/session.js +0 -11
  103. package/docs/pie-schema.json +0 -1530
  104. package/docs/pie-schema.json.md +0 -907
  105. package/lib/answer-grid.js +0 -166
  106. package/lib/answer-grid.js.map +0 -1
  107. package/lib/index.js +0 -86
  108. package/lib/index.js.map +0 -1
  109. package/lib/main.js +0 -163
  110. package/lib/main.js.map +0 -1
package/author.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './dist/author/index.js';
2
+ export * from './dist/author/index.js';
package/configure.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './dist/author/index.js';
2
+ export * from './dist/author/index.js';
package/controller.js ADDED
@@ -0,0 +1 @@
1
+ export * from './dist/controller/index.js';
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/match/configure/src/add-row.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 AddRowButton extends React.Component {
12
+ static propTypes: {
13
+ onAddClick: PropTypes.Validator<(...args: any[]) => any>;
14
+ };
15
+ render(): React.JSX.Element;
16
+ }
17
+ export default AddRowButton;
@@ -0,0 +1,24 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { styled as i } from "@mui/material/styles";
5
+ import a from "@mui/material/Button";
6
+ import o from "@mui/icons-material/Add";
7
+ //#region src/author/add-row.tsx
8
+ var s = i(a)({
9
+ display: "flex",
10
+ alignSelf: "flex-start",
11
+ margin: 0
12
+ }), c = i(o)(({ theme: e }) => ({ marginRight: e.spacing(.5) })), l = class extends e.Component {
13
+ static propTypes = { onAddClick: t.func.isRequired };
14
+ render() {
15
+ let { onAddClick: e } = this.props;
16
+ return /* @__PURE__ */ r(s, {
17
+ disabled: !1,
18
+ onClick: e,
19
+ children: [/* @__PURE__ */ n(c, {}), "Add Another Row"]
20
+ });
21
+ }
22
+ };
23
+ //#endregion
24
+ export { l as AddRowButton, l as default };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/match/configure/src/answer-config-block.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 * as React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ declare class AnswerConfigBlock extends React.Component {
12
+ static propTypes: {
13
+ model: PropTypes.Validator<object>;
14
+ configuration: PropTypes.Validator<object>;
15
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
16
+ onDeleteRow: PropTypes.Validator<(...args: any[]) => any>;
17
+ onAddRow: PropTypes.Validator<(...args: any[]) => any>;
18
+ imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
19
+ add: PropTypes.Validator<(...args: any[]) => any>;
20
+ delete: PropTypes.Validator<(...args: any[]) => any>;
21
+ }>>;
22
+ uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
23
+ add: PropTypes.Validator<(...args: any[]) => any>;
24
+ delete: PropTypes.Validator<(...args: any[]) => any>;
25
+ }>>;
26
+ toolbarOpts: PropTypes.Requireable<object>;
27
+ spellCheck: PropTypes.Requireable<boolean>;
28
+ };
29
+ moveRow: any;
30
+ onChange: (name: any, isBoolean: any) => ({ target }: {
31
+ target: any;
32
+ }) => void;
33
+ onHeaderChange: (headerIndex: any) => (value: any) => void;
34
+ render(): React.JSX.Element;
35
+ }
36
+ export default AnswerConfigBlock;
@@ -0,0 +1,177 @@
1
+ import { getPluginProps as e } from "./utils.js";
2
+ import { clsx as t } from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
3
+ import { AddRowButton as n } from "./add-row.js";
4
+ import r from "./row.js";
5
+ import * as i from "react";
6
+ import a from "prop-types";
7
+ import { color as o } from "@pie-lib/render-ui";
8
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
+ import l from "@mui/material/Typography";
10
+ import { styled as u } from "@mui/material/styles";
11
+ import { set as d } from "@pie-element/shared-lodash";
12
+ import f from "debug";
13
+ import p, { DEFAULT_PLUGINS as m } from "@pie-lib/editable-html-tip-tap";
14
+ import { DragProvider as h } from "@pie-lib/drag";
15
+ //#region src/author/answer-config-block.tsx
16
+ var g = f("pie-elements:match:configure"), _ = u("div")(({ theme: e }) => ({
17
+ marginBottom: e.spacing(2.5),
18
+ display: "flex",
19
+ flexDirection: "column"
20
+ })), v = u("div")(({ theme: e }) => ({
21
+ display: "flex",
22
+ alignItems: "center",
23
+ flex: 1,
24
+ width: "100%",
25
+ borderBottom: `2px solid ${o.border()}`,
26
+ paddingBottom: e.spacing(2),
27
+ marginTop: e.spacing(2),
28
+ marginBottom: e.spacing(1)
29
+ })), y = u("div")(({ theme: e }) => ({
30
+ flex: 1,
31
+ display: "flex",
32
+ justifyContent: "center",
33
+ alignItems: "center",
34
+ flexDirection: "column",
35
+ "&> div": {
36
+ width: "120px",
37
+ padding: `0 ${e.spacing(1)}`,
38
+ textAlign: "center"
39
+ }
40
+ })), b = u("div")(({ theme: e }) => ({
41
+ flex: .5,
42
+ minWidth: "45px",
43
+ padding: `0 ${e.spacing(1)}`
44
+ })), x = u("div")({
45
+ display: "flex",
46
+ flexDirection: "column"
47
+ }), S = u("div")(({ theme: e }) => ({
48
+ fontSize: e.typography.fontSize - 2,
49
+ color: e.palette.error.main,
50
+ paddingTop: `${e.spacing(1)} !important`,
51
+ width: "fit-content !important"
52
+ })), C = u("div")(({ theme: e }) => ({
53
+ fontSize: e.typography.fontSize - 2,
54
+ color: e.palette.error.main,
55
+ paddingBottom: e.spacing(1)
56
+ })), w = u("div")(({ theme: e }) => ({
57
+ "& .marginBottom": { marginBottom: e.typography.fontSize - 2 + e.spacing(1) },
58
+ "& .headerInput": { "& > div": { fontWeight: "bold" } }
59
+ })), T = class extends i.Component {
60
+ static propTypes = {
61
+ model: a.object.isRequired,
62
+ configuration: a.object.isRequired,
63
+ onChange: a.func.isRequired,
64
+ onDeleteRow: a.func.isRequired,
65
+ onAddRow: a.func.isRequired,
66
+ imageSupport: a.shape({
67
+ add: a.func.isRequired,
68
+ delete: a.func.isRequired
69
+ }),
70
+ uploadSoundSupport: a.shape({
71
+ add: a.func.isRequired,
72
+ delete: a.func.isRequired
73
+ }),
74
+ toolbarOpts: a.object,
75
+ spellCheck: a.bool
76
+ };
77
+ moveRow = (e) => {
78
+ let { active: t, over: n } = e;
79
+ if (!n || !t) return;
80
+ let r = t.data.current, i = n.data.current;
81
+ if (r?.type === "row" && i?.type === "row") {
82
+ let e = r.index, t = i.index, { model: n, onChange: a } = this.props, o = { ...n }, s = o.rows || [];
83
+ g("[moveRow]: ", e, t);
84
+ let { movedRow: c, remainingRows: l } = s.reduce((t, n, r) => (r === e ? t.movedRow = n : t.remainingRows.push(n), t), {
85
+ movedRow: null,
86
+ remainingRows: []
87
+ }), u = [
88
+ ...l.slice(0, t),
89
+ c,
90
+ ...l.slice(t)
91
+ ];
92
+ g("update: ", u), o.rows = u, a(o);
93
+ }
94
+ };
95
+ onChange = (e, t) => ({ target: n }) => {
96
+ let { model: r, onChange: i } = this.props, a;
97
+ a = t ? n.checked : n.value, d(r, e, a), i(r, e);
98
+ };
99
+ onHeaderChange = (e) => (t) => {
100
+ let { model: n, onChange: r } = this.props, i = { ...n };
101
+ if (e === 0) {
102
+ i.headers[e] = t, r(i);
103
+ return;
104
+ }
105
+ i.headers[e] = t, r(i);
106
+ };
107
+ render() {
108
+ let { model: i, onAddRow: a, imageSupport: o, configuration: u, toolbarOpts: d, spellCheck: f, uploadSoundSupport: g } = this.props, { baseInputConfiguration: T = {}, headers: E = {}, rows: D = {}, maxImageWidth: O = {}, maxImageHeight: k = {}, mathMlOptions: A = {}, minQuestions: j } = u || {}, { errors: M } = i || {}, { correctResponseError: N, rowsErrors: P, columnsErrors: F, noOfRowsError: I, columnsLengthError: L } = M || {}, R = (m || []).filter((e) => e !== "table" && e !== "bulleted-list" && e !== "numbered-list"), z = O && O.prompt, B = k && k.prompt;
109
+ return /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(h, {
110
+ onDragEnd: this.moveRow,
111
+ children: /* @__PURE__ */ c(_, { children: [/* @__PURE__ */ s(l, {
112
+ type: "body1",
113
+ component: "div",
114
+ children: "Click on the labels to edit or remove. Set the correct answers by clicking each correct answer per row."
115
+ }), /* @__PURE__ */ c(x, {
116
+ style: u.width ? {
117
+ width: u.width,
118
+ overflow: "scroll"
119
+ } : {},
120
+ children: [
121
+ /* @__PURE__ */ c(v, { children: [E.settings && (i.headers || []).map((n, r) => /* @__PURE__ */ c(y, {
122
+ className: t({ questionText: r === 0 }),
123
+ sx: r === 0 ? {
124
+ flex: 2,
125
+ display: "flex",
126
+ justifyContent: "flex-start",
127
+ marginRight: 1,
128
+ "&> div": {
129
+ width: "100%",
130
+ padding: 0,
131
+ maxWidth: "unset",
132
+ textAlign: "left",
133
+ minWidth: "200px"
134
+ }
135
+ } : {},
136
+ children: [/* @__PURE__ */ s(p, {
137
+ onChange: this.onHeaderChange(r),
138
+ markup: n,
139
+ className: F && !F[r] ? "marginBottom" : "headerInput",
140
+ label: "column label",
141
+ activePlugins: R,
142
+ pluginProps: e(E?.inputConfiguration, T),
143
+ autoWidthToolbar: !0,
144
+ spellCheck: f,
145
+ uploadSoundSupport: g,
146
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
147
+ error: F && F[r]
148
+ }), F && F[r] && /* @__PURE__ */ s(S, { children: F[r] })]
149
+ }, r)), /* @__PURE__ */ s(b, {})] }),
150
+ i.rows.map((t, n) => /* @__PURE__ */ s(r, {
151
+ model: i,
152
+ row: t,
153
+ idx: n,
154
+ onDeleteRow: this.props.onDeleteRow,
155
+ onChange: this.props.onChange,
156
+ imageSupport: o,
157
+ toolbarOpts: d,
158
+ spellCheck: f,
159
+ error: P?.[t.id],
160
+ maxImageWidth: O && O.rowTitles || z,
161
+ maxImageHeight: k && k.rowTitles || B,
162
+ uploadSoundSupport: g,
163
+ mathMlOptions: A,
164
+ minQuestions: j,
165
+ inputConfiguration: e(D?.inputConfiguration, T)
166
+ }, n)),
167
+ N && /* @__PURE__ */ s(C, { children: N }),
168
+ I && /* @__PURE__ */ s(C, { children: I }),
169
+ L && /* @__PURE__ */ s(C, { children: L }),
170
+ /* @__PURE__ */ s(n, { onAddClick: a })
171
+ ]
172
+ })] })
173
+ }) });
174
+ }
175
+ };
176
+ //#endregion
177
+ export { T as default };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/match/configure/src/configure.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
+ declare class Configure extends React.Component {
12
+ static propTypes: {
13
+ onModelChanged: PropTypes.Requireable<(...args: any[]) => any>;
14
+ onConfigurationChanged: PropTypes.Requireable<(...args: any[]) => any>;
15
+ model: PropTypes.Validator<object>;
16
+ configuration: PropTypes.Validator<object>;
17
+ imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
18
+ add: PropTypes.Validator<(...args: any[]) => any>;
19
+ delete: PropTypes.Validator<(...args: any[]) => any>;
20
+ }>>;
21
+ uploadSoundSupport: PropTypes.Requireable<PropTypes.InferProps<{
22
+ add: PropTypes.Validator<(...args: any[]) => any>;
23
+ delete: PropTypes.Validator<(...args: any[]) => any>;
24
+ }>>;
25
+ };
26
+ static defaultProps: {};
27
+ constructor(props: any);
28
+ componentDidMount(): void;
29
+ validateRowsID(rows: any): {
30
+ updatedRows: any;
31
+ wasChanged: boolean;
32
+ };
33
+ onTabChange: any;
34
+ onChangeTabIndex: any;
35
+ onChange: any;
36
+ onFeedbackChange: any;
37
+ onDeleteRow: any;
38
+ onAddRow: any;
39
+ onLayoutChange: any;
40
+ onResponseTypeChange: any;
41
+ onPartialScoringChange: any;
42
+ onPromptChanged: any;
43
+ onTeacherInstructionsChanged: any;
44
+ onRationaleChanged: any;
45
+ render(): React.JSX.Element;
46
+ }
47
+ export declare const Config: typeof Configure;
48
+ export default Configure;
@@ -0,0 +1,259 @@
1
+ import { getPluginProps as e } from "./utils.js";
2
+ import t from "./general-config-block.js";
3
+ import n from "./answer-config-block.js";
4
+ import r from "react";
5
+ import i from "prop-types";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { styled as s } from "@mui/material/styles";
8
+ import c from "debug";
9
+ import { AlertDialog as l, FeedbackConfig as ee, InputContainer as u, layout as d, settings as f } from "@pie-lib/config-ui";
10
+ import p from "@pie-lib/editable-html-tip-tap";
11
+ //#region src/author/configure.tsx
12
+ var te = c("@pie-element:match:configure"), { Panel: m, toggle: h, radio: g, dropdown: _ } = f, v = s("div")(() => ({ "& .promptHolder": { width: "100%" } })), y = s("div")(({ theme: e }) => ({
13
+ width: "100%",
14
+ paddingTop: e.spacing(2),
15
+ marginBottom: e.spacing(2)
16
+ })), b = s("div")(({ theme: e }) => ({
17
+ fontSize: e.typography.fontSize - 2,
18
+ color: e.palette.error.main,
19
+ paddingTop: e.spacing(1)
20
+ })), x = class extends r.Component {
21
+ static propTypes = {
22
+ onModelChanged: i.func,
23
+ onConfigurationChanged: i.func,
24
+ model: i.object.isRequired,
25
+ configuration: i.object.isRequired,
26
+ imageSupport: i.shape({
27
+ add: i.func.isRequired,
28
+ delete: i.func.isRequired
29
+ }),
30
+ uploadSoundSupport: i.shape({
31
+ add: i.func.isRequired,
32
+ delete: i.func.isRequired
33
+ })
34
+ };
35
+ static defaultProps = {};
36
+ constructor(e) {
37
+ super(e);
38
+ let t = 0;
39
+ e.model.rows && e.model.rows.length > 0 && (t = Math.max(...e.model.rows.map((e) => e.id))), this.rowIdCounter = t + 1, this.state = {
40
+ activeTab: 0,
41
+ dialog: {
42
+ open: !1,
43
+ text: ""
44
+ }
45
+ };
46
+ }
47
+ componentDidMount() {
48
+ let { updatedRows: e, wasChanged: t } = this.validateRowsID(this.props.model.rows);
49
+ if (t) {
50
+ let t = {
51
+ ...this.props.model,
52
+ rows: e
53
+ };
54
+ this.props.onModelChanged(t);
55
+ }
56
+ }
57
+ validateRowsID(e) {
58
+ let t = !1;
59
+ return {
60
+ updatedRows: (e || []).map((e, n) => e.id === n + 1 ? e : (t = !0, {
61
+ ...e,
62
+ id: n + 1
63
+ })),
64
+ wasChanged: t
65
+ };
66
+ }
67
+ onTabChange = (e, t) => {
68
+ this.setState({ activeTab: t });
69
+ };
70
+ onChangeTabIndex = (e) => {
71
+ this.setState({ activeTab: e });
72
+ };
73
+ onChange = (e) => {
74
+ this.props.onModelChanged(e);
75
+ };
76
+ onFeedbackChange = (e) => {
77
+ let { model: t, onModelChanged: n } = this.props;
78
+ t.feedback = e, n(t);
79
+ };
80
+ onDeleteRow = (e) => {
81
+ let { model: t } = this.props, n = { ...t };
82
+ n.rows.splice(e, 1), this.onChange(n);
83
+ };
84
+ onAddRow = () => {
85
+ let { model: e, configuration: t } = this.props, n = { ...e }, { maxQuestions: r } = t || {};
86
+ if (r && (n.rows || []).length >= r) {
87
+ this.setState({ dialog: {
88
+ open: !0,
89
+ text: `There can be maximum ${r} question row` + (r > 1 ? "s" : "") + "."
90
+ } });
91
+ return;
92
+ }
93
+ n.rows = n.rows.concat({
94
+ id: this.rowIdCounter + 1,
95
+ title: `Question Text ${(n.rows || []).length + 1}`,
96
+ values: Array(e.layout - 1).fill(!1)
97
+ }), this.rowIdCounter += 1, this.onChange(n);
98
+ };
99
+ onLayoutChange = (e) => {
100
+ let { model: t } = this.props, n = t.layout, r = { ...t };
101
+ if (e > n) {
102
+ for (let t = 0; t < e - n; t++) r.headers.push(`Column ${r.headers.length + 1}`);
103
+ r.rows.forEach((t) => {
104
+ for (let r = 0; r < e - n; r++) t.values.push(!1);
105
+ });
106
+ } else e < n && (r.headers.splice(e), r.rows.forEach((t) => {
107
+ t.values.splice(e - 1);
108
+ }));
109
+ r.layout = e, this.onChange(r);
110
+ };
111
+ onResponseTypeChange = (e) => {
112
+ let { model: t } = this.props, n = { ...t };
113
+ e === "radio" && n.rows.forEach((e) => {
114
+ e.values.reduce((e, t) => t === !0 ? e + 1 : e) > 1 && (e.values = Array(t.layout - 1).fill(!1));
115
+ }), n.choiceMode = e, this.onChange(n);
116
+ };
117
+ onPartialScoringChange = (e) => {
118
+ this.props.model.partialScoring = e, this.props.onModelChanged(this.props.model);
119
+ };
120
+ onPromptChanged = (e) => {
121
+ this.props.onModelChanged({
122
+ ...this.props.model,
123
+ prompt: e
124
+ });
125
+ };
126
+ onTeacherInstructionsChanged = (e) => {
127
+ this.props.onModelChanged({
128
+ ...this.props.model,
129
+ teacherInstructions: e
130
+ });
131
+ };
132
+ onRationaleChanged = (e) => {
133
+ this.props.onModelChanged({
134
+ ...this.props.model,
135
+ rationale: e
136
+ });
137
+ };
138
+ render() {
139
+ let { model: r, imageSupport: i, onModelChanged: s, configuration: c, onConfigurationChanged: f, uploadSoundSupport: x } = this.props, { baseInputConfiguration: S = {}, contentDimensions: C = {}, feedback: w = {}, lockChoiceOrder: T = {}, maxImageWidth: E = {}, maxImageHeight: D = {}, partialScoring: O = {}, prompt: k = {}, rationale: A = {}, settingsPanelDisabled: j, scoringType: M = {}, spellCheck: N = {}, studentInstructions: P = {}, teacherInstructions: F = {}, withRubric: I = {}, language: L = {}, languageChoices: R = {} } = c || {}, { errors: z, extraCSSRules: B, feedbackEnabled: V, promptEnabled: H, rationaleEnabled: U, spellCheckEnabled: W, teacherInstructionsEnabled: G, toolbarEditorPosition: K } = r || {}, { prompt: q, rationale: J, teacherInstructions: Y } = z || {}, { dialog: X } = this.state, Z = { position: K === "top" ? "top" : "bottom" }, Q = E && E.prompt, $ = D && D.prompt, ne = {
140
+ partialScoring: O.settings && h(O.label),
141
+ lockChoiceOrder: T.settings && h(T.label),
142
+ feedbackEnabled: w.settings && h(w.label),
143
+ "language.enabled": L.settings && h(L.label, !0),
144
+ language: L.settings && L.enabled && _(R.label, R.options)
145
+ }, re = {
146
+ teacherInstructionsEnabled: F.settings && h(F.label),
147
+ studentInstructionsEnabled: P.settings && h(P.label),
148
+ promptEnabled: k.settings && h(k.label),
149
+ rationaleEnabled: A.settings && h(A.label),
150
+ spellCheckEnabled: N.settings && h(N.label),
151
+ scoringType: M.settings && g(M.label, ["auto", "rubric"]),
152
+ rubricEnabled: I?.settings && h(I?.label)
153
+ };
154
+ return te("[render] model", r), /* @__PURE__ */ a(v, { children: /* @__PURE__ */ o(d.ConfigLayout, {
155
+ extraCSSRules: B,
156
+ dimensions: C,
157
+ hideSettings: j,
158
+ settings: /* @__PURE__ */ a(m, {
159
+ model: r,
160
+ configuration: c,
161
+ onChangeModel: (e) => s(e),
162
+ onChangeConfiguration: (e) => f(e),
163
+ groups: {
164
+ Settings: ne,
165
+ Properties: re
166
+ }
167
+ }),
168
+ children: [
169
+ G && /* @__PURE__ */ a(u, {
170
+ label: F.label,
171
+ className: "promptHolder",
172
+ children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
173
+ className: "prompt",
174
+ markup: r.teacherInstructions || "",
175
+ onChange: this.onTeacherInstructionsChanged,
176
+ imageSupport: i,
177
+ error: Y,
178
+ nonEmpty: !1,
179
+ toolbarOpts: Z,
180
+ pluginProps: e(F?.inputConfiguration, S),
181
+ spellCheck: W,
182
+ maxImageWidth: E && E.teacherInstructions || Q,
183
+ maxImageHeight: D && D.teacherInstructions || $,
184
+ uploadSoundSupport: x,
185
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
186
+ }), Y && /* @__PURE__ */ a(b, { children: Y })] })
187
+ }),
188
+ H && /* @__PURE__ */ a(u, {
189
+ label: k.label,
190
+ className: "promptHolder",
191
+ children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
192
+ className: "prompt",
193
+ markup: r.prompt,
194
+ onChange: this.onPromptChanged,
195
+ imageSupport: i,
196
+ error: q,
197
+ nonEmpty: !1,
198
+ disableUnderline: !0,
199
+ toolbarOpts: Z,
200
+ pluginProps: e(k?.inputConfiguration, S),
201
+ spellCheck: W,
202
+ maxImageWidth: E && E.prompt,
203
+ maxImageHeight: D && D.prompt,
204
+ uploadSoundSupport: x,
205
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
206
+ }), q && /* @__PURE__ */ a(b, { children: q })] })
207
+ }),
208
+ /* @__PURE__ */ a(t, {
209
+ model: r,
210
+ configuration: c,
211
+ onResponseTypeChange: this.onResponseTypeChange,
212
+ onLayoutChange: this.onLayoutChange
213
+ }),
214
+ /* @__PURE__ */ a(n, {
215
+ model: r,
216
+ configuration: c,
217
+ imageSupport: i,
218
+ onChange: this.onChange,
219
+ onAddRow: this.onAddRow,
220
+ onDeleteRow: this.onDeleteRow,
221
+ toolbarOpts: Z,
222
+ spellCheck: W,
223
+ uploadSoundSupport: x
224
+ }),
225
+ U && /* @__PURE__ */ a(u, {
226
+ label: A.label,
227
+ className: "promptHolder",
228
+ children: /* @__PURE__ */ o(y, { children: [/* @__PURE__ */ a(p, {
229
+ className: "prompt",
230
+ markup: r.rationale || "",
231
+ onChange: this.onRationaleChanged,
232
+ imageSupport: i,
233
+ error: J,
234
+ toolbarOpts: Z,
235
+ pluginProps: e(A?.inputConfiguration, S),
236
+ spellCheck: W,
237
+ maxImageWidth: E && E.rationale || Q,
238
+ maxImageHeight: D && D.rationale || $,
239
+ uploadSoundSupport: x,
240
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }]
241
+ }), J && /* @__PURE__ */ a(b, { children: J })] })
242
+ }),
243
+ V && /* @__PURE__ */ a(ee, {
244
+ feedback: r.feedback,
245
+ onChange: this.onFeedbackChange,
246
+ toolbarOpts: Z
247
+ }),
248
+ /* @__PURE__ */ a(l, {
249
+ open: X.open,
250
+ title: "Warning",
251
+ text: X.text,
252
+ onConfirm: () => this.setState({ dialog: { open: !1 } })
253
+ })
254
+ ]
255
+ }) });
256
+ }
257
+ };
258
+ //#endregion
259
+ export { x as default };