@pie-element/explicit-constructed-response 9.3.4-next.3 → 10.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +0 -11
  2. package/configure/CHANGELOG.md +0 -11
  3. package/configure/lib/alternateResponses.js +139 -184
  4. package/configure/lib/alternateResponses.js.map +1 -1
  5. package/configure/lib/alternateSection.js +279 -370
  6. package/configure/lib/alternateSection.js.map +1 -1
  7. package/configure/lib/defaults.js +2 -3
  8. package/configure/lib/defaults.js.map +1 -1
  9. package/configure/lib/ecr-toolbar.js +127 -191
  10. package/configure/lib/ecr-toolbar.js.map +1 -1
  11. package/configure/lib/index.js +126 -203
  12. package/configure/lib/index.js.map +1 -1
  13. package/configure/lib/main.js +436 -552
  14. package/configure/lib/main.js.map +1 -1
  15. package/configure/lib/markupUtils.js +26 -49
  16. package/configure/lib/markupUtils.js.map +1 -1
  17. package/configure/lib/utils.js +5 -5
  18. package/configure/lib/utils.js.map +1 -1
  19. package/configure/package.json +9 -7
  20. package/controller/CHANGELOG.md +0 -11
  21. package/controller/lib/defaults.js +2 -3
  22. package/controller/lib/defaults.js.map +1 -1
  23. package/controller/lib/index.js +172 -260
  24. package/controller/lib/index.js.map +1 -1
  25. package/controller/package.json +3 -3
  26. package/lib/index.js +71 -115
  27. package/lib/index.js.map +1 -1
  28. package/lib/main.js +174 -248
  29. package/lib/main.js.map +1 -1
  30. package/lib/print.js +39 -83
  31. package/lib/print.js.map +1 -1
  32. package/package.json +14 -19
  33. package/esm/configure.js +0 -33096
  34. package/esm/configure.js.map +0 -1
  35. package/esm/controller.js +0 -5144
  36. package/esm/controller.js.map +0 -1
  37. package/esm/element.js +0 -11518
  38. package/esm/element.js.map +0 -1
  39. package/esm/package.json +0 -3
  40. package/esm/print.js +0 -12202
  41. package/esm/print.js.map +0 -1
  42. package/module/configure.js +0 -1
  43. package/module/controller.js +0 -7460
  44. package/module/demo.js +0 -45
  45. package/module/element.js +0 -1
  46. package/module/index.html +0 -21
  47. package/module/manifest.json +0 -22
  48. package/module/print-demo.js +0 -83
  49. package/module/print.html +0 -18
  50. package/module/print.js +0 -1
package/CHANGELOG.md CHANGED
@@ -3,17 +3,6 @@
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
- ## [9.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@9.3.2...@pie-element/explicit-constructed-response@9.3.3) (2025-11-27)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
12
-
13
-
14
-
15
-
16
-
17
6
  ## [9.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response@9.3.1...@pie-element/explicit-constructed-response@9.3.2) (2025-10-22)
18
7
 
19
8
 
@@ -3,17 +3,6 @@
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
- ## [8.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@8.3.2...@pie-element/explicit-constructed-response-configure@8.3.3) (2025-11-27)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
12
-
13
-
14
-
15
-
16
-
17
6
  ## [8.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/explicit-constructed-response-configure@8.3.1...@pie-element/explicit-constructed-response-configure@8.3.2) (2025-10-22)
18
7
 
19
8
 
@@ -1,247 +1,202 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
- exports["default"] = exports.AlternateResponses = void 0;
9
-
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
7
+ exports.default = exports.AlternateResponses = void 0;
24
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
9
  var _react = _interopRequireDefault(require("react"));
27
-
28
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
11
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
31
-
32
12
  var _map = _interopRequireDefault(require("lodash/map"));
33
-
34
13
  var _reduce = _interopRequireDefault(require("lodash/reduce"));
35
-
36
14
  var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
37
-
38
15
  var _alternateSection = _interopRequireDefault(require("./alternateSection"));
39
-
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
-
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
-
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
-
46
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
-
48
- var AlternateResponses = /*#__PURE__*/function (_React$Component) {
49
- (0, _inherits2["default"])(AlternateResponses, _React$Component);
50
-
51
- var _super = _createSuper(AlternateResponses);
52
-
53
- function AlternateResponses() {
54
- var _this;
55
-
56
- (0, _classCallCheck2["default"])(this, AlternateResponses);
57
-
58
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
59
- args[_key] = arguments[_key];
60
- }
61
-
62
- _this = _super.call.apply(_super, [this].concat(args));
63
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
64
- maxLengthPerChoice: (0, _cloneDeep["default"])(_this.props.model.maxLengthPerChoice)
16
+ class AlternateResponses extends _react.default.Component {
17
+ constructor(...args) {
18
+ super(...args);
19
+ (0, _defineProperty2.default)(this, "state", {
20
+ maxLengthPerChoice: (0, _cloneDeep.default)(this.props.model.maxLengthPerChoice)
65
21
  });
66
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateChoicesIfNeeded", function (props) {
67
- if (!_this.state.choices || !(0, _isEqual["default"])(_this.state.choices, props.model.choices) || !(0, _isEqual["default"])(props.model.choices, _this.props.model.choices) || _this.state.values && Object.keys(_this.state.values).length !== Object.keys(_this.props.model.choices).length || props.maxLengthPerChoiceEnabled !== _this.props.maxLengthPerChoiceEnabled) {
68
- var _props$model = props.model,
69
- choices = _props$model.choices,
70
- maxLengthPerChoice = _props$model.maxLengthPerChoice;
71
- var selectedValues = (0, _reduce["default"])(choices, function (obj, c, key) {
22
+ (0, _defineProperty2.default)(this, "updateChoicesIfNeeded", props => {
23
+ if (!this.state.choices || !(0, _isEqual.default)(this.state.choices, props.model.choices) || !(0, _isEqual.default)(props.model.choices, this.props.model.choices) || this.state.values && Object.keys(this.state.values).length !== Object.keys(this.props.model.choices).length || props.maxLengthPerChoiceEnabled !== this.props.maxLengthPerChoiceEnabled) {
24
+ const {
25
+ choices,
26
+ maxLengthPerChoice
27
+ } = props.model;
28
+ const selectedValues = (0, _reduce.default)(choices, (obj, c, key) => {
72
29
  // if maxLengthPerChoiceEnabled is true, we display all the choices
73
30
  if (c && (props.maxLengthPerChoiceEnabled || c.length > 1)) {
74
31
  obj[key] = c[0];
75
32
  }
76
-
77
33
  return obj;
78
34
  }, {});
79
-
80
- _this.setState({
35
+ this.setState({
81
36
  choices: props.model.choices,
82
37
  values: selectedValues,
83
- maxLengthPerChoice: (0, _cloneDeep["default"])(maxLengthPerChoice)
38
+ maxLengthPerChoice: (0, _cloneDeep.default)(maxLengthPerChoice)
84
39
  });
85
40
  }
86
41
  });
87
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getRemainingChoices", function (valueKey) {
88
- var choices = _this.state.choices;
89
- return (0, _reduce["default"])(choices, function (arr, c, key) {
42
+ (0, _defineProperty2.default)(this, "getRemainingChoices", valueKey => {
43
+ const {
44
+ choices
45
+ } = this.state;
46
+ return (0, _reduce.default)(choices, (arr, c, key) => {
90
47
  if (c && c.length === 1 && !valueKey) {
91
48
  arr.push({
92
49
  label: c[0].label,
93
50
  value: key
94
51
  });
95
52
  }
96
-
97
53
  return arr;
98
54
  }, []);
99
55
  });
100
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceChanged", function (choice, key) {
101
- var onChange = _this.props.onChange;
102
- var choices = _this.state.choices;
103
- var sectionChoices = choices[key] || [];
104
- var isNew = !sectionChoices.find(function (c) {
105
- return c.value === choice.value;
106
- });
107
- var newChoices = sectionChoices.reduce(function (arr, c) {
108
- var newVal = c.value === choice.value ? choice : c;
56
+ (0, _defineProperty2.default)(this, "onChoiceChanged", (choice, key) => {
57
+ const {
58
+ onChange
59
+ } = this.props;
60
+ const {
61
+ choices
62
+ } = this.state;
63
+ const sectionChoices = choices[key] || [];
64
+ const isNew = !sectionChoices.find(c => c.value === choice.value);
65
+ const newChoices = sectionChoices.reduce((arr, c) => {
66
+ const newVal = c.value === choice.value ? choice : c;
109
67
  arr.push(newVal);
110
68
  return arr;
111
69
  }, []);
112
-
113
70
  if (isNew) {
114
71
  newChoices.push(choice);
115
72
  }
116
-
117
- onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, newChoices)));
73
+ onChange({
74
+ ...choices,
75
+ [key]: newChoices
76
+ });
118
77
  });
119
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChoiceRemoved", function (value, section) {
120
- var onChange = _this.props.onChange;
121
- var choices = _this.state.choices;
122
- var sectionChoices = choices[section] || [];
123
- var newChoices = sectionChoices.reduce(function (arr, c) {
78
+ (0, _defineProperty2.default)(this, "onChoiceRemoved", (value, section) => {
79
+ const {
80
+ onChange
81
+ } = this.props;
82
+ const {
83
+ choices
84
+ } = this.state;
85
+ const sectionChoices = choices[section] || [];
86
+ const newChoices = sectionChoices.reduce((arr, c) => {
124
87
  if (c.value === value) {
125
88
  return arr;
126
89
  }
127
-
128
90
  arr.push(c);
129
91
  return arr;
130
92
  }, []);
131
- onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, section, newChoices)));
93
+ onChange({
94
+ ...choices,
95
+ [section]: newChoices
96
+ });
132
97
  });
133
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSectionSelect", function (choice, key) {
134
- var onChange = _this.props.onChange;
135
- var _this$state = _this.state,
136
- choices = _this$state.choices,
137
- values = _this$state.values;
138
-
98
+ (0, _defineProperty2.default)(this, "onSectionSelect", (choice, key) => {
99
+ const {
100
+ onChange
101
+ } = this.props;
102
+ const {
103
+ choices,
104
+ values
105
+ } = this.state;
139
106
  if (choices[key] && choices[key].length > 1) {
140
107
  if (!choice) {
141
- onChange(_objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, [choices[key][0]])));
108
+ onChange({
109
+ ...choices,
110
+ [key]: [choices[key][0]]
111
+ });
142
112
  }
143
113
  } else {
144
- _this.setState({
145
- choices: _objectSpread(_objectSpread({}, choices), {}, (0, _defineProperty2["default"])({}, key, [].concat((0, _toConsumableArray2["default"])(choices[key]), [{
146
- label: '',
147
- value: '1'
148
- }]))),
149
- values: _objectSpread(_objectSpread({}, values), {}, (0, _defineProperty2["default"])({}, key, choices[key][0]))
114
+ this.setState({
115
+ choices: {
116
+ ...choices,
117
+ [key]: [...choices[key], {
118
+ label: '',
119
+ value: '1'
120
+ }]
121
+ },
122
+ values: {
123
+ ...values,
124
+ [key]: choices[key][0]
125
+ }
150
126
  });
151
127
  }
152
128
  });
153
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onLengthChanged", function (value, key) {
154
- var _this$props = _this.props,
155
- model = _this$props.model,
156
- onLengthChange = _this$props.onLengthChange;
157
- var maxLengthPerChoice = model.maxLengthPerChoice;
129
+ (0, _defineProperty2.default)(this, "onLengthChanged", (value, key) => {
130
+ const {
131
+ model,
132
+ onLengthChange
133
+ } = this.props;
134
+ const {
135
+ maxLengthPerChoice
136
+ } = model;
158
137
  maxLengthPerChoice[key] = value;
159
138
  onLengthChange(maxLengthPerChoice);
160
139
  });
161
- return _this;
162
140
  }
163
-
164
- (0, _createClass2["default"])(AlternateResponses, [{
165
- key: "UNSAFE_componentWillReceiveProps",
166
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
167
- this.updateChoicesIfNeeded(nextProps);
168
- }
169
- }, {
170
- key: "componentDidMount",
171
- value: function componentDidMount() {
172
- this.updateChoicesIfNeeded(this.props);
173
- }
174
- }, {
175
- key: "render",
176
- value: function render() {
177
- var _this2 = this;
178
-
179
- var choices = this.state.choices;
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,
186
- pluginProps = _this$props2.pluginProps;
187
- return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(choices, function (c, key) {
188
- // if maxLengthPerChoiceEnabled is true, we display all the choices
189
- if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
190
- var selected = _this2.state.values[key];
191
- return /*#__PURE__*/_react["default"].createElement(_alternateSection["default"], {
192
- key: key,
193
- value: selected && selected.value,
194
- errors: choicesErrors && choicesErrors[key],
195
- onSelect: function onSelect(choice) {
196
- return _this2.onSectionSelect(choice, key);
197
- },
198
- choiceChanged: function choiceChanged(choice) {
199
- return _this2.onChoiceChanged(choice, key);
200
- },
201
- choiceRemoved: function choiceRemoved(value) {
202
- return _this2.onChoiceRemoved(value, key);
203
- },
204
- lengthChanged: function lengthChanged(value) {
205
- return _this2.onLengthChanged(value, key);
206
- },
207
- selectChoices: [selected],
208
- choices: c,
209
- maxLength: maxLengthPerChoice[key],
210
- showMaxLength: maxLengthPerChoiceEnabled,
211
- spellCheck: spellCheck,
212
- pluginProps: pluginProps
213
- });
214
- }
215
- }), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && /*#__PURE__*/_react["default"].createElement(_alternateSection["default"], {
216
- value: "",
217
- onSelect: function onSelect(choice) {
218
- return _this2.onSectionSelect(choice, choice.value);
219
- },
220
- choiceChanged: function choiceChanged(choice) {
221
- return _this2.onChoiceChanged(choice);
222
- },
223
- choiceRemoved: function choiceRemoved(value) {
224
- return _this2.onChoiceRemoved(value);
225
- },
226
- selectChoices: this.getRemainingChoices(),
227
- spellCheck: spellCheck,
228
- pluginProps: pluginProps
229
- }));
230
- }
231
- }]);
232
- return AlternateResponses;
233
- }(_react["default"].Component);
234
-
141
+ UNSAFE_componentWillReceiveProps(nextProps) {
142
+ this.updateChoicesIfNeeded(nextProps);
143
+ }
144
+ componentDidMount() {
145
+ this.updateChoicesIfNeeded(this.props);
146
+ }
147
+ render() {
148
+ const {
149
+ choices
150
+ } = this.state;
151
+ const {
152
+ model: {
153
+ maxLengthPerChoice,
154
+ maxLengthPerChoiceEnabled
155
+ },
156
+ spellCheck,
157
+ choicesErrors,
158
+ pluginProps
159
+ } = this.props;
160
+ return /*#__PURE__*/_react.default.createElement("div", null, (0, _map.default)(choices, (c, key) => {
161
+ // if maxLengthPerChoiceEnabled is true, we display all the choices
162
+ if (c && (maxLengthPerChoiceEnabled || c.length > 1)) {
163
+ const selected = this.state.values[key];
164
+ return /*#__PURE__*/_react.default.createElement(_alternateSection.default, {
165
+ key: key,
166
+ value: selected && selected.value,
167
+ errors: choicesErrors && choicesErrors[key],
168
+ onSelect: choice => this.onSectionSelect(choice, key),
169
+ choiceChanged: choice => this.onChoiceChanged(choice, key),
170
+ choiceRemoved: value => this.onChoiceRemoved(value, key),
171
+ lengthChanged: value => this.onLengthChanged(value, key),
172
+ selectChoices: [selected],
173
+ choices: c,
174
+ maxLength: maxLengthPerChoice[key],
175
+ showMaxLength: maxLengthPerChoiceEnabled,
176
+ spellCheck: spellCheck,
177
+ pluginProps: pluginProps
178
+ });
179
+ }
180
+ }), choices && Object.keys(this.state.values).length !== Object.keys(choices).length && /*#__PURE__*/_react.default.createElement(_alternateSection.default, {
181
+ value: "",
182
+ onSelect: choice => this.onSectionSelect(choice, choice.value),
183
+ choiceChanged: choice => this.onChoiceChanged(choice),
184
+ choiceRemoved: value => this.onChoiceRemoved(value),
185
+ selectChoices: this.getRemainingChoices(),
186
+ spellCheck: spellCheck,
187
+ pluginProps: pluginProps
188
+ }));
189
+ }
190
+ }
235
191
  exports.AlternateResponses = AlternateResponses;
236
- (0, _defineProperty2["default"])(AlternateResponses, "propTypes", {
237
- choicesErrors: _propTypes["default"].object,
238
- model: _propTypes["default"].object.isRequired,
239
- onChange: _propTypes["default"].func.isRequired,
240
- onLengthChange: _propTypes["default"].func.isRequired,
241
- maxLengthPerChoiceEnabled: _propTypes["default"].bool.isRequired,
242
- spellCheck: _propTypes["default"].bool,
243
- pluginProps: _propTypes["default"].object
192
+ (0, _defineProperty2.default)(AlternateResponses, "propTypes", {
193
+ choicesErrors: _propTypes.default.object,
194
+ model: _propTypes.default.object.isRequired,
195
+ onChange: _propTypes.default.func.isRequired,
196
+ onLengthChange: _propTypes.default.func.isRequired,
197
+ maxLengthPerChoiceEnabled: _propTypes.default.bool.isRequired,
198
+ spellCheck: _propTypes.default.bool,
199
+ pluginProps: _propTypes.default.object
244
200
  });
245
- var _default = AlternateResponses;
246
- exports["default"] = _default;
201
+ var _default = exports.default = AlternateResponses;
247
202
  //# sourceMappingURL=alternateResponses.js.map
@@ -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","spellCheck","choicesErrors","pluginProps","selected","onSectionSelect","onChoiceChanged","onChoiceRemoved","onLengthChanged","getRemainingChoices","React","Component","PropTypes","object","isRequired","func","bool"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;IAEaA,kB;;;;;;;;;;;;;;;8FAWH;AA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AAA,aAAa,EAAE,uBAACD,KAAD;AAAA,iBAAW,MAAI,CAACmB,eAAL,CAAqBnB,KAArB,CAAX;AAAA,SAJjB;AAKE,QAAA,aAAa,EAAE,KAAKqB,mBAAL,EALjB;AAME,QAAA,UAAU,EAAER,UANd;AAOE,QAAA,WAAW,EAAEE;AAPf,QA3BJ,CADF;AAwCD;;;EA7MqCO,kBAAMC,S;;;iCAAjC3C,kB,eACQ;AACjBkC,EAAAA,aAAa,EAAEU,sBAAUC,MADR;AAEjB1C,EAAAA,KAAK,EAAEyC,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBxB,EAAAA,QAAQ,EAAEsB,sBAAUG,IAAV,CAAeD,UAHR;AAIjBhB,EAAAA,cAAc,EAAEc,sBAAUG,IAAV,CAAeD,UAJd;AAKjBpC,EAAAA,yBAAyB,EAAEkC,sBAAUI,IAAV,CAAeF,UALzB;AAMjBb,EAAAA,UAAU,EAAEW,sBAAUI,IANL;AAOjBb,EAAAA,WAAW,EAAES,sBAAUC;AAPN,C;eA+MN7C,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 choicesErrors: PropTypes.object,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired,\n spellCheck: PropTypes.bool,\n pluginProps: PropTypes.object\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 pluginProps\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 pluginProps={pluginProps}\n />\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 pluginProps={pluginProps}\n />\n )}\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"file":"alternateResponses.js"}
1
+ {"version":3,"file":"alternateResponses.js","names":["_react","_interopRequireDefault","require","_propTypes","_isEqual","_map","_reduce","_cloneDeep","_alternateSection","AlternateResponses","React","Component","constructor","args","_defineProperty2","default","maxLengthPerChoice","cloneDeep","props","model","state","choices","isEqual","values","Object","keys","length","maxLengthPerChoiceEnabled","selectedValues","reduce","obj","c","key","setState","valueKey","arr","push","label","value","choice","onChange","sectionChoices","isNew","find","newChoices","newVal","section","onLengthChange","UNSAFE_componentWillReceiveProps","nextProps","updateChoicesIfNeeded","componentDidMount","render","spellCheck","choicesErrors","pluginProps","createElement","map","selected","errors","onSelect","onSectionSelect","choiceChanged","onChoiceChanged","choiceRemoved","onChoiceRemoved","lengthChanged","onLengthChanged","selectChoices","maxLength","showMaxLength","getRemainingChoices","exports","PropTypes","object","isRequired","func","bool","_default"],"sources":["../src/alternateResponses.jsx"],"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 choicesErrors: PropTypes.object,\n model: PropTypes.object.isRequired,\n onChange: PropTypes.func.isRequired,\n onLengthChange: PropTypes.func.isRequired,\n maxLengthPerChoiceEnabled: PropTypes.bool.isRequired,\n spellCheck: PropTypes.bool,\n pluginProps: PropTypes.object\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 pluginProps\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 pluginProps={pluginProps}\n />\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 pluginProps={pluginProps}\n />\n )}\n </div>\n );\n }\n}\n\nexport default AlternateResponses;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,UAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,iBAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEO,MAAMO,kBAAkB,SAASC,cAAK,CAACC,SAAS,CAAC;EAAAC,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAW9C;MAAEC,kBAA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