@pie-element/explicit-constructed-response 12.0.4-next.20261011174919 → 12.0.4

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.
@@ -2453,15 +2453,12 @@ var Lr = class extends K.Component {
2453
2453
  }), Vr = (e) => typeof e == "string" ? {
2454
2454
  label: e,
2455
2455
  value: e
2456
- } : e, Hr = function() {
2457
- let [e, t, n = !1] = Array.prototype.slice.call(arguments);
2458
- return {
2459
- type: "radio",
2460
- label: e,
2461
- choices: t && t.map((e) => Vr(e)),
2462
- isConfigProperty: n
2463
- };
2464
- }, Ur = (e, t, n = !1) => ({
2456
+ } : e, Hr = (e, t, n = !1) => ({
2457
+ type: "radio",
2458
+ label: e,
2459
+ choices: t && t.map((e) => Vr(e)),
2460
+ isConfigProperty: n
2461
+ }), Ur = (e, t, n = !1) => ({
2465
2462
  type: "dropdown",
2466
2463
  label: e,
2467
2464
  choices: t,
@@ -2927,18 +2924,6 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2927
2924
  let t = document.createElement("div");
2928
2925
  return t.innerHTML = e.trim(), t;
2929
2926
  }, Li = class extends K.Component {
2930
- static propTypes = {
2931
- configuration: Q.default.object.isRequired,
2932
- model: Q.default.object.isRequired,
2933
- disableSidePanel: Q.default.bool,
2934
- onModelChanged: Q.default.func.isRequired,
2935
- onConfigurationChanged: Q.default.func.isRequired,
2936
- imageSupport: Q.default.shape({
2937
- add: Q.default.func.isRequired,
2938
- delete: Q.default.func.isRequired
2939
- }),
2940
- uploadSoundSupport: Q.default.object
2941
- };
2942
2927
  state = {};
2943
2928
  componentDidMount() {
2944
2929
  let { model: { slateMarkup: e, choices: t, maxLengthPerChoice: n = [] }, onModelChanged: r } = this.props, i = !n.length;
@@ -2971,15 +2956,15 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2971
2956
  t({ maxLengthPerChoice: e });
2972
2957
  };
2973
2958
  onChangeResponse = (e, t) => {
2974
- let { model: n, onModelChanged: r } = this.props, { choices: i } = n, { maxLengthPerChoice: a } = n, o = di(t || "").length;
2959
+ let { model: n, onModelChanged: r } = this.props, { choices: i } = n, a = n.maxLengthPerChoice, o = di(t || "").length;
2975
2960
  if (!i[e] || !i[e].length) {
2976
2961
  i[e] = [{
2977
2962
  label: t || "",
2978
2963
  value: "0"
2979
2964
  }];
2980
- let n = e > a.length ? e - a.length : 0;
2981
- a = [...a, ...Array(n).fill(1)], a.splice(e, 0, li(o));
2982
- } else i[e][0].label = t || "", a && (a[e] < o || a[e] > o + 10) && (a[e] = li(o));
2965
+ let n = Number(e) > a.length ? Number(e) - a.length : 0;
2966
+ a = [...a, ...Array(n).fill(1)], a.splice(Number(e), 0, li(o));
2967
+ } else i[e][0].label = t || "", a && (a[Number(e)] < o || a[Number(e)] > o + 10) && (a[Number(e)] = li(o));
2983
2968
  r({
2984
2969
  choices: i,
2985
2970
  maxLengthPerChoice: a
@@ -2988,11 +2973,11 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
2988
2973
  onChange = (e) => {
2989
2974
  let { model: { choices: t, maxLengthPerChoice: n }, onModelChanged: i } = this.props, a = Ii(e), o = a.querySelectorAll("[data-type=\"explicit_constructed_response\"]"), s = {}, c = [];
2990
2975
  o.forEach((e, i) => {
2991
- let a = r(t[e.dataset.index]);
2992
- a && (a[0] = {
2976
+ let a = e.dataset.index, o = r(t[a]);
2977
+ o && (o[0] = {
2993
2978
  label: e.dataset.value || "",
2994
2979
  value: "0"
2995
- }, c[i] = n[e.dataset.index]), s[i] = a, e.dataset.index = i;
2980
+ }, c[i] = n[Number(a)]), s[i] = o, e.dataset.index = `${i}`;
2996
2981
  }), this.setState({ cachedChoices: void 0 }, () => i({
2997
2982
  choices: s,
2998
2983
  slateMarkup: a.innerHTML,
@@ -3296,6 +3281,10 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
3296
3281
  }
3297
3282
  }
3298
3283
  }, zi = (0, ke.default)("explicit-constructed-response:configure"), Bi = class e extends HTMLElement {
3284
+ _root;
3285
+ _model;
3286
+ _configuration;
3287
+ _disableSidePanel;
3299
3288
  static prepareModel = (e = {}) => {
3300
3289
  let t = {
3301
3290
  ...Ri.model,
@@ -3319,7 +3308,8 @@ var Xr = me, Zr = Xr.default, Qr = Zr && typeof Zr == "object" ? Zr : Xr, $r = Y
3319
3308
  this._model = e.prepareModel(t), this._model.responseAreaInputConfiguration && (this._model.responseAreaInputConfiguration = this._configuration.responseAreaInputConfiguration?.inputConfiguration), this._render();
3320
3309
  }
3321
3310
  set configuration(e) {
3322
- this._configuration = o(e, Ri.configuration), e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (this._configuration.language.enabled = !0, (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) && (this._configuration.languageChoices.options = []), this._configuration.languageChoices.options.find((e) => e.value === this._model.language) || this._configuration.languageChoices.options.push({
3311
+ let t = o(e, Ri.configuration);
3312
+ this._configuration = t, e.language?.enabled ? e.languageChoices?.options?.length && (this._model.language = e.languageChoices.options[0].value) : e.language.settings && this._model.language ? (t.language.enabled = !0, (!t.languageChoices.options || !t.languageChoices.options.length) && (t.languageChoices.options = []), t.languageChoices.options.find((e) => e.value === this._model.language) || t.languageChoices.options.push({
3323
3313
  value: this._model.language,
3324
3314
  label: this._model.language
3325
3315
  })) : delete this._model.language, this._render();