@pie-element/categorize 6.9.9 → 6.9.10-beta.1445
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.md +394 -0
- package/configure/CHANGELOG.md +377 -0
- package/configure/lib/defaults.js +50 -3
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/design/builder.js +8 -5
- package/configure/lib/design/builder.js.map +1 -1
- package/configure/lib/design/buttons.js +5 -3
- package/configure/lib/design/buttons.js.map +1 -1
- package/configure/lib/design/categories/RowLabel.js +68 -0
- package/configure/lib/design/categories/RowLabel.js.map +1 -0
- package/configure/lib/design/categories/alternateResponses.js +121 -17
- package/configure/lib/design/categories/alternateResponses.js.map +1 -1
- package/configure/lib/design/categories/category.js +50 -6
- package/configure/lib/design/categories/category.js.map +1 -1
- package/configure/lib/design/categories/choice-preview.js +17 -4
- package/configure/lib/design/categories/choice-preview.js.map +1 -1
- package/configure/lib/design/categories/droppable-placeholder.js +23 -3
- package/configure/lib/design/categories/droppable-placeholder.js.map +1 -1
- package/configure/lib/design/categories/index.js +165 -72
- package/configure/lib/design/categories/index.js.map +1 -1
- package/configure/lib/design/choices/choice.js +80 -13
- package/configure/lib/design/choices/choice.js.map +1 -1
- package/configure/lib/design/choices/config.js +8 -113
- package/configure/lib/design/choices/config.js.map +1 -1
- package/configure/lib/design/choices/index.js +83 -10
- package/configure/lib/design/choices/index.js.map +1 -1
- package/configure/lib/design/header.js +17 -5
- package/configure/lib/design/header.js.map +1 -1
- package/configure/lib/design/index.js +158 -61
- package/configure/lib/design/index.js.map +1 -1
- package/configure/lib/design/input-header.js +57 -11
- package/configure/lib/design/input-header.js.map +1 -1
- package/configure/lib/index.js +17 -3
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +3 -1
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/utils.js +27 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +9 -9
- package/controller/CHANGELOG.md +89 -0
- package/controller/lib/defaults.js +18 -0
- package/controller/lib/defaults.js.map +1 -1
- package/controller/lib/index.js +160 -24
- package/controller/lib/index.js.map +1 -1
- package/controller/lib/utils.js +60 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +4 -4
- package/docs/config-schema.json +181 -0
- package/docs/config-schema.json.md +141 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +3 -3
- package/docs/demo/index.html +1 -1
- package/docs/pie-schema.json +48 -5
- package/docs/pie-schema.json.md +36 -5
- package/lib/categorize/categories.js +14 -4
- package/lib/categorize/categories.js.map +1 -1
- package/lib/categorize/category.js +3 -3
- package/lib/categorize/category.js.map +1 -1
- package/lib/categorize/choice.js +3 -3
- package/lib/categorize/choice.js.map +1 -1
- package/lib/categorize/choices.js +16 -7
- package/lib/categorize/choices.js.map +1 -1
- package/lib/categorize/droppable-placeholder.js +5 -3
- package/lib/categorize/droppable-placeholder.js.map +1 -1
- package/lib/categorize/grid-content.js +2 -2
- package/lib/categorize/grid-content.js.map +1 -1
- package/lib/categorize/index.js +36 -17
- package/lib/categorize/index.js.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/package.json +9 -8
|
@@ -26,6 +26,18 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
26
26
|
|
|
27
27
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
28
28
|
|
|
29
|
+
# `spellCheck` (object)
|
|
30
|
+
|
|
31
|
+
Properties of the `spellCheck` object:
|
|
32
|
+
|
|
33
|
+
## `settings` (boolean)
|
|
34
|
+
|
|
35
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
36
|
+
|
|
37
|
+
## `label` (string)
|
|
38
|
+
|
|
39
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
40
|
+
|
|
29
41
|
# `scoringType` (object)
|
|
30
42
|
|
|
31
43
|
Properties of the `scoringType` object:
|
|
@@ -38,6 +50,10 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
38
50
|
|
|
39
51
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
40
52
|
|
|
53
|
+
# `settingsPanelDisabled` (boolean)
|
|
54
|
+
|
|
55
|
+
Indicates if the settings panel is not available
|
|
56
|
+
|
|
41
57
|
# `studentInstructions` (object)
|
|
42
58
|
|
|
43
59
|
Properties of the `studentInstructions` object:
|
|
@@ -62,6 +78,102 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
62
78
|
|
|
63
79
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
64
80
|
|
|
81
|
+
# `minChoices` (number)
|
|
82
|
+
|
|
83
|
+
Minimum number of choices
|
|
84
|
+
|
|
85
|
+
# `maxChoices` (number)
|
|
86
|
+
|
|
87
|
+
Maximum number of choices
|
|
88
|
+
|
|
89
|
+
# `choicesPosition` (object)
|
|
90
|
+
|
|
91
|
+
Properties of the `choicesPosition` object:
|
|
92
|
+
|
|
93
|
+
## `settings` (boolean)
|
|
94
|
+
|
|
95
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
96
|
+
|
|
97
|
+
## `label` (string)
|
|
98
|
+
|
|
99
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
100
|
+
|
|
101
|
+
# `maxCategories` (number)
|
|
102
|
+
|
|
103
|
+
Maximum number of categories
|
|
104
|
+
|
|
105
|
+
# `minCategoriesPerRow` (number)
|
|
106
|
+
|
|
107
|
+
Minimum value of categories per row
|
|
108
|
+
|
|
109
|
+
# `maxImageWidth` (object)
|
|
110
|
+
|
|
111
|
+
Properties of the `maxImageWidth` object:
|
|
112
|
+
|
|
113
|
+
## `teacherInstructions` (number)
|
|
114
|
+
|
|
115
|
+
Indicates the max dimension for images in teacher instructions
|
|
116
|
+
|
|
117
|
+
## `prompt` (number)
|
|
118
|
+
|
|
119
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
120
|
+
|
|
121
|
+
## `rationale` (number)
|
|
122
|
+
|
|
123
|
+
Indicates the max dimension for images in rationale
|
|
124
|
+
|
|
125
|
+
## `choices` (number)
|
|
126
|
+
|
|
127
|
+
Indicates the max dimension for images in choices
|
|
128
|
+
|
|
129
|
+
## `rowLabel` (number)
|
|
130
|
+
|
|
131
|
+
Indicates the max dimension for images in row labels
|
|
132
|
+
|
|
133
|
+
## `categoryLabel` (number)
|
|
134
|
+
|
|
135
|
+
Indicates the max dimension for images in category labels
|
|
136
|
+
|
|
137
|
+
# `maxImageHeight` (object)
|
|
138
|
+
|
|
139
|
+
Properties of the `maxImageHeight` object:
|
|
140
|
+
|
|
141
|
+
## `teacherInstructions` (number)
|
|
142
|
+
|
|
143
|
+
Indicates the max dimension for images in teacher instructions
|
|
144
|
+
|
|
145
|
+
## `prompt` (number)
|
|
146
|
+
|
|
147
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
148
|
+
|
|
149
|
+
## `rationale` (number)
|
|
150
|
+
|
|
151
|
+
Indicates the max dimension for images in rationale
|
|
152
|
+
|
|
153
|
+
## `choices` (number)
|
|
154
|
+
|
|
155
|
+
Indicates the max dimension for images in choices
|
|
156
|
+
|
|
157
|
+
## `rowLabel` (number)
|
|
158
|
+
|
|
159
|
+
Indicates the max dimension for images in row labels
|
|
160
|
+
|
|
161
|
+
## `categoryLabel` (number)
|
|
162
|
+
|
|
163
|
+
Indicates the max dimension for images in category labels
|
|
164
|
+
|
|
165
|
+
# `withRubric` (object)
|
|
166
|
+
|
|
167
|
+
Properties of the `withRubric` object:
|
|
168
|
+
|
|
169
|
+
## `settings` (boolean)
|
|
170
|
+
|
|
171
|
+
Indicates if the item has to be displayed in the Settings Panel
|
|
172
|
+
|
|
173
|
+
## `label` (string)
|
|
174
|
+
|
|
175
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
176
|
+
|
|
65
177
|
# `showPrompt` (boolean)
|
|
66
178
|
|
|
67
179
|
Determines whether prompt field will be displayed or not
|
|
@@ -96,4 +208,32 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
96
208
|
|
|
97
209
|
### `label` (string)
|
|
98
210
|
|
|
99
|
-
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
211
|
+
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
212
|
+
|
|
213
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
214
|
+
|
|
215
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
216
|
+
|
|
217
|
+
### `teacherInstructions` (number)
|
|
218
|
+
|
|
219
|
+
Indicates the max dimension for images in teacher instructions
|
|
220
|
+
|
|
221
|
+
### `prompt` (number)
|
|
222
|
+
|
|
223
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
224
|
+
|
|
225
|
+
### `rationale` (number)
|
|
226
|
+
|
|
227
|
+
Indicates the max dimension for images in rationale
|
|
228
|
+
|
|
229
|
+
### `choices` (number)
|
|
230
|
+
|
|
231
|
+
Indicates the max dimension for images in choices
|
|
232
|
+
|
|
233
|
+
### `rowLabel` (number)
|
|
234
|
+
|
|
235
|
+
Indicates the max dimension for images in row labels
|
|
236
|
+
|
|
237
|
+
### `categoryLabel` (number)
|
|
238
|
+
|
|
239
|
+
Indicates the max dimension for images in category labels
|
package/docs/demo/config.js
CHANGED
package/docs/demo/generate.js
CHANGED
|
@@ -36,8 +36,7 @@ const E234 = {
|
|
|
36
36
|
categoriesPerRow: 2,
|
|
37
37
|
rationale:
|
|
38
38
|
'<p>Traditional equipment must be carried on board or shipped from Earth. 3D-printed equipment can be built on demand or rebuilt if it gets lost or broken.</p>',
|
|
39
|
-
prompt:
|
|
40
|
-
'<p>Drag <span class="relative-emphasis">two</span> phrases into each of the categories.</p>',
|
|
39
|
+
prompt: '<p>Drag <span class="relative-emphasis">two</span> phrases into each of the categories.</p>',
|
|
41
40
|
partialScoring: true,
|
|
42
41
|
correctResponse: [
|
|
43
42
|
{
|
|
@@ -50,6 +49,7 @@ const E234 = {
|
|
|
50
49
|
},
|
|
51
50
|
],
|
|
52
51
|
};
|
|
52
|
+
|
|
53
53
|
// const E236 = {
|
|
54
54
|
// choices: [
|
|
55
55
|
// {
|
|
@@ -303,7 +303,6 @@ exports.model = (id, element) => ({
|
|
|
303
303
|
choicesPosition: 'below',
|
|
304
304
|
choicesLabel: '',
|
|
305
305
|
lockChoiceOrder: true,
|
|
306
|
-
removeTilesAfterPlacing: false,
|
|
307
306
|
categoriesPerRow: 2,
|
|
308
307
|
categories: [
|
|
309
308
|
{
|
|
@@ -339,4 +338,5 @@ exports.model = (id, element) => ({
|
|
|
339
338
|
teacherInstructionsEnabled: true,
|
|
340
339
|
studentInstructionsEnabled: true,
|
|
341
340
|
toolbarEditorPosition: 'bottom',
|
|
341
|
+
rubricEnabled: false,
|
|
342
342
|
});
|
package/docs/demo/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<categorize-element pie-id="1"></categorize-element>
|
|
1
|
+
<categorize-element pie-id="1"></categorize-element>
|
package/docs/pie-schema.json
CHANGED
|
@@ -78,11 +78,6 @@
|
|
|
78
78
|
"type": "boolean",
|
|
79
79
|
"title": "promptEnabled"
|
|
80
80
|
},
|
|
81
|
-
"removeTilesAfterPlacing": {
|
|
82
|
-
"description": "Indicates if the choice, after it is dragged into a category, should be removed from the choices\narea or should remain in place.",
|
|
83
|
-
"type": "boolean",
|
|
84
|
-
"title": "removeTilesAfterPlacing"
|
|
85
|
-
},
|
|
86
81
|
"categories": {
|
|
87
82
|
"description": "The categories in which choices may be placed",
|
|
88
83
|
"type": "array",
|
|
@@ -373,6 +368,11 @@
|
|
|
373
368
|
"type": "boolean",
|
|
374
369
|
"title": "rationaleEnabled"
|
|
375
370
|
},
|
|
371
|
+
"spellCheckEnabled": {
|
|
372
|
+
"description": "Indicates if spellcheck is enabled for the author. Default value is true",
|
|
373
|
+
"type": "boolean",
|
|
374
|
+
"title": "spellCheckEnabled"
|
|
375
|
+
},
|
|
376
376
|
"studentInstructionsEnabled": {
|
|
377
377
|
"description": "Indicates if Student Instructions are enabled",
|
|
378
378
|
"type": "boolean",
|
|
@@ -398,6 +398,11 @@
|
|
|
398
398
|
"type": "string",
|
|
399
399
|
"title": "toolbarEditorPosition"
|
|
400
400
|
},
|
|
401
|
+
"rubricEnabled": {
|
|
402
|
+
"description": "Indicates if Rubric is enabled",
|
|
403
|
+
"type": "boolean",
|
|
404
|
+
"title": "rubricEnabled"
|
|
405
|
+
},
|
|
401
406
|
"id": {
|
|
402
407
|
"description": "Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.",
|
|
403
408
|
"type": "string",
|
|
@@ -417,6 +422,8 @@
|
|
|
417
422
|
"id",
|
|
418
423
|
"prompt",
|
|
419
424
|
"rationaleEnabled",
|
|
425
|
+
"rubricEnabled",
|
|
426
|
+
"spellCheckEnabled",
|
|
420
427
|
"studentInstructionsEnabled",
|
|
421
428
|
"teacherInstructionsEnabled"
|
|
422
429
|
],
|
|
@@ -437,6 +444,42 @@
|
|
|
437
444
|
}
|
|
438
445
|
}
|
|
439
446
|
},
|
|
447
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
448
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
449
|
+
"type": "object",
|
|
450
|
+
"properties": {
|
|
451
|
+
"teacherInstructions": {
|
|
452
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
453
|
+
"type": "number",
|
|
454
|
+
"title": "teacherInstructions"
|
|
455
|
+
},
|
|
456
|
+
"prompt": {
|
|
457
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
458
|
+
"type": "number",
|
|
459
|
+
"title": "prompt"
|
|
460
|
+
},
|
|
461
|
+
"rationale": {
|
|
462
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
463
|
+
"type": "number",
|
|
464
|
+
"title": "rationale"
|
|
465
|
+
},
|
|
466
|
+
"choices": {
|
|
467
|
+
"description": "Indicates the max dimension for images in choices",
|
|
468
|
+
"type": "number",
|
|
469
|
+
"title": "choices"
|
|
470
|
+
},
|
|
471
|
+
"rowLabel": {
|
|
472
|
+
"description": "Indicates the max dimension for images in row labels",
|
|
473
|
+
"type": "number",
|
|
474
|
+
"title": "rowLabel"
|
|
475
|
+
},
|
|
476
|
+
"categoryLabel": {
|
|
477
|
+
"description": "Indicates the max dimension for images in category labels",
|
|
478
|
+
"type": "number",
|
|
479
|
+
"title": "categoryLabel"
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
440
483
|
"CategoryChoice": {
|
|
441
484
|
"title": "CategoryChoice",
|
|
442
485
|
"type": "object",
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -53,11 +53,6 @@ The question prompt or item stem
|
|
|
53
53
|
|
|
54
54
|
Indicates if the prompt is enabled
|
|
55
55
|
|
|
56
|
-
# `removeTilesAfterPlacing` (boolean)
|
|
57
|
-
|
|
58
|
-
Indicates if the choice, after it is dragged into a category, should be removed from the choices
|
|
59
|
-
area or should remain in place.
|
|
60
|
-
|
|
61
56
|
# `categories` (array, required)
|
|
62
57
|
|
|
63
58
|
The categories in which choices may be placed
|
|
@@ -150,6 +145,10 @@ Indicates if Feedback is enabled
|
|
|
150
145
|
|
|
151
146
|
Indicates if Rationale are enabled
|
|
152
147
|
|
|
148
|
+
# `spellCheckEnabled` (boolean, required)
|
|
149
|
+
|
|
150
|
+
Indicates if spellcheck is enabled for the author. Default value is true
|
|
151
|
+
|
|
153
152
|
# `studentInstructionsEnabled` (boolean, required)
|
|
154
153
|
|
|
155
154
|
Indicates if Student Instructions are enabled
|
|
@@ -173,6 +172,10 @@ This element must be one of the following enum values:
|
|
|
173
172
|
|
|
174
173
|
Default: `": 'bottom'"`
|
|
175
174
|
|
|
175
|
+
# `rubricEnabled` (boolean, required)
|
|
176
|
+
|
|
177
|
+
Indicates if Rubric is enabled
|
|
178
|
+
|
|
176
179
|
# `id` (string, required)
|
|
177
180
|
|
|
178
181
|
Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
|
|
@@ -199,6 +202,34 @@ Indicates if the item has to be displayed in the Settings Panel
|
|
|
199
202
|
|
|
200
203
|
Indicates the label for the item that has to be displayed in the Settings Panel
|
|
201
204
|
|
|
205
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
206
|
+
|
|
207
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
208
|
+
|
|
209
|
+
### `teacherInstructions` (number)
|
|
210
|
+
|
|
211
|
+
Indicates the max dimension for images in teacher instructions
|
|
212
|
+
|
|
213
|
+
### `prompt` (number)
|
|
214
|
+
|
|
215
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
216
|
+
|
|
217
|
+
### `rationale` (number)
|
|
218
|
+
|
|
219
|
+
Indicates the max dimension for images in rationale
|
|
220
|
+
|
|
221
|
+
### `choices` (number)
|
|
222
|
+
|
|
223
|
+
Indicates the max dimension for images in choices
|
|
224
|
+
|
|
225
|
+
### `rowLabel` (number)
|
|
226
|
+
|
|
227
|
+
Indicates the max dimension for images in row labels
|
|
228
|
+
|
|
229
|
+
### `categoryLabel` (number)
|
|
230
|
+
|
|
231
|
+
Indicates the max dimension for images in category labels
|
|
232
|
+
|
|
202
233
|
## `CategoryChoice` (object)
|
|
203
234
|
|
|
204
235
|
Properties of the `CategoryChoice` object:
|
|
@@ -7,13 +7,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
+
exports.Categories = void 0;
|
|
10
11
|
Object.defineProperty(exports, "CategoryType", {
|
|
11
12
|
enumerable: true,
|
|
12
13
|
get: function get() {
|
|
13
14
|
return _category.CategoryType;
|
|
14
15
|
}
|
|
15
16
|
});
|
|
16
|
-
exports["default"] =
|
|
17
|
+
exports["default"] = void 0;
|
|
17
18
|
|
|
18
19
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
19
20
|
|
|
@@ -95,7 +96,11 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
95
96
|
})));
|
|
96
97
|
}); // if the last row has less categories than max on a row, fill the spaces with divs
|
|
97
98
|
|
|
98
|
-
items = items.concat(Array(categoriesPerRow - cat.length).fill( /*#__PURE__*/_react["default"].createElement("div", null))
|
|
99
|
+
items = items.concat(Array(categoriesPerRow - cat.length).fill( /*#__PURE__*/_react["default"].createElement("div", null)).map(function (value, index) {
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
101
|
+
key: "fill-space-".concat(index)
|
|
102
|
+
});
|
|
103
|
+
})); // for each inner array of categories, create a row with category containers
|
|
99
104
|
|
|
100
105
|
cat.forEach(function (c, columnIndex) {
|
|
101
106
|
items.push( /*#__PURE__*/_react["default"].createElement(_category["default"], (0, _extends2["default"])({
|
|
@@ -109,7 +114,11 @@ var Categories = /*#__PURE__*/function (_React$Component) {
|
|
|
109
114
|
}, c)));
|
|
110
115
|
}); // if the last row has less categories than max on a row, fill the spaces with divs
|
|
111
116
|
|
|
112
|
-
items = items.concat(Array(categoriesPerRow - cat.length).fill( /*#__PURE__*/_react["default"].createElement("div", null)))
|
|
117
|
+
items = items.concat(Array(categoriesPerRow - cat.length).fill( /*#__PURE__*/_react["default"].createElement("div", null)).map(function (value, index) {
|
|
118
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
119
|
+
key: "fill-space-final-".concat(index)
|
|
120
|
+
});
|
|
121
|
+
}));
|
|
113
122
|
return items;
|
|
114
123
|
}));
|
|
115
124
|
}
|
|
@@ -137,7 +146,8 @@ exports.Categories = Categories;
|
|
|
137
146
|
var styles = function styles(theme) {
|
|
138
147
|
return {
|
|
139
148
|
categories: {
|
|
140
|
-
flex: 1
|
|
149
|
+
flex: 1,
|
|
150
|
+
padding: '8px'
|
|
141
151
|
},
|
|
142
152
|
label: {
|
|
143
153
|
color: _renderUi.color.text(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/categories.jsx"],"names":["Categories","props","classes","categories","model","disabled","onDropChoice","onRemoveChoice","categoriesPerRow","chunkedCategories","Math","ceil","length","map","cat","rowIndex","items","forEach","c","columnIndex","push","label","__html","concat","Array","fill","h","id","category","React","Component","PropTypes","object","isRequired","arrayOf","shape","CategoryType","number","bool","func","styles","theme","flex","color","text","backgroundColor","background","fontSize","typography","textAlign","paddingTop","spacing","unit"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/categories.jsx"],"names":["Categories","props","classes","categories","model","disabled","onDropChoice","onRemoveChoice","categoriesPerRow","chunkedCategories","Math","ceil","length","map","cat","rowIndex","items","forEach","c","columnIndex","push","label","__html","concat","Array","fill","value","index","h","id","category","React","Component","PropTypes","object","isRequired","arrayOf","shape","CategoryType","number","bool","func","styles","theme","flex","padding","color","text","backgroundColor","background","fontSize","typography","textAlign","paddingTop","spacing","unit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;;;;;;;;;IAIaA,U;;;;;;;;;;;;WAkBX,kBAAS;AACP,wBAA+E,KAAKC,KAApF;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,UAAjB,eAAiBA,UAAjB;AAAA,UAA6BC,KAA7B,eAA6BA,KAA7B;AAAA,UAAoCC,QAApC,eAAoCA,QAApC;AAAA,UAA8CC,aAA9C,eAA8CA,YAA9C;AAAA,UAA4DC,cAA5D,eAA4DA,cAA5D;AACA,UAAQC,gBAAR,GAA6BJ,KAA7B,CAAQI,gBAAR,CAFO,CAIP;AACA;;AACA,UAAMC,iBAAiB,GAAG,uBAAMN,UAAN,EAAkBK,gBAAlB,CAA1B;AAEA,0BACE,gCAAC,uBAAD;AACE,QAAA,OAAO,EAAEA,gBADX;AAEE,QAAA,SAAS,EAAEN,OAAO,CAACC,UAFrB;AAGE,QAAA,IAAI,EAAEO,IAAI,CAACC,IAAL,CAA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,KAAK,CAACQ,UAAN,CAAiBD,QAHtB;AAILE,MAAAA,SAAS,EAAE,QAJN;AAKLC,MAAAA,UAAU,EAAEV,KAAK,CAACW,OAAN,CAAcC;AALrB;AALkB,GAAZ;AAAA,CAAf;;eAae,wBAAWb,MAAX,EAAmB1C,UAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { color } from '@pie-lib/render-ui';\n\nimport chunk from 'lodash/chunk';\n\nimport GridContent from './grid-content';\nimport Category, { CategoryType } from './category';\n\nexport { CategoryType };\n\nexport class Categories extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n categories: PropTypes.arrayOf(PropTypes.shape(CategoryType)),\n model: PropTypes.shape({\n categoriesPerRow: PropTypes.number,\n }),\n disabled: PropTypes.bool,\n onDropChoice: PropTypes.func.isRequired,\n onRemoveChoice: PropTypes.func.isRequired,\n };\n\n static defaultProps = {\n model: {\n categoriesPerRow: 1,\n },\n };\n\n render() {\n const { classes, categories, model, disabled, onDropChoice, onRemoveChoice } = this.props;\n const { categoriesPerRow } = model;\n\n // split categories into an array of arrays (inner array),\n // where each inner array represents how many categories should be displayed on one row\n const chunkedCategories = chunk(categories, categoriesPerRow);\n\n return (\n <GridContent\n columns={categoriesPerRow}\n className={classes.categories}\n rows={Math.ceil(categories.length / categoriesPerRow) * 2}\n >\n {chunkedCategories.map((cat, rowIndex) => {\n let items = [];\n\n // for each inner array of categories, create a row with category titles\n cat.forEach((c, columnIndex) => {\n items.push(\n <Typography className={classes.label} key={`category-label-${rowIndex}-${columnIndex}`}>\n <span dangerouslySetInnerHTML={{ __html: c.label }} />\n </Typography>,\n );\n });\n\n // if the last row has less categories than max on a row, fill the spaces with divs\n items = items.concat(Array(categoriesPerRow - cat.length).fill(<div/>).map((value,index) => <div key={`fill-space-${index}`} />));\n\n // for each inner array of categories, create a row with category containers\n cat.forEach((c, columnIndex) => {\n items.push(\n <Category\n onDropChoice={(h) => onDropChoice(c.id, h)}\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n className={classes.category}\n key={`category-element-${rowIndex}-${columnIndex}`}\n {...c}\n />,\n );\n });\n\n // if the last row has less categories than max on a row, fill the spaces with divs\n items = items.concat(Array(categoriesPerRow - cat.length).fill(<div/>).map((value,index) =><div key={`fill-space-final-${index}`} />));\n\n return items;\n })}\n </GridContent>\n );\n }\n}\n\nconst styles = (theme) => ({\n categories: {\n flex: 1,\n padding: '8px'\n },\n label: {\n color: color.text(),\n backgroundColor: color.background(),\n fontSize: theme.typography.fontSize,\n textAlign: 'center',\n paddingTop: theme.spacing.unit,\n },\n});\nexport default withStyles(styles)(Categories);\n"],"file":"categories.js"}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.
|
|
8
|
+
exports["default"] = exports.CategoryType = exports.Category = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -35,9 +35,9 @@ var _droppablePlaceholder = _interopRequireDefault(require("./droppable-placehol
|
|
|
35
35
|
|
|
36
36
|
var _renderUi = require("@pie-lib/render-ui");
|
|
37
37
|
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
38
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
40
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/category.jsx"],"names":["CategoryType","id","PropTypes","string","isRequired","categoryId","Category","props","classes","className","choices","disabled","onDropChoice","onRemoveChoice","correct","names","category","placeholderNames","placeholder","incorrect","map","c","index","React","Component","bool","object","func","styles","theme","border","color","minHeight","padding","spacing","unit","borderRadius","gridColumnGap","gridRowGap","display","flexWrap","justifyContent","alignItems","alignContent","flexDirection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,EAAE,EAAEC,sBAAUC,MAAV,CAAiBC,UADK;AAE1BC,EAAAA,UAAU,EAAEH,sBAAUC;AAFI,CAArB;;;IAKMG,Q;;;;;;;;;;;;WAYX,kBAAS;AACP,
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/category.jsx"],"names":["CategoryType","id","PropTypes","string","isRequired","categoryId","Category","props","classes","className","choices","disabled","onDropChoice","onRemoveChoice","correct","names","category","placeholderNames","placeholder","incorrect","map","c","index","React","Component","bool","object","func","styles","theme","border","color","minHeight","padding","spacing","unit","borderRadius","gridColumnGap","gridRowGap","display","flexWrap","justifyContent","alignItems","alignContent","flexDirection"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,YAAY,GAAG;AAC1BC,EAAAA,EAAE,EAAEC,sBAAUC,MAAV,CAAiBC,UADK;AAE1BC,EAAAA,UAAU,EAAEH,sBAAUC;AAFI,CAArB;;;IAKMG,Q;;;;;;;;;;;;WAYX,kBAAS;AACP,wBAAkG,KAAKC,KAAvG;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,4CAA4BC,OAA5B;AAAA,UAA4BA,OAA5B,oCAAsC,EAAtC;AAAA,UAA0CC,QAA1C,eAA0CA,QAA1C;AAAA,UAAoDC,YAApD,eAAoDA,YAApD;AAAA,UAAkEC,cAAlE,eAAkEA,cAAlE;AAAA,UAAkFZ,EAAlF,eAAkFA,EAAlF;AAAA,UAAsFa,OAAtF,eAAsFA,OAAtF;AAEA,UAAMC,KAAK,GAAG,4BAAWP,OAAO,CAACQ,QAAnB,EAA6BP,SAA7B,CAAd;AACA,UAAMQ,gBAAgB,GAAG,4BAAWT,OAAO,CAACU,WAAnB,EAAgCJ,OAAO,KAAK,KAAZ,IAAqBN,OAAO,CAACW,SAA7D,CAAzB;AAEA,0BACE;AAAK,QAAA,SAAS,EAAEJ;AAAhB,sBACE,gCAAC,gCAAD;AAAa,QAAA,YAAY,EAAEH,YAA3B;AAAyC,QAAA,QAAQ,EAAED,QAAnD;AAA6D,QAAA,SAAS,EAAEM;AAAxE,SACGP,OAAO,CAACU,GAAR,CAAY,UAACC,CAAD,EAAIC,KAAJ;AAAA,4BACX,gCAAC,kBAAD;AACE,UAAA,cAAc,EAAET,cADlB;AAEE,UAAA,QAAQ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from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport Choice from './choice';\nimport PlaceHolder from './droppable-placeholder';\nimport { color } from '@pie-lib/render-ui';\n\nexport const CategoryType = {\n id: PropTypes.string.isRequired,\n categoryId: PropTypes.string,\n};\n\nexport class Category extends React.Component {\n static propTypes = {\n ...CategoryType,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n classes: PropTypes.object.isRequired,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n };\n\n static defaultProps = {};\n\n render() {\n const { classes, className, choices = [], disabled, onDropChoice, onRemoveChoice, id, correct } = this.props;\n\n const names = classNames(classes.category, className);\n const placeholderNames = classNames(classes.placeholder, correct === false && classes.incorrect);\n\n return (\n <div className={names}>\n <PlaceHolder onDropChoice={onDropChoice} disabled={disabled} className={placeholderNames}>\n {choices.map((c, index) => (\n <Choice\n onRemoveChoice={onRemoveChoice}\n disabled={disabled}\n key={index}\n choiceIndex={index}\n categoryId={id}\n {...c}\n />\n ))}\n </PlaceHolder>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n incorrect: {\n border: `solid 2px ${color.incorrect()}`,\n },\n placeholder: {\n minHeight: '80px',\n padding: theme.spacing.unit / 2,\n borderRadius: theme.spacing.unit / 2,\n gridColumnGap: 0,\n gridRowGap: 0,\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'center',\n alignItems: 'center',\n alignContent: 'flex-start',\n },\n category: {\n display: 'flex',\n flexDirection: 'column',\n },\n});\n\nexport default withStyles(styles)(Category);\n"],"file":"category.js"}
|
package/lib/categorize/choice.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] = exports.
|
|
8
|
+
exports.spec = exports["default"] = exports.Layout = exports.ChoiceType = exports.Choice = void 0;
|
|
9
9
|
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
|
|
@@ -39,9 +39,9 @@ var _renderUi = require("@pie-lib/render-ui");
|
|
|
39
39
|
|
|
40
40
|
var _debug = _interopRequireDefault(require("debug"));
|
|
41
41
|
|
|
42
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
43
43
|
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
45
45
|
|
|
46
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/categorize/choice.jsx"],"names":["log","ChoiceType","content","PropTypes","string","isRequired","id","Layout","props","classes","className","isDragging","disabled","correct","rootNames","choice","dragging","cardNames","card","root","cardRoot","__html","React","Component","object","bool","styles","theme","direction","cursor","width","border","color","incorrect","borderRadius","text","backgroundColor","background","fontSize","typography","paddingBottom","spacing","unit","opacity","Styled","Choice","connectDragSource","extraStyle","margin","func","spec","canDrag","beginDrag","out","categoryId","choiceIndex","endDrag","monitor","didDrop","item","getItem","onRemoveChoice","DraggableChoice","uid","connect","dragSource","withUid"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;AAEO,IAAMC,UAAU,GAAG;AACxBC,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADF;AAExBC,EAAAA,EAAE,EAAEH,sBAAUC;AAFU,CAAnB;;;IAKMG,M;;;;;;;;;;;;WASX,kBAAS;AACP,
|
|
1
|
+
{"version":3,"sources":["../../src/categorize/choice.jsx"],"names":["log","ChoiceType","content","PropTypes","string","isRequired","id","Layout","props","classes","className","isDragging","disabled","correct","rootNames","choice","dragging","cardNames","card","root","cardRoot","__html","React","Component","object","bool","styles","theme","direction","cursor","width","border","color","incorrect","borderRadius","text","backgroundColor","background","fontSize","typography","paddingBottom","spacing","unit","opacity","Styled","Choice","connectDragSource","extraStyle","margin","func","spec","canDrag","beginDrag","out","categoryId","choiceIndex","endDrag","monitor","didDrop","item","getItem","onRemoveChoice","DraggableChoice","uid","connect","dragSource","withUid"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,GAAG,GAAG,uBAAM,2BAAN,CAAZ;AAEO,IAAMC,UAAU,GAAG;AACxBC,EAAAA,OAAO,EAAEC,sBAAUC,MAAV,CAAiBC,UADF;AAExBC,EAAAA,EAAE,EAAEH,sBAAUC;AAF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T,EAAqB;AACnBtD,QAAAA,GAAG,CAAC,8BAAD,CAAH;AACAQ,QAAAA,KAAK,CAACqD,cAAN,CAAqBF,IAArB;AACD;AACF;AACF;AAnBiB,CAAb;;AAsBP,IAAMG,eAAe,GAAG,0BACtB;AAAA,MAAGC,GAAH,QAAGA,GAAH;AAAA,SAAaA,GAAb;AAAA,CADsB,EAEtBb,IAFsB,EAGtB,UAACc,OAAD,EAAUP,OAAV;AAAA,SAAuB;AACrBX,IAAAA,iBAAiB,EAAEkB,OAAO,CAACC,UAAR,EADE;AAErBtD,IAAAA,UAAU,EAAE8C,OAAO,CAAC9C,UAAR;AAFS,GAAvB;AAAA,CAHsB,EAOtBkC,MAPsB,CAAxB;;eASekB,UAAIG,OAAJ,CAAYJ,eAAZ,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { DragSource } from 'react-dnd';\nimport { uid } from '@pie-lib/drag';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport { color } from '@pie-lib/render-ui';\nimport debug from 'debug';\n\nconst log = debug('@pie-ui:categorize:choice');\n\nexport const ChoiceType = {\n content: PropTypes.string.isRequired,\n id: PropTypes.string,\n};\n\nexport class Layout extends React.Component {\n static propTypes = {\n ...ChoiceType,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n static defaultProps = {};\n render() {\n const { classes, className, content, isDragging, disabled, correct } = this.props;\n\n const rootNames = classNames(\n correct === true && 'correct',\n correct === false && 'incorrect',\n classes.choice,\n isDragging && classes.dragging,\n disabled && classes.disabled,\n className,\n );\n const cardNames = classNames(classes.card);\n return (\n <div className={rootNames}>\n <Card className={cardNames}>\n <CardContent classes={{ root: classes.cardRoot }} dangerouslySetInnerHTML={{ __html: content }} />\n </Card>\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n choice: {\n direction: 'initial',\n cursor: 'pointer',\n width: '100%',\n '&.correct': {\n border: `solid 2px ${color.correct()}`,\n },\n '&.incorrect': {\n border: `solid 2px ${color.incorrect()}`,\n },\n borderRadius: '6px',\n },\n cardRoot: {\n color: color.text(),\n backgroundColor: color.background(),\n fontSize: theme.typography.fontSize + 2,\n '&:last-child': {\n paddingBottom: theme.spacing.unit * 2,\n },\n borderRadius: '4px',\n border: '1px solid',\n },\n disabled: {\n cursor: 'not-allowed',\n opacity: '0.6',\n },\n dragging: {\n cursor: 'move',\n },\n card: {\n color: color.text(),\n backgroundColor: color.background(),\n width: '100%',\n },\n});\n\nconst Styled = withStyles(styles)(Layout);\n\nexport class Choice extends React.Component {\n static propTypes = {\n ...ChoiceType,\n extraStyle: PropTypes.object,\n connectDragSource: PropTypes.func.isRequired,\n };\n\n render() {\n const { connectDragSource, id, content, disabled, isDragging, correct, extraStyle } = this.props;\n\n return connectDragSource(\n <div style={{ margin: '4px', ...extraStyle }}>\n <Styled id={id} content={content} disabled={disabled} correct={correct} isDragging={isDragging} />\n </div>,\n );\n }\n}\n\nexport const spec = {\n canDrag: (props) => !props.disabled,\n beginDrag: (props) => {\n const out = {\n id: props.id,\n categoryId: props.categoryId,\n choiceIndex: props.choiceIndex,\n };\n log('[beginDrag] out:', out);\n return out;\n },\n endDrag: (props, monitor) => {\n if (!monitor.didDrop()) {\n const item = monitor.getItem();\n if (item.categoryId) {\n log('wasnt droppped - what to do?');\n props.onRemoveChoice(item);\n }\n }\n },\n};\n\nconst DraggableChoice = DragSource(\n ({ uid }) => uid,\n spec,\n (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging(),\n }),\n)(Choice);\n\nexport default uid.withUid(DraggableChoice);\n"],"file":"choice.js"}
|