@pie-element/explicit-constructed-response 3.12.0 → 3.12.1-beta.1443
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 +350 -0
- package/configure/CHANGELOG.md +330 -0
- package/configure/lib/alternateResponses.js +13 -7
- package/configure/lib/alternateResponses.js.map +1 -1
- package/configure/lib/alternateSection.js +39 -17
- package/configure/lib/alternateSection.js.map +1 -1
- package/configure/lib/defaults.js +28 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/ecr-toolbar.js +15 -6
- package/configure/lib/ecr-toolbar.js.map +1 -1
- package/configure/lib/index.js +16 -2
- package/configure/lib/index.js.map +1 -1
- package/configure/lib/main.js +234 -74
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +9 -3
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +15 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +23 -5
- package/controller/CHANGELOG.md +40 -0
- package/controller/lib/index.js +64 -6
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +2 -2
- package/docs/config-schema.json +121 -0
- package/docs/config-schema.json.md +93 -1
- package/docs/demo/config.js +2 -2
- package/docs/demo/generate.js +4 -3
- package/docs/pie-schema.json +39 -0
- package/docs/pie-schema.json.md +28 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/main.js +6 -3
- package/lib/main.js.map +1 -1
- package/lib/print.js +2 -2
- package/lib/print.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -1953
- package/module/controller.js +0 -21340
- package/module/demo.js +0 -45
- package/module/element.js +0 -14384
- package/module/index.html +0 -21
- package/module/manifest.json +0 -18
- package/module/print-demo.js +0 -83
- package/module/print.html +0 -18
- package/module/print.js +0 -14331
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,336 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [4.4.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.3.0...@pie-element/explicit-constructed-response-configure@4.4.0) (2023-01-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update pie-libs ([6423903](https://github.com/pie-framework/pie-elements/commit/6423903898b041f56db2111de2e4aac4ee9f1fd3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [4.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.6...@pie-element/explicit-constructed-response-configure@4.3.0) (2023-01-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* update pie-libs ([b174476](https://github.com/pie-framework/pie-elements/commit/b174476729119a0689f1f8adfc8c235246676cab))
|
|
23
|
+
* update pie-libs ([f72c3c8](https://github.com/pie-framework/pie-elements/commit/f72c3c8d8bc9bbf061bb81502317157a63c22972))
|
|
24
|
+
* update pie-libs ([8490729](https://github.com/pie-framework/pie-elements/commit/8490729a2389d36fd3968f0806119fde96577842))
|
|
25
|
+
* **explicit-constructed-response:** added configuration prop to hide the settings panel PD-1999 ([8aec356](https://github.com/pie-framework/pie-elements/commit/8aec3566ad4e3b7c190bfabb5d1e65dc5e735a8f))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [4.2.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.5...@pie-element/explicit-constructed-response-configure@4.2.6) (2022-12-21)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* updated pie-libs ([8cb5b90](https://github.com/pie-framework/pie-elements/commit/8cb5b90d501ccbdf5ffd764e6555faa48b8f54d6))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## [4.2.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.4...@pie-element/explicit-constructed-response-configure@4.2.5) (2022-12-20)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* updated pie-libs ([6549302](https://github.com/pie-framework/pie-elements/commit/65493026fbf356c5ab752ae6a14d961d4b256368))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## [4.2.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.3...@pie-element/explicit-constructed-response-configure@4.2.4) (2022-12-07)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* update libs ([441f403](https://github.com/pie-framework/pie-elements/commit/441f403870b7bec0d61fab58b8d93dbe0ead4c32))
|
|
59
|
+
* update libs for PD-2030 PD-2031 ([3174022](https://github.com/pie-framework/pie-elements/commit/3174022d45603ed217bbe8804a142b07084636a5))
|
|
60
|
+
* updated lib PD-1715 ([42e788d](https://github.com/pie-framework/pie-elements/commit/42e788db0c792838994e55001952da7701251a8e))
|
|
61
|
+
* updated libs ([c20de3a](https://github.com/pie-framework/pie-elements/commit/c20de3a6ba4499a090c809e18e52588d2a585fa0))
|
|
62
|
+
* updated libs ([0eed79a](https://github.com/pie-framework/pie-elements/commit/0eed79a32c3b777c16c8cabf201513fc1d2726a0))
|
|
63
|
+
* updated libs ([343c9ec](https://github.com/pie-framework/pie-elements/commit/343c9ec3dccba7f781e90ae2bd195cac6f78f467))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## [4.2.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.2...@pie-element/explicit-constructed-response-configure@4.2.3) (2022-11-15)
|
|
70
|
+
|
|
71
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## [4.2.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.1...@pie-element/explicit-constructed-response-configure@4.2.2) (2022-11-11)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
* **explicit-constructed-response:** add sanity checks for withRubric ([8be2af0](https://github.com/pie-framework/pie-elements/commit/8be2af0bbe35d0e8ad3f7270cd3c390f9bb1c558))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
## [4.2.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.2.0...@pie-element/explicit-constructed-response-configure@4.2.1) (2022-10-31)
|
|
89
|
+
|
|
90
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# [4.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.9...@pie-element/explicit-constructed-response-configure@4.2.0) (2022-10-17)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* update snapshots ([9781596](https://github.com/pie-framework/pie-elements/commit/978159686bbbd6b727dff4b88ce4ab9606504586))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
* set withRubric to false in item default configurations. Set rubricEnabled to true if it's enabled for drawing-response and extended-text-entry ([a209057](https://github.com/pie-framework/pie-elements/commit/a209057f5a3fa5438efc8595453c89c11959a8f5))
|
|
107
|
+
* update libs ([7e174fb](https://github.com/pie-framework/pie-elements/commit/7e174fba75e7ea668900ad5c103751cefe33e2af))
|
|
108
|
+
* **explicit-constructed-response:** add pie-api config PD-23 ([df3e8bd](https://github.com/pie-framework/pie-elements/commit/df3e8bdbb19a3d6356f4bd639ab34aaac5068d61))
|
|
109
|
+
* **explicit-constructed-response:** add settings to enable rubric. Add withRubric prop to configuration and rubricEnabled prop to model PD-2097 ([8c0acd3](https://github.com/pie-framework/pie-elements/commit/8c0acd3c19cf0cbf9ef39e1e045f895f996c9127))
|
|
110
|
+
* **explicit-constructed-response:** updated snapshot PD-2097 ([a04ac3d](https://github.com/pie-framework/pie-elements/commit/a04ac3d45a591db3513a9ccd1293d04e5dce5049))
|
|
111
|
+
* enable spanish and special characters in author PD-2120 ([85fd3dd](https://github.com/pie-framework/pie-elements/commit/85fd3dd0fc10da1a2dfd5a842809c625790f8ba9))
|
|
112
|
+
* **explicit-constructed-response:** add uploadSoundSupport property PD-23-updated ([f701b37](https://github.com/pie-framework/pie-elements/commit/f701b37884cb81499c1be1b16fa6de5c6d5a1b5f))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## [4.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.8...@pie-element/explicit-constructed-response-configure@4.1.9) (2022-09-29)
|
|
119
|
+
|
|
120
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
## [4.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.7...@pie-element/explicit-constructed-response-configure@4.1.8) (2022-09-14)
|
|
127
|
+
|
|
128
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## [4.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.6...@pie-element/explicit-constructed-response-configure@4.1.7) (2022-08-31)
|
|
135
|
+
|
|
136
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## [4.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.5...@pie-element/explicit-constructed-response-configure@4.1.6) (2022-08-16)
|
|
143
|
+
|
|
144
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## [4.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.4...@pie-element/explicit-constructed-response-configure@4.1.5) (2022-08-08)
|
|
151
|
+
|
|
152
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## [4.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.3...@pie-element/explicit-constructed-response-configure@4.1.4) (2022-08-02)
|
|
159
|
+
|
|
160
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## [4.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.2...@pie-element/explicit-constructed-response-configure@4.1.3) (2022-07-22)
|
|
167
|
+
|
|
168
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## [4.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.1...@pie-element/explicit-constructed-response-configure@4.1.2) (2022-07-20)
|
|
175
|
+
|
|
176
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## [4.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.1.0...@pie-element/explicit-constructed-response-configure@4.1.1) (2022-07-19)
|
|
183
|
+
|
|
184
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
# [4.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@4.0.0...@pie-element/explicit-constructed-response-configure@4.1.0) (2022-06-28)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Bug Fixes
|
|
194
|
+
|
|
195
|
+
* **explicit-constructed-response:** change validation messsage ([dff4964](https://github.com/pie-framework/pie-elements/commit/dff49645a4b814686bfaba18298b064e174c717a))
|
|
196
|
+
* clean up ([53cea01](https://github.com/pie-framework/pie-elements/commit/53cea01bd199a2f000035e9dad455fae5a6be452))
|
|
197
|
+
* error fucntion ([9b4a145](https://github.com/pie-framework/pie-elements/commit/9b4a145874ad19c14f558dad8bf505d3ae8a3857))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
### Features
|
|
201
|
+
|
|
202
|
+
* **inline-dropdown, drag-in-the-blank, explicit-constructed-response:** set config default for maxRespponseAreas ([a9e9dc5](https://github.com/pie-framework/pie-elements/commit/a9e9dc5ff43199c946f4226790d924ab5d8674ed))
|
|
203
|
+
* PD-1706 validation ui/ux ([265c248](https://github.com/pie-framework/pie-elements/commit/265c248ecd10d7a108f8d4abddd40824e4b2f0f4))
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
# [4.0.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.8.4...@pie-element/explicit-constructed-response-configure@4.0.0) (2022-06-28)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### chore
|
|
213
|
+
|
|
214
|
+
* Merge master with develop. ([cdca48a](https://github.com/pie-framework/pie-elements/commit/cdca48abaa1d4179e4a961e13d171e14b7ed2444))
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
### BREAKING CHANGES
|
|
218
|
+
|
|
219
|
+
* Image percent buttons were removed from toolbar.
|
|
220
|
+
New properties maxImageWidth and maxImageHeight were added.
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## [3.8.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.8.3...@pie-element/explicit-constructed-response-configure@3.8.4) (2022-06-13)
|
|
227
|
+
|
|
228
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
## [3.8.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.8.2...@pie-element/explicit-constructed-response-configure@3.8.3) (2022-05-30)
|
|
235
|
+
|
|
236
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## [3.8.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.8.1...@pie-element/explicit-constructed-response-configure@3.8.2) (2022-05-16)
|
|
243
|
+
|
|
244
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## [3.8.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.8.0...@pie-element/explicit-constructed-response-configure@3.8.1) (2022-05-09)
|
|
251
|
+
|
|
252
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
# [3.8.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.7...@pie-element/explicit-constructed-response-configure@3.8.0) (2022-05-03)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
### Bug Fixes
|
|
262
|
+
|
|
263
|
+
* **explcit-constructed-response, inline-dropdown, drag-in-the-blank:** Fixed some math symbols rendering PD-1535 ([98b99ff](https://github.com/pie-framework/pie-elements/commit/98b99ff26742c15563b365c7fbb7fab981f057d8))
|
|
264
|
+
* **explicit-constructed-response:** Adjusted minimum and maximum values for MaxLengthPerChoice PD-1552 ([3ab3398](https://github.com/pie-framework/pie-elements/commit/3ab3398cc8c92a0effc492f7dc06c92ffc51eac0))
|
|
265
|
+
* **explicit-constructed-response:** Maximum Length field should always appear when Maximum Length Per Choice is set to true PD-1591 ([153123e](https://github.com/pie-framework/pie-elements/commit/153123ebb4162c8cb342bc7c6a979d68abc4b0c3))
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
### Features
|
|
269
|
+
|
|
270
|
+
* **choices:** implemented response deletion and undo capabilities [PD-1592] ([158a6e1](https://github.com/pie-framework/pie-elements/commit/158a6e1cb67a1804af28acb4c731daaf40d8435a))
|
|
271
|
+
* **choices:** made sure adding a choice changes the markup [PD-1592] ([26768c0](https://github.com/pie-framework/pie-elements/commit/26768c0c04085d254633d099e45aaa68d7a4a269))
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
## [3.7.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.6...@pie-element/explicit-constructed-response-configure@3.7.7) (2022-04-12)
|
|
278
|
+
|
|
279
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
## [3.7.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.5...@pie-element/explicit-constructed-response-configure@3.7.6) (2022-03-28)
|
|
286
|
+
|
|
287
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
## [3.7.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.4...@pie-element/explicit-constructed-response-configure@3.7.5) (2022-03-22)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### Bug Fixes
|
|
297
|
+
|
|
298
|
+
* test ([61f9577](https://github.com/pie-framework/pie-elements/commit/61f95775a3086c6a4fce64c46b31b15b081f4243))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
## [3.7.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.3...@pie-element/explicit-constructed-response-configure@3.7.4) (2022-03-08)
|
|
305
|
+
|
|
306
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
## [3.7.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.2...@pie-element/explicit-constructed-response-configure@3.7.3) (2022-03-08)
|
|
313
|
+
|
|
314
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
## [3.7.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.1...@pie-element/explicit-constructed-response-configure@3.7.2) (2022-02-21)
|
|
321
|
+
|
|
322
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
## [3.7.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.7.0...@pie-element/explicit-constructed-response-configure@3.7.1) (2022-02-04)
|
|
329
|
+
|
|
330
|
+
**Note:** Version bump only for package @pie-element/explicit-constructed-response-configure
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
6
336
|
# [3.7.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@3.6.9...@pie-element/explicit-constructed-response-configure@3.7.0) (2022-01-24)
|
|
7
337
|
|
|
8
338
|
|
|
@@ -37,9 +37,9 @@ var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
|
37
37
|
|
|
38
38
|
var _alternateSection = _interopRequireDefault(require("./alternateSection"));
|
|
39
39
|
|
|
40
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
40
|
+
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; }
|
|
41
41
|
|
|
42
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
42
|
+
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; }
|
|
43
43
|
|
|
44
44
|
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); }; }
|
|
45
45
|
|
|
@@ -177,9 +177,12 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
|
|
|
177
177
|
var _this2 = this;
|
|
178
178
|
|
|
179
179
|
var choices = this.state.choices;
|
|
180
|
-
var _this$
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
var _this$props2 = this.props,
|
|
181
|
+
_this$props2$model = _this$props2.model,
|
|
182
|
+
maxLengthPerChoice = _this$props2$model.maxLengthPerChoice,
|
|
183
|
+
maxLengthPerChoiceEnabled = _this$props2$model.maxLengthPerChoiceEnabled,
|
|
184
|
+
spellCheck = _this$props2.spellCheck,
|
|
185
|
+
choicesErrors = _this$props2.choicesErrors;
|
|
183
186
|
return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
|
|
184
187
|
// if maxLengthPerChoiceEnabled is true, we display all the choices
|
|
185
188
|
if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
|
|
@@ -187,6 +190,7 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
|
|
|
187
190
|
return /*#__PURE__*/_react["default"].createElement(_alternateSection["default"], {
|
|
188
191
|
key: key,
|
|
189
192
|
value: selected && selected.value,
|
|
193
|
+
errors: choicesErrors && choicesErrors[key],
|
|
190
194
|
onSelect: function onSelect(choice) {
|
|
191
195
|
return _this2.onSectionSelect(choice, key);
|
|
192
196
|
},
|
|
@@ -202,7 +206,8 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
|
|
|
202
206
|
selectChoices: [selected],
|
|
203
207
|
choices: c,
|
|
204
208
|
maxLength: maxLengthPerChoice[key],
|
|
205
|
-
showMaxLength: maxLengthPerChoiceEnabled
|
|
209
|
+
showMaxLength: maxLengthPerChoiceEnabled,
|
|
210
|
+
spellCheck: spellCheck
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
213
|
}), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && /*#__PURE__*/_react["default"].createElement(_alternateSection["default"], {
|
|
@@ -216,7 +221,8 @@ var AlternateResponses = /*#__PURE__*/function (_React$Component) {
|
|
|
216
221
|
choiceRemoved: function choiceRemoved(value) {
|
|
217
222
|
return _this2.onChoiceRemoved(value);
|
|
218
223
|
},
|
|
219
|
-
selectChoices: this.getRemainingChoices()
|
|
224
|
+
selectChoices: this.getRemainingChoices(),
|
|
225
|
+
spellCheck: spellCheck
|
|
220
226
|
}));
|
|
221
227
|
}
|
|
222
228
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/alternateResponses.jsx"],"names":["AlternateResponses","maxLengthPerChoice","props","model","state","choices","values","Object","keys","length","maxLengthPerChoiceEnabled","selectedValues","obj","c","key","setState","valueKey","arr","push","label","value","choice","onChange","sectionChoices","isNew","find","newChoices","reduce","newVal","section","onLengthChange","nextProps","updateChoicesIfNeeded","selected","onSectionSelect","onChoiceChanged","onChoiceRemoved","onLengthChanged","getRemainingChoices","React","Component","PropTypes","object","isRequired","func","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEaA,kB;;;;;;;;;;;;;;;8FAQH;AAAEC,MAAAA,kBAAkB,EAAE,2BAAU,MAAKC,KAAL,CAAWC,KAAX,CAAiBF,kBAA3B;AAAtB,K;8GAUgB,UAAAC,KAAK,EAAI;AAC/B,UAAI,CAAC,MAAKE,KAAL,CAAWC,OAAZ,IACC,CAAC,yBAAQ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AA,yBAAyB,EAAE+B,sBAAUI,IAAV,CAAeF;AAJzB,C;eA0LN3C,kB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport map from 'lodash/map';\nimport reduce from 'lodash/reduce';\nimport cloneDeep from 'lodash/cloneDeep';\n\nimport AlternateSection from './alternateSection';\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired\n };\n\n state = { maxLengthPerChoice: cloneDeep(this.props.model.maxLengthPerChoice) };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = props => {\n if (!this.state.choices\n || !isEqual(this.state.choices, props.model.choices)\n || !isEqual(props.model.choices, this.props.model.choices)\n || (this.state.values && Object.keys(this.state.values).length !== Object.keys(this.props.model.choices).length)\n || props.maxLengthPerChoiceEnabled !== this.props.maxLengthPerChoiceEnabled\n ) {\n const { choices, maxLengthPerChoice } = props.model;\n\n const selectedValues = reduce(choices, (obj, c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {\n obj[key] = c[0];\n }\n\n return obj;\n }, {});\n\n this.setState({\n choices: props.model.choices,\n values: selectedValues,\n maxLengthPerChoice: cloneDeep(maxLengthPerChoice)\n });\n }\n };\n\n getRemainingChoices = valueKey => {\n const { choices } = this.state;\n\n return reduce(choices, (arr, c, key) => {\n if (c && c.length === 1 && !valueKey) {\n arr.push({\n label: c[0].label,\n value: key\n });\n }\n\n return arr;\n }, []);\n };\n\n onChoiceChanged = (choice, key) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[key] || []);\n\n const isNew = !sectionChoices.find(c => c.value === choice.value);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n const newVal = c.value === choice.value ? choice : c;\n\n arr.push(newVal);\n\n return arr;\n }, []);\n\n if (isNew) {\n newChoices.push(choice);\n }\n\n onChange({\n ...choices,\n [key]: newChoices\n });\n };\n\n onChoiceRemoved = (value, section) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = (choices[section] || []);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n if (c.value === value) {\n return arr;\n }\n\n arr.push(c);\n\n return arr;\n }, []);\n\n onChange({\n ...choices,\n [section]: newChoices\n });\n };\n\n onSectionSelect = (choice, key) => {\n const { onChange } = this.props;\n const { choices, values } = this.state;\n\n if (choices[key] && choices[key].length > 1) {\n if (!choice) {\n onChange({\n ...choices,\n [key]: [choices[key][0]]\n });\n }\n } else {\n this.setState({\n choices: {\n ...choices,\n [key]: [\n ...choices[key],\n {\n label: '',\n value: '1'\n }\n ]\n },\n values: {\n ...values,\n [key]: choices[key][0]\n }\n });\n }\n };\n\n onLengthChanged = (value, key) => {\n const { model, onLengthChange } = this.props;\n const { maxLengthPerChoice } = model;\n\n maxLengthPerChoice[key] = value;\n onLengthChange(maxLengthPerChoice);\n }\n\n render() {\n const { choices } = this.state;\n const { model: { maxLengthPerChoice, maxLengthPerChoiceEnabled }} = this.props\n\n return (\n <div>\n {map(choices, (c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {\n const selected = this.state.values[key];\n\n return (\n <AlternateSection\n key={key}\n value={selected && selected.value}\n onSelect={choice => this.onSectionSelect(choice, key)}\n choiceChanged={choice => this.onChoiceChanged(choice, key)}\n choiceRemoved={value => this.onChoiceRemoved(value, key)}\n lengthChanged={value => this.onLengthChanged(value, key)}\n selectChoices={[selected]}\n choices={c}\n maxLength={maxLengthPerChoice[key]}\n showMaxLength={maxLengthPerChoiceEnabled}\n />\n );\n }\n })}\n {\n choices &&\n Object.keys(this.state.values).length !== Object.keys(choices).length &&\n <AlternateSection\n value=\"\"\n onSelect={choice => this.onSectionSelect(choice, choice.value)}\n choiceChanged={choice => this.onChoiceChanged(choice)}\n choiceRemoved={value => this.onChoiceRemoved(value)}\n selectChoices={this.getRemainingChoices()}\n />\n }\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"file":"alternateResponses.js"}
|
|
1
|
+
{"version":3,"sources":["../src/alternateResponses.jsx"],"names":["AlternateResponses","maxLengthPerChoice","props","model","state","choices","values","Object","keys","length","maxLengthPerChoiceEnabled","selectedValues","obj","c","key","setState","valueKey","arr","push","label","value","choice","onChange","sectionChoices","isNew","find","newChoices","reduce","newVal","section","onLengthChange","nextProps","updateChoicesIfNeeded","spellCheck","choicesErrors","selected","onSectionSelect","onChoiceChanged","onChoiceRemoved","onLengthChanged","getRemainingChoices","React","Component","PropTypes","object","isRequired","func","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEaA,kB;;;;;;;;;;;;;;;8FAQH;AAAEC,MAAAA,kBAAkB,EAAE,2BAAU,MAAKC,KAAL,CAAWC,KAAX,CAAiBF,kBAA3B;AAAtB,K;8GAUgB,UAACC,KAAD,EAAW;AACjC,UACE,CAAC,MAAKE,KAAL,CAAWC,OAAZ,IACA,CAAC,yBAAQ,MAAKD,KAAL,CAAWC,OAAnB,EAA4BH,KAAK,CAACC,KAAN,CAAYE,OAAxC,CADD,IAEA,CAAC,yBAAQH,KAAK,CAACC,KAAN,CAAYE,OAApB,EAA6B,MAAKH,KAAL,CAAWC,KAAX,CAAiBE,OAA9C,CAFD,IAGC,MAAKD,KAAL,CAAWE,MAAX,IAAqBC,MAAM,CAACC,IAAP,CAAY,MAAKJ,KAAL,CAAWE,MAAvB,EAA+BG,MAA/B,KAA0CF,MAAM,CAACC,IAAP,CAAY,MAAKN,KAAL,CAAWC,KAAX,CAAiBE,OAA7B,EAAsCI,MA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OAAO,EAAEtB,CATX;AAUE,YAAA,SAAS,EAAEZ,kBAAkB,CAACa,GAAD,CAV/B;AAWE,YAAA,aAAa,EAAEJ,yBAXjB;AAYE,YAAA,UAAU,EAAEuB;AAZd,YADF;AAgBD;AACF,OAtBA,CADH,EAwBG5B,OAAO,IAAIE,MAAM,CAACC,IAAP,CAAY,KAAKJ,KAAL,CAAWE,MAAvB,EAA+BG,MAA/B,KAA0CF,MAAM,CAACC,IAAP,CAAYH,OAAZ,EAAqBI,MAA1E,iBACC,gCAAC,4BAAD;AACE,QAAA,KAAK,EAAC,EADR;AAEE,QAAA,QAAQ,EAAE,kBAACY,MAAD;AAAA,iBAAY,MAAI,CAACe,eAAL,CAAqBf,MAArB,EAA6BA,MAAM,CAACD,KAApC,CAAZ;AAAA,SAFZ;AAGE,QAAA,aAAa,EAAE,uBAACC,MAAD;AAAA,iBAAY,MAAI,CAACgB,eAAL,CAAqBhB,MAArB,CAAZ;AAAA,SAHjB;AAIE,QAAA,aAAa,EAAE,uBAACD,KAAD;AAAA,iBAAW,MAAI,CAACkB,eAAL,CAAqBlB,KAArB,CAAX;AAAA,SAJjB;AAKE,QAAA,aAAa,EAAE,KAAKoB,mBAAL,EALjB;AAME,QAAA,UAAU,EAAEP;AANd,QAzBJ,CADF;AAqCD;;;EAtMqCQ,kBAAMC,S;;;iCAAjC1C,kB,eACQ;AACjBG,EAAAA,KAAK,EAAEwC,sBAAUC,MAAV,CAAiBC,UADP;AAEjBvB,EAAAA,QAAQ,EAAEqB,sBAAUG,IAAV,CAAeD,UAFR;AAGjBf,EAAAA,cAAc,EAAEa,sBAAUG,IAAV,CAAeD,UAHd;AAIjBnC,EAAAA,yBAAyB,EAAEiC,sBAAUI,IAAV,CAAeF;AAJzB,C;eAwMN7C,kB","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport isEqual from 'lodash/isEqual';\nimport map from 'lodash/map';\nimport reduce from 'lodash/reduce';\nimport cloneDeep from 'lodash/cloneDeep';\n\nimport AlternateSection from './alternateSection';\n\nexport class AlternateResponses extends React.Component {\n static propTypes = {\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired,\n };\n\n state = { maxLengthPerChoice: cloneDeep(this.props.model.maxLengthPerChoice) };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.updateChoicesIfNeeded(nextProps);\n }\n\n componentDidMount() {\n this.updateChoicesIfNeeded(this.props);\n }\n\n updateChoicesIfNeeded = (props) => {\n if (\n !this.state.choices ||\n !isEqual(this.state.choices, props.model.choices) ||\n !isEqual(props.model.choices, this.props.model.choices) ||\n (this.state.values && Object.keys(this.state.values).length !== Object.keys(this.props.model.choices).length) ||\n props.maxLengthPerChoiceEnabled !== this.props.maxLengthPerChoiceEnabled\n ) {\n const { choices, maxLengthPerChoice } = props.model;\n\n const selectedValues = reduce(\n choices,\n (obj, c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {\n obj[key] = c[0];\n }\n\n return obj;\n },\n {},\n );\n\n this.setState({\n choices: props.model.choices,\n values: selectedValues,\n maxLengthPerChoice: cloneDeep(maxLengthPerChoice),\n });\n }\n };\n\n getRemainingChoices = (valueKey) => {\n const { choices } = this.state;\n\n return reduce(\n choices,\n (arr, c, key) => {\n if (c && c.length === 1 && !valueKey) {\n arr.push({\n label: c[0].label,\n value: key,\n });\n }\n\n return arr;\n },\n [],\n );\n };\n\n onChoiceChanged = (choice, key) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = choices[key] || [];\n\n const isNew = !sectionChoices.find((c) => c.value === choice.value);\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n const newVal = c.value === choice.value ? choice : c;\n\n arr.push(newVal);\n\n return arr;\n }, []);\n\n if (isNew) {\n newChoices.push(choice);\n }\n\n onChange({\n ...choices,\n [key]: newChoices,\n });\n };\n\n onChoiceRemoved = (value, section) => {\n const { onChange } = this.props;\n const { choices } = this.state;\n const sectionChoices = choices[section] || [];\n\n const newChoices = sectionChoices.reduce((arr, c) => {\n if (c.value === value) {\n return arr;\n }\n\n arr.push(c);\n\n return arr;\n }, []);\n\n onChange({\n ...choices,\n [section]: newChoices,\n });\n };\n\n onSectionSelect = (choice, key) => {\n const { onChange } = this.props;\n const { choices, values } = this.state;\n\n if (choices[key] && choices[key].length > 1) {\n if (!choice) {\n onChange({\n ...choices,\n [key]: [choices[key][0]],\n });\n }\n } else {\n this.setState({\n choices: {\n ...choices,\n [key]: [\n ...choices[key],\n {\n label: '',\n value: '1',\n },\n ],\n },\n values: {\n ...values,\n [key]: choices[key][0],\n },\n });\n }\n };\n\n onLengthChanged = (value, key) => {\n const { model, onLengthChange } = this.props;\n const { maxLengthPerChoice } = model;\n\n maxLengthPerChoice[key] = value;\n onLengthChange(maxLengthPerChoice);\n };\n\n render() {\n const { choices } = this.state;\n const {\n model: { maxLengthPerChoice, maxLengthPerChoiceEnabled },\n spellCheck,\n choicesErrors,\n } = this.props;\n\n return (\n <div>\n {map(choices, (c, key) => {\n // if maxLengthPerChoiceEnabled is true, we display all the choices\n if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {\n const selected = this.state.values[key];\n\n return (\n <AlternateSection\n key={key}\n value={selected && selected.value}\n errors={choicesErrors && choicesErrors[key]}\n onSelect={(choice) => this.onSectionSelect(choice, key)}\n choiceChanged={(choice) => this.onChoiceChanged(choice, key)}\n choiceRemoved={(value) => this.onChoiceRemoved(value, key)}\n lengthChanged={(value) => this.onLengthChanged(value, key)}\n selectChoices={[selected]}\n choices={c}\n maxLength={maxLengthPerChoice[key]}\n showMaxLength={maxLengthPerChoiceEnabled}\n spellCheck={spellCheck}\n />\n );\n }\n })}\n {choices && Object.keys(this.state.values).length !== Object.keys(choices).length && (\n <AlternateSection\n value=\"\"\n onSelect={(choice) => this.onSectionSelect(choice, choice.value)}\n choiceChanged={(choice) => this.onChoiceChanged(choice)}\n choiceRemoved={(value) => this.onChoiceRemoved(value)}\n selectChoices={this.getRemainingChoices()}\n spellCheck={spellCheck}\n />\n )}\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"file":"alternateResponses.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.Choice = exports.AlternateSection = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
@@ -47,13 +47,15 @@ var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
|
47
47
|
|
|
48
48
|
var _styles = require("@material-ui/core/styles");
|
|
49
49
|
|
|
50
|
-
var _markupUtils = require("./markupUtils");
|
|
51
|
-
|
|
52
50
|
var _max = _interopRequireDefault(require("lodash/max"));
|
|
53
51
|
|
|
54
|
-
|
|
52
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
53
|
+
|
|
54
|
+
var _markupUtils = require("./markupUtils");
|
|
55
|
+
|
|
56
|
+
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; }
|
|
55
57
|
|
|
56
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
58
|
+
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; }
|
|
57
59
|
|
|
58
60
|
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); }; }
|
|
59
61
|
|
|
@@ -91,6 +93,15 @@ var styles = function styles() {
|
|
|
91
93
|
lengthField: {
|
|
92
94
|
width: '230px',
|
|
93
95
|
marginRight: '20px'
|
|
96
|
+
},
|
|
97
|
+
errorText: {
|
|
98
|
+
fontSize: '12px',
|
|
99
|
+
color: 'red',
|
|
100
|
+
paddingTop: '5px'
|
|
101
|
+
},
|
|
102
|
+
inputError: {
|
|
103
|
+
border: '2px solid red',
|
|
104
|
+
borderRadius: '6px'
|
|
94
105
|
}
|
|
95
106
|
};
|
|
96
107
|
};
|
|
@@ -141,24 +152,29 @@ var Choice = /*#__PURE__*/function (_React$Component) {
|
|
|
141
152
|
var value = this.state.value;
|
|
142
153
|
var _this$props = this.props,
|
|
143
154
|
classes = _this$props.classes,
|
|
144
|
-
onDelete = _this$props.onDelete
|
|
145
|
-
|
|
155
|
+
onDelete = _this$props.onDelete,
|
|
156
|
+
spellCheck = _this$props.spellCheck,
|
|
157
|
+
error = _this$props.error;
|
|
158
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
146
159
|
style: {
|
|
147
160
|
alignItems: 'center',
|
|
148
161
|
display: 'flex',
|
|
149
162
|
justifyContent: 'space-between'
|
|
150
163
|
}
|
|
151
164
|
}, /*#__PURE__*/_react["default"].createElement(_OutlinedInput["default"], {
|
|
152
|
-
className: classes.choice,
|
|
165
|
+
className: (0, _classnames["default"])(classes.choice, error && classes.inputError),
|
|
153
166
|
value: value,
|
|
154
167
|
onChange: this.onChange,
|
|
155
168
|
labelWidth: 0,
|
|
156
|
-
disableUnderline: true
|
|
169
|
+
disableUnderline: true,
|
|
170
|
+
spellCheck: spellCheck
|
|
157
171
|
}), /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
158
172
|
"aria-label": "delete",
|
|
159
173
|
className: classes.deleteBtn,
|
|
160
174
|
onClick: onDelete
|
|
161
|
-
}, /*#__PURE__*/_react["default"].createElement(_Delete["default"], null)))
|
|
175
|
+
}, /*#__PURE__*/_react["default"].createElement(_Delete["default"], null))), error && /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
|
+
className: classes.errorText
|
|
177
|
+
}, error));
|
|
162
178
|
}
|
|
163
179
|
}]);
|
|
164
180
|
return Choice;
|
|
@@ -233,13 +249,13 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
|
|
|
233
249
|
return (choice.label || '').length;
|
|
234
250
|
});
|
|
235
251
|
labelLengthsArr[index] = value.length;
|
|
236
|
-
var newLength =
|
|
252
|
+
var newLength = Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
237
253
|
choiceChanged(_objectSpread(_objectSpread({}, choice), {}, {
|
|
238
254
|
label: value
|
|
239
255
|
}));
|
|
240
256
|
|
|
241
|
-
if (newLength > maxLength || newLength + 10
|
|
242
|
-
lengthChanged(newLength);
|
|
257
|
+
if (newLength > maxLength || newLength + 10 <= maxLength) {
|
|
258
|
+
lengthChanged((0, _markupUtils.getAdjustedLength)(newLength));
|
|
243
259
|
}
|
|
244
260
|
});
|
|
245
261
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onRemoveChoice", function (choice) {
|
|
@@ -256,7 +272,7 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
|
|
|
256
272
|
var labelLengthsArr = choices.map(function (choice) {
|
|
257
273
|
return (choice.label || '').length;
|
|
258
274
|
});
|
|
259
|
-
return
|
|
275
|
+
return Math.max.apply(Math, (0, _toConsumableArray2["default"])(labelLengthsArr));
|
|
260
276
|
});
|
|
261
277
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "changeLength", function (event) {
|
|
262
278
|
var lengthChanged = _this2.props.lengthChanged;
|
|
@@ -291,7 +307,9 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
|
|
|
291
307
|
selectChoices = _this$props2.selectChoices,
|
|
292
308
|
maxLength = _this$props2.maxLength,
|
|
293
309
|
showMaxLength = _this$props2.showMaxLength,
|
|
294
|
-
value = _this$props2.value
|
|
310
|
+
value = _this$props2.value,
|
|
311
|
+
spellCheck = _this$props2.spellCheck,
|
|
312
|
+
errors = _this$props2.errors;
|
|
295
313
|
var choices = this.state.choices;
|
|
296
314
|
var minLength = this.getChoicesMaxLength();
|
|
297
315
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -328,7 +346,9 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
|
|
|
328
346
|
variant: "contained",
|
|
329
347
|
color: "primary",
|
|
330
348
|
onClick: this.onAddChoice
|
|
331
|
-
}, "Add"))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
349
|
+
}, "Add"))), errors && errors[0] && /*#__PURE__*/_react["default"].createElement("div", {
|
|
350
|
+
className: classes.errorText
|
|
351
|
+
}, errors[0]), /*#__PURE__*/_react["default"].createElement("div", {
|
|
332
352
|
className: classes.altChoices
|
|
333
353
|
}, choices && choices.map(function (c, index) {
|
|
334
354
|
return index > 0 && /*#__PURE__*/_react["default"].createElement(Choice, {
|
|
@@ -340,7 +360,9 @@ var AlternateSection = /*#__PURE__*/function (_React$Component2) {
|
|
|
340
360
|
},
|
|
341
361
|
onDelete: function onDelete() {
|
|
342
362
|
return _this3.onRemoveChoice(c);
|
|
343
|
-
}
|
|
363
|
+
},
|
|
364
|
+
spellCheck: spellCheck,
|
|
365
|
+
error: errors && errors[index]
|
|
344
366
|
});
|
|
345
367
|
})));
|
|
346
368
|
}
|