@pie-element/complex-rubric 3.7.8-next.77 → 3.7.8-next.80

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 (111) hide show
  1. package/configure/node_modules/@pie-element/multi-trait-rubric/CHANGELOG.json +1 -0
  2. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/CHANGELOG.md +402 -676
  3. package/configure/node_modules/@pie-element/multi-trait-rubric/README.md +55 -0
  4. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/CHANGELOG.json +1 -0
  5. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/configure/CHANGELOG.md +366 -574
  6. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js +584 -0
  7. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/common.js.map +1 -0
  8. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js +152 -0
  9. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/defaults.js.map +1 -0
  10. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/configure/lib/index.js +89 -63
  11. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/index.js.map +1 -0
  12. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js +546 -0
  13. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/main.js.map +1 -0
  14. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js +361 -0
  15. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/modals.js.map +1 -0
  16. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js +556 -0
  17. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/scale.js.map +1 -0
  18. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js +380 -0
  19. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/trait.js.map +1 -0
  20. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js +296 -0
  21. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/traitsHeader.js.map +1 -0
  22. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js +118 -0
  23. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/lib/utils.js.map +1 -0
  24. package/configure/node_modules/@pie-element/multi-trait-rubric/configure/package.json +18 -0
  25. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/CHANGELOG.json +1 -0
  26. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/controller/CHANGELOG.md +172 -165
  27. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/controller/lib/defaults.js +8 -5
  28. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/defaults.js.map +1 -0
  29. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js +215 -0
  30. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/index.js.map +1 -0
  31. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js +13 -0
  32. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/lib/utils.js.map +1 -0
  33. package/configure/node_modules/@pie-element/multi-trait-rubric/controller/package.json +15 -0
  34. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json +1628 -0
  35. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/config-schema.json.md +1202 -0
  36. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/docs/demo/config.js +2 -2
  37. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/generate.js +117 -0
  38. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/index.html +1 -0
  39. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/demo/session.js +6 -0
  40. package/configure/node_modules/@pie-element/multi-trait-rubric/docs/pie-schema.json +861 -0
  41. package/configure/node_modules/@pie-element/{rubric/docs/config-schema.json.md → multi-trait-rubric/docs/pie-schema.json.md} +284 -202
  42. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/lib/index.js +27 -30
  43. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/index.js.map +1 -0
  44. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js +164 -0
  45. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/main.js.map +1 -0
  46. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js +330 -0
  47. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/scale.js.map +1 -0
  48. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js +103 -0
  49. package/configure/node_modules/@pie-element/multi-trait-rubric/lib/trait.js.map +1 -0
  50. package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/package.json +10 -12
  51. package/configure/package.json +5 -5
  52. package/module/configure.js +1 -1
  53. package/module/element.js +1 -1
  54. package/module/manifest.json +4 -4
  55. package/module/print.js +1 -1
  56. package/package.json +4 -4
  57. package/configure/node_modules/@pie-element/rubric/CHANGELOG.json +0 -257
  58. package/configure/node_modules/@pie-element/rubric/README.md +0 -3
  59. package/configure/node_modules/@pie-element/rubric/configure/CHANGELOG.json +0 -197
  60. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js +0 -68
  61. package/configure/node_modules/@pie-element/rubric/configure/lib/defaults.js.map +0 -1
  62. package/configure/node_modules/@pie-element/rubric/configure/lib/index.js.map +0 -1
  63. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js +0 -162
  64. package/configure/node_modules/@pie-element/rubric/configure/lib/main.js.map +0 -1
  65. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js +0 -573
  66. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/authoring.js.map +0 -1
  67. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js +0 -24
  68. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/index.js.map +0 -1
  69. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js +0 -172
  70. package/configure/node_modules/@pie-element/rubric/configure/lib/pie-toolbox-rubric/point-menu.js.map +0 -1
  71. package/configure/node_modules/@pie-element/rubric/configure/package.json +0 -17
  72. package/configure/node_modules/@pie-element/rubric/configure/src/__tests__/index.test.jsx +0 -167
  73. package/configure/node_modules/@pie-element/rubric/configure/src/defaults.js +0 -42
  74. package/configure/node_modules/@pie-element/rubric/configure/src/index.js +0 -129
  75. package/configure/node_modules/@pie-element/rubric/configure/src/main.jsx +0 -89
  76. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/authoring.jsx +0 -449
  77. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/index.js +0 -9
  78. package/configure/node_modules/@pie-element/rubric/configure/src/pie-toolbox-rubric/point-menu.jsx +0 -94
  79. package/configure/node_modules/@pie-element/rubric/controller/CHANGELOG.json +0 -17
  80. package/configure/node_modules/@pie-element/rubric/controller/lib/defaults.js.map +0 -1
  81. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js +0 -59
  82. package/configure/node_modules/@pie-element/rubric/controller/lib/index.js.map +0 -1
  83. package/configure/node_modules/@pie-element/rubric/controller/package.json +0 -13
  84. package/configure/node_modules/@pie-element/rubric/controller/src/__tests__/index.test.js +0 -33
  85. package/configure/node_modules/@pie-element/rubric/controller/src/defaults.js +0 -8
  86. package/configure/node_modules/@pie-element/rubric/controller/src/index.js +0 -41
  87. package/configure/node_modules/@pie-element/rubric/docs/config-schema.json +0 -712
  88. package/configure/node_modules/@pie-element/rubric/docs/demo/generate.js +0 -8
  89. package/configure/node_modules/@pie-element/rubric/docs/demo/index.html +0 -2
  90. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json +0 -391
  91. package/configure/node_modules/@pie-element/rubric/docs/pie-schema.json.md +0 -281
  92. package/configure/node_modules/@pie-element/rubric/lib/index.js.map +0 -1
  93. package/configure/node_modules/@pie-element/rubric/lib/main.js +0 -270
  94. package/configure/node_modules/@pie-element/rubric/lib/main.js.map +0 -1
  95. package/configure/node_modules/@pie-element/rubric/lib/print.js +0 -114
  96. package/configure/node_modules/@pie-element/rubric/lib/print.js.map +0 -1
  97. package/configure/node_modules/@pie-element/rubric/module/configure.js +0 -42661
  98. package/configure/node_modules/@pie-element/rubric/module/controller.js +0 -113
  99. package/configure/node_modules/@pie-element/rubric/module/demo.js +0 -33
  100. package/configure/node_modules/@pie-element/rubric/module/element.js +0 -7980
  101. package/configure/node_modules/@pie-element/rubric/module/index.html +0 -21
  102. package/configure/node_modules/@pie-element/rubric/module/manifest.json +0 -14
  103. package/configure/node_modules/@pie-element/rubric/module/print-demo.js +0 -71
  104. package/configure/node_modules/@pie-element/rubric/module/print.html +0 -18
  105. package/configure/node_modules/@pie-element/rubric/module/print.js +0 -7993
  106. package/configure/node_modules/@pie-element/rubric/src/__tests__/__snapshots__/rubric-view.test.jsx.snap +0 -1815
  107. package/configure/node_modules/@pie-element/rubric/src/__tests__/rubric-view.test.jsx +0 -49
  108. package/configure/node_modules/@pie-element/rubric/src/index.js +0 -37
  109. package/configure/node_modules/@pie-element/rubric/src/main.jsx +0 -196
  110. package/configure/node_modules/@pie-element/rubric/src/print.js +0 -63
  111. /package/configure/node_modules/@pie-element/{rubric → multi-trait-rubric}/LICENSE.md +0 -0
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ model: {
9
+ addScaleEnabled: true,
10
+ description: false,
11
+ excludeZero: false,
12
+ halfScoring: false,
13
+ maxPointsEnabled: true,
14
+ pointLabels: true,
15
+ scales: [],
16
+ standards: false,
17
+ visibleToStudent: true
18
+ },
19
+ configuration: {
20
+ baseInputConfiguration: {
21
+ audio: {
22
+ disabled: false
23
+ },
24
+ video: {
25
+ disabled: false
26
+ },
27
+ image: {
28
+ disabled: false
29
+ },
30
+ textAlign: {
31
+ disabled: true
32
+ },
33
+ showParagraphs: {
34
+ disabled: false
35
+ },
36
+ separateParagraphs: {
37
+ disabled: true
38
+ }
39
+ },
40
+ expandedInput: {
41
+ inputConfiguration: {
42
+ math: {
43
+ disabled: true
44
+ },
45
+ audio: {
46
+ disabled: false
47
+ },
48
+ video: {
49
+ disabled: false
50
+ },
51
+ image: {
52
+ disabled: false
53
+ }
54
+ }
55
+ },
56
+ labelInput: {
57
+ inputConfiguration: {
58
+ math: {
59
+ disabled: true
60
+ },
61
+ audio: {
62
+ disabled: true
63
+ },
64
+ video: {
65
+ disabled: true
66
+ },
67
+ image: {
68
+ disabled: true
69
+ }
70
+ }
71
+ },
72
+ excludeZeroDialogBoxContent: {
73
+ title: 'Exclude 0 (Zero) from Score Point Values.',
74
+ text: "<div>\n You are about to exclude 0 from score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the left\n </li>\n <li>\n remove 0 column with its Label and Description\n </li>\n </ul>\n </div>"
75
+ },
76
+ includeZeroDialogBoxContent: {
77
+ title: 'Include 0 (Zero) in Score Point Values.',
78
+ text: "<div>\n You are about to include 0 in score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the right\n </li>\n <li>\n add 0 column with empty Label and Descriptions\n </li>\n </ul>\n </div>"
79
+ },
80
+ deleteScaleDialogBoxContent: {
81
+ title: 'Delete Scale',
82
+ text: 'Are you sure you want to delete this scale?'
83
+ },
84
+ maxPointsDialogBoxContent: {
85
+ title: 'Decreasing Max Points.',
86
+ text: " You are about to decrease max score point value.\n <br/>\n All the Labels and Descriptions for scores above Max Point will be deleted."
87
+ },
88
+ settingsPanelDisabled: false,
89
+ spellCheck: {
90
+ label: 'Spellcheck',
91
+ settings: false,
92
+ enabled: true
93
+ },
94
+ showExcludeZero: {
95
+ settings: true,
96
+ label: 'Exclude Zero'
97
+ },
98
+ showScorePointLabels: {
99
+ settings: true,
100
+ label: 'Show Score Point Labels'
101
+ },
102
+ showDescription: {
103
+ settings: true,
104
+ label: 'Show Description'
105
+ },
106
+ showVisibleToStudent: {
107
+ settings: true,
108
+ label: 'Visible to Student'
109
+ },
110
+ showHalfScoring: {
111
+ settings: true,
112
+ label: 'Half Scoring'
113
+ },
114
+ // commenting this in order to use the dynamic width if the width was not set by the client (PD-3203)
115
+ // width: '900px',
116
+ // these should not be set to true (should not be used) for now
117
+ showStandards: {
118
+ settings: false,
119
+ label: 'Show Standards'
120
+ },
121
+ showLevelTagInput: {
122
+ settings: false,
123
+ label: 'Show Level Tag Input',
124
+ enabled: false
125
+ },
126
+ dragAndDrop: {
127
+ settings: true,
128
+ label: 'Enable Drag and Drop',
129
+ enabled: false
130
+ },
131
+ showMaxPoint: {
132
+ settings: true,
133
+ label: 'Show Max Points Dropdown'
134
+ },
135
+ addScale: {
136
+ settings: true,
137
+ label: 'Add Scale Available'
138
+ },
139
+ minNoOfTraits: 1,
140
+ maxNoOfTraits: 10,
141
+ minNoOfScales: 1,
142
+ maxNoOfScales: 10,
143
+ defaultTraitLabel: 'Trait',
144
+ mathMlOptions: {
145
+ mmlOutput: false,
146
+ mmlEditing: false
147
+ },
148
+ maxMaxPoints: 10
149
+ }
150
+ };
151
+ exports["default"] = _default;
152
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/defaults.js"],"names":["model","addScaleEnabled","description","excludeZero","halfScoring","maxPointsEnabled","pointLabels","scales","standards","visibleToStudent","configuration","baseInputConfiguration","audio","disabled","video","image","textAlign","showParagraphs","separateParagraphs","expandedInput","inputConfiguration","math","labelInput","excludeZeroDialogBoxContent","title","text","includeZeroDialogBoxContent","deleteScaleDialogBoxContent","maxPointsDialogBoxContent","settingsPanelDisabled","spellCheck","label","settings","enabled","showExcludeZero","showScorePointLabels","showDescription","showVisibleToStudent","showHalfScoring","showStandards","showLevelTagInput","dragAndDrop","showMaxPoint","addScale","minNoOfTraits","maxN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E;AACpBL,MAAAA,QAAQ,EAAE,IADU;AAEpBD,MAAAA,KAAK,EAAE;AAFa,KAzFT;AA6FbO,IAAAA,eAAe,EAAE;AACfN,MAAAA,QAAQ,EAAE,IADK;AAEfD,MAAAA,KAAK,EAAE;AAFQ,KA7FJ;AAiGb;AACA;AACA;AACAQ,IAAAA,aAAa,EAAE;AACbP,MAAAA,QAAQ,EAAE,KADG;AAEbD,MAAAA,KAAK,EAAE;AAFM,KApGF;AAwGbS,IAAAA,iBAAiB,EAAE;AACjBR,MAAAA,QAAQ,EAAE,KADO;AAEjBD,MAAAA,KAAK,EAAE,sBAFU;AAGjBE,MAAAA,OAAO,EAAE;AAHQ,KAxGN;AA6GbQ,IAAAA,WAAW,EAAE;AACXT,MAAAA,QAAQ,EAAE,IADC;AAEXD,MAAAA,KAAK,EAAE,sBAFI;AAGXE,MAAAA,OAAO,EAAE;AAHE,KA7GA;AAkHbS,IAAAA,YAAY,EAAE;AACZV,MAAAA,QAAQ,EAAE,IADE;AAEZD,MAAAA,KAAK,EAAE;AAFK,KAlHD;AAsHbY,IAAAA,QAAQ,EAAE;AACRX,MAAAA,QAAQ,EAAE,IADF;AAERD,MAAAA,KAAK,EAAE;AAFC,KAtHG;AA0Hba,IAAAA,aAAa,EAAE,CA1HF;AA2HbC,IAAAA,aAAa,EAAE,EA3HF;AA4HbC,IAAAA,aAAa,EAAE,CA5HF;AA6HbC,IAAAA,aAAa,EAAE,EA7HF;AA8HbC,IAAAA,iBAAiB,EAAE,OA9HN;AA+HbC,IAAAA,aAAa,EAAE;AACbC,MAAAA,SAAS,EAAE,KADE;AAEbC,MAAAA,UAAU,EAAE;AAFC,KA/HF;AAmIbC,IAAAA,YAAY,EAAE;AAnID;AAZF,C","sourcesContent":["export default {\n model: {\n addScaleEnabled: true,\n description: false,\n excludeZero: false,\n halfScoring: false,\n maxPointsEnabled: true,\n pointLabels: true,\n scales: [],\n standards: false,\n visibleToStudent: true,\n },\n configuration: {\n baseInputConfiguration: {\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n textAlign: { disabled: true },\n showParagraphs: { disabled: false },\n separateParagraphs: { disabled: true },\n },\n expandedInput: {\n inputConfiguration: {\n math: { disabled: true },\n audio: { disabled: false },\n video: { disabled: false },\n image: { disabled: false },\n },\n },\n labelInput: {\n inputConfiguration: {\n math: { disabled: true },\n audio: { disabled: true },\n video: { disabled: true },\n image: { disabled: true },\n },\n },\n excludeZeroDialogBoxContent: {\n title: 'Exclude 0 (Zero) from Score Point Values.',\n text: `<div>\n You are about to exclude 0 from score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the left\n </li>\n <li>\n remove 0 column with its Label and Description\n </li>\n </ul>\n </div>`,\n },\n includeZeroDialogBoxContent: {\n title: 'Include 0 (Zero) in Score Point Values.',\n text: `<div>\n You are about to include 0 in score point values.\n <br/>\n Some of the existing data has to be changed.\n <br/>\n Please choose if you want to:\n <ul>\n <li>\n shift Labels and Descriptions to the right\n </li>\n <li>\n add 0 column with empty Label and Descriptions\n </li>\n </ul>\n </div>`,\n },\n deleteScaleDialogBoxContent: {\n title: 'Delete Scale',\n text: 'Are you sure you want to delete this scale?',\n },\n maxPointsDialogBoxContent: {\n title: 'Decreasing Max Points.',\n text: ` You are about to decrease max score point value.\n <br/>\n All the Labels and Descriptions for scores above Max Point will be deleted.`,\n },\n settingsPanelDisabled: false,\n spellCheck: {\n label: 'Spellcheck',\n settings: false,\n enabled: true,\n },\n showExcludeZero: {\n settings: true,\n label: 'Exclude Zero',\n },\n showScorePointLabels: {\n settings: true,\n label: 'Show Score Point Labels',\n },\n showDescription: {\n settings: true,\n label: 'Show Description',\n },\n showVisibleToStudent: {\n settings: true,\n label: 'Visible to Student',\n },\n showHalfScoring: {\n settings: true,\n label: 'Half Scoring',\n },\n // commenting this in order to use the dynamic width if the width was not set by the client (PD-3203)\n // width: '900px',\n // these should not be set to true (should not be used) for now\n showStandards: {\n settings: false,\n label: 'Show Standards',\n },\n showLevelTagInput: {\n settings: false,\n label: 'Show Level Tag Input',\n enabled: false,\n },\n dragAndDrop: {\n settings: true,\n label: 'Enable Drag and Drop',\n enabled: false,\n },\n showMaxPoint: {\n settings: true,\n label: 'Show Max Points Dropdown',\n },\n addScale: {\n settings: true,\n label: 'Add Scale Available',\n },\n minNoOfTraits: 1,\n maxNoOfTraits: 10,\n minNoOfScales: 1,\n maxNoOfScales: 10,\n defaultTraitLabel: 'Trait',\n mathMlOptions: {\n mmlOutput: false,\n mmlEditing: false,\n },\n maxMaxPoints: 10,\n },\n};\n"],"file":"defaults.js"}
@@ -31,12 +31,14 @@ var _react = _interopRequireDefault(require("react"));
31
31
 
32
32
  var _reactDom = _interopRequireDefault(require("react-dom"));
33
33
 
34
- var _debug = _interopRequireDefault(require("debug"));
35
-
36
34
  var _main = _interopRequireDefault(require("./main"));
37
35
 
38
36
  var _defaults = _interopRequireDefault(require("./defaults"));
39
37
 
38
+ var _utils = require("./utils");
39
+
40
+ var _modals = require("./modals");
41
+
40
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); }; }
41
43
 
42
44
  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; } }
@@ -53,87 +55,111 @@ var configurationWithDefaults = function configurationWithDefaults(c) {
53
55
  return _objectSpread(_objectSpread({}, _defaults["default"].configuration), c);
54
56
  };
55
57
 
56
- var RubricElement = /*#__PURE__*/function (_HTMLElement) {
57
- (0, _inherits2["default"])(RubricElement, _HTMLElement);
58
+ var MultiTraitRubricElement = /*#__PURE__*/function (_HTMLElement) {
59
+ (0, _inherits2["default"])(MultiTraitRubricElement, _HTMLElement);
58
60
 
59
- var _super = _createSuper(RubricElement);
61
+ var _super = _createSuper(MultiTraitRubricElement);
60
62
 
61
- function RubricElement() {
63
+ function MultiTraitRubricElement() {
62
64
  var _this;
63
65
 
64
- (0, _classCallCheck2["default"])(this, RubricElement);
66
+ (0, _classCallCheck2["default"])(this, MultiTraitRubricElement);
65
67
  _this = _super.call(this);
66
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModelAccordingToReceivedProps", function (nextModel) {
68
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "updateModelAccordingToReceivedProps", function (m) {
67
69
  var currentModel = _objectSpread({}, _this._model);
68
70
 
69
- if (!nextModel) {
71
+ if (!m) {
70
72
  return currentModel;
71
73
  }
72
74
 
73
- var validatedModel = _objectSpread({}, nextModel); // excludeZero should be false and disabled when maxPoints is 1
74
-
75
-
76
- if (validatedModel.maxPoints === 1) {
77
- validatedModel.excludeZero = false;
78
- }
75
+ var validatedModel = _objectSpread({}, m);
79
76
 
80
77
  var _ref = validatedModel || {},
81
- maxPoints = _ref.maxPoints,
78
+ scales = _ref.scales,
82
79
  excludeZero = _ref.excludeZero;
83
80
 
84
- validatedModel.points = validatedModel.points ? (0, _toConsumableArray2["default"])(validatedModel.points) : [];
85
- validatedModel.sampleAnswers = validatedModel.sampleAnswers ? (0, _toConsumableArray2["default"])(validatedModel.sampleAnswers) : [];
86
- var howManyPointsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
87
- var howManyPointsDoesItHave = validatedModel.points.length;
88
- var excludeZeroChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.excludeZero) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.excludeZero);
89
- var maxPointsChanged = (currentModel === null || currentModel === void 0 ? void 0 : currentModel.maxPoints) !== (nextModel === null || nextModel === void 0 ? void 0 : nextModel.maxPoints);
90
-
91
- if (howManyPointsDoesItHave < howManyPointsShouldHave) {
92
- if (excludeZeroChanged && !excludeZero) {
93
- validatedModel.points = [''].concat((0, _toConsumableArray2["default"])(validatedModel.points));
94
- validatedModel.sampleAnswers = [null].concat((0, _toConsumableArray2["default"])(validatedModel.sampleAnswers));
81
+ (scales || []).forEach(function (scale) {
82
+ if (!scale) {
83
+ scale = {
84
+ scorePointsLabels: [],
85
+ traits: []
86
+ };
95
87
  }
96
88
 
97
- if (maxPointsChanged) {
98
- for (var i = 0; i < howManyPointsShouldHave - howManyPointsDoesItHave; i++) {
99
- validatedModel.points.push('');
100
- validatedModel.sampleAnswers.push(null);
89
+ var _ref2 = scale || {},
90
+ maxPoints = _ref2.maxPoints;
91
+
92
+ scale.scorePointsLabels = (0, _toConsumableArray2["default"])(scale.scorePointsLabels || []);
93
+ scale.traits = (0, _toConsumableArray2["default"])(scale.traits || []);
94
+ var howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;
95
+ var howManyScorePointLabelsItHas = scale.scorePointsLabels.length;
96
+
97
+ if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {
98
+ if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {
99
+ for (var i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {
100
+ scale.scorePointsLabels.push('');
101
+ }
102
+ } else {
103
+ scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);
101
104
  }
102
105
  }
103
- } else if (howManyPointsDoesItHave > howManyPointsShouldHave) {
104
- if (excludeZeroChanged && excludeZero) {
105
- validatedModel.points = validatedModel.points.slice(1);
106
- validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(1);
107
- }
108
106
 
109
- if (maxPointsChanged) {
110
- validatedModel.points = validatedModel.points.slice(0, howManyPointsShouldHave);
111
- validatedModel.sampleAnswers = validatedModel.sampleAnswers.slice(0, howManyPointsShouldHave);
107
+ (scale.traits || []).forEach(function (trait) {
108
+ if (!trait) {
109
+ trait = {
110
+ scorePointsDescriptors: []
111
+ };
112
+ }
113
+
114
+ trait.scorePointsDescriptors = (0, _toConsumableArray2["default"])(trait.scorePointsDescriptors || []);
115
+ var howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;
116
+
117
+ if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {
118
+ if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {
119
+ for (var _i = 0; _i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; _i++) {
120
+ trait.scorePointsDescriptors.push('');
121
+ }
122
+ } else {
123
+ trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);
124
+ }
125
+ }
126
+ });
127
+ });
128
+
129
+ if (validatedModel.excludeZero) {
130
+ // check if any scale has maxPoints set to 1
131
+ var shouldAddColumn0 = validatedModel.scales.some(function (scale) {
132
+ return scale.maxPoints === 1;
133
+ });
134
+
135
+ if (shouldAddColumn0) {
136
+ // excludeZero should be false and disabled when maxPoints is 1
137
+ validatedModel.excludeZero = false; // add column 0 for all scales
138
+
139
+ validatedModel.scales = (0, _utils.addOrRemoveScaleColumn)(scales, _modals.excludeZeroTypes.add0);
112
140
  }
113
141
  }
114
142
 
115
143
  return validatedModel;
116
144
  });
145
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onModelChanged", function (m) {
146
+ _this._model = _this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
147
+
148
+ _this._render();
149
+
150
+ _this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(_this._model, false));
151
+ });
117
152
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onConfigurationChanged", function (c) {
118
153
  _this._configuration = configurationWithDefaults(c);
119
154
 
120
- if (_this._model) {
121
- _this.onModelChanged(_this._model);
122
- }
123
-
124
155
  _this._render();
125
156
  });
126
-
127
- _debug["default"].log('constructor called');
128
-
129
157
  _this._model = modelWithDefaults();
130
158
  _this._configuration = configurationWithDefaults();
131
- _this.onModelChanged = _this.onModelChanged.bind((0, _assertThisInitialized2["default"])(_this));
132
- _this.onConfigurationChanged = _this.onConfigurationChanged.bind((0, _assertThisInitialized2["default"])(_this));
133
159
  return _this;
134
160
  }
135
161
 
136
- (0, _createClass2["default"])(RubricElement, [{
162
+ (0, _createClass2["default"])(MultiTraitRubricElement, [{
137
163
  key: "model",
138
164
  set: function set(m) {
139
165
  this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));
@@ -148,13 +174,14 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
148
174
  this._render();
149
175
  }
150
176
  }, {
151
- key: "onModelChanged",
152
- value: function onModelChanged(m) {
153
- this._model = this.updateModelAccordingToReceivedProps(m);
154
-
155
- this._render();
156
-
157
- this.dispatchEvent(new _pieConfigureEvents.ModelUpdatedEvent(this._model, false));
177
+ key: "insertSound",
178
+ value: function insertSound(handler) {
179
+ this.dispatchEvent(new _pieConfigureEvents.InsertSoundEvent(handler));
180
+ }
181
+ }, {
182
+ key: "onDeleteSound",
183
+ value: function onDeleteSound(src, done) {
184
+ this.dispatchEvent(new _pieConfigureEvents.DeleteSoundEvent(src, done));
158
185
  }
159
186
  }, {
160
187
  key: "insertImage",
@@ -166,11 +193,6 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
166
193
  value: function onDeleteImage(src, done) {
167
194
  this.dispatchEvent(new _pieConfigureEvents.DeleteImageEvent(src, done));
168
195
  }
169
- }, {
170
- key: "connectedCallback",
171
- value: function connectedCallback() {
172
- this._render();
173
- }
174
196
  }, {
175
197
  key: "_render",
176
198
  value: function _render() {
@@ -180,6 +202,10 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
180
202
  configuration: this._configuration,
181
203
  onModelChanged: this.onModelChanged,
182
204
  onConfigurationChanged: this.onConfigurationChanged,
205
+ uploadSoundSupport: {
206
+ add: this.insertSound.bind(this),
207
+ "delete": this.onDeleteSound.bind(this)
208
+ },
183
209
  imageSupport: {
184
210
  add: this.insertImage.bind(this),
185
211
  "delete": this.onDeleteImage.bind(this)
@@ -190,8 +216,8 @@ var RubricElement = /*#__PURE__*/function (_HTMLElement) {
190
216
  }
191
217
  }
192
218
  }]);
193
- return RubricElement;
219
+ return MultiTraitRubricElement;
194
220
  }( /*#__PURE__*/(0, _wrapNativeSuper2["default"])(HTMLElement));
195
221
 
196
- exports["default"] = RubricElement;
222
+ exports["default"] = MultiTraitRubricElement;
197
223
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.js"],"names":["modelWithDefaults","m","defaults","model","configurationWithDefaults","c","configuration","MultiTraitRubricElement","currentModel","_model","validatedModel","scales","excludeZero","forEach","scale","scorePointsLabels","traits","maxPoints","howManyScorePointLabelsShouldHave","howManyScorePointLabelsItHas","length","i","push","slice","trait","scorePointsDescriptors","howManyScorePointDescriptorsItHas","shouldAddColumn0","some","excludeZeroTypes","add0","updateModelAccordingToReceivedProps","_render","dispatchEvent","ModelUpdatedEvent","_configuration","handler","InsertSoundEvent","src","done","DeleteSoundEvent","InsertImageEvent","DeleteImageEvent","element","React","createElement","Main","onModelChanged","onConfigurationChanged","uploadSoundSupport","add","insertSound","bind","onDeleteSound","imageSupport","insertImage","onDeleteImage","ReactDOM","render","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AAEA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,CAAD;AAAA,yCAAaC,qBAASC,KAAtB,GAAgCF,CAAhC;AAAA,CAA1B;;AACA,IAAMG,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,CAAD;AAAA,yCAAaH,qBAASI,aAAtB,GAAwCD,CAAxC;AAAA,CAAlC;;IAEqBE,uB;;;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,MAAT,EAAiB;AACf,YAAIkC,OAAO,gBAAGC,kBAAMC,aAAN,CAAoBC,gBAApB,EAA0B;AACtC3C,UAAAA,KAAK,EAAE,KAAKM,MAD0B;AAEtCH,UAAAA,aAAa,EAAE,KAAK6B,cAFkB;AAGtCY,UAAAA,cAAc,EAAE,KAAKA,cAHiB;AAItCC,UAAAA,sBAAsB,EAAE,KAAKA,sBAJS;AAKtCC,UAAAA,kBAAkB,EAAE;AAClBC,YAAAA,GAAG,EAAE,KAAKC,WAAL,CAAiBC,IAAjB,CAAsB,IAAtB,CADa;AAElB,sBAAQ,KAAKC,aAAL,CAAmBD,IAAnB,CAAwB,IAAxB;AAFU,WALkB;AAStCE,UAAAA,YAAY,EAAE;AACZJ,YAAAA,GAAG,EAAE,KAAKK,WAAL,CAAiBH,IAAjB,CAAsB,IAAtB,CADO;AAEZ,sBAAQ,KAAKI,aAAL,CAAmBJ,IAAnB,CAAwB,IAAxB;AAFI;AATwB,SAA1B,CAAd;;AAeAK,6BAASC,MAAT,CAAgBf,OAAhB,EAAyB,IAAzB;AACD;AACF;;;kDArIkDgB,W","sourcesContent":["import {\n ModelUpdatedEvent,\n InsertSoundEvent,\n DeleteSoundEvent,\n InsertImageEvent,\n DeleteImageEvent,\n} from '@pie-framework/pie-configure-events';\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport Main from './main';\nimport defaults from './defaults';\nimport { addOrRemoveScaleColumn } from './utils';\nimport { excludeZeroTypes } from './modals';\n\nconst modelWithDefaults = (m) => ({ ...defaults.model, ...m });\nconst configurationWithDefaults = (c) => ({ ...defaults.configuration, ...c });\n\nexport default class MultiTraitRubricElement extends HTMLElement {\n constructor() {\n super();\n this._model = modelWithDefaults();\n this._configuration = configurationWithDefaults();\n }\n\n updateModelAccordingToReceivedProps = (m) => {\n const currentModel = { ...this._model };\n\n if (!m) {\n return currentModel;\n }\n\n const validatedModel = { ...m };\n const { scales, excludeZero } = validatedModel || {};\n\n (scales || []).forEach((scale) => {\n if (!scale) {\n scale = { scorePointsLabels: [], traits: [] };\n }\n\n const { maxPoints } = scale || {};\n\n scale.scorePointsLabels = [...(scale.scorePointsLabels || [])];\n scale.traits = [...(scale.traits || [])];\n\n const howManyScorePointLabelsShouldHave = excludeZero ? maxPoints : maxPoints + 1;\n const howManyScorePointLabelsItHas = scale.scorePointsLabels.length;\n\n if (howManyScorePointLabelsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointLabelsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointLabelsItHas; i++) {\n scale.scorePointsLabels.push('');\n }\n } else {\n scale.scorePointsLabels = scale.scorePointsLabels.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n\n (scale.traits || []).forEach((trait) => {\n if (!trait) {\n trait = { scorePointsDescriptors: [] };\n }\n\n trait.scorePointsDescriptors = [...(trait.scorePointsDescriptors || [])];\n\n const howManyScorePointDescriptorsItHas = trait.scorePointsDescriptors.length;\n\n if (howManyScorePointDescriptorsItHas !== howManyScorePointLabelsShouldHave) {\n if (howManyScorePointDescriptorsItHas < howManyScorePointLabelsShouldHave) {\n for (let i = 0; i < howManyScorePointLabelsShouldHave - howManyScorePointDescriptorsItHas; i++) {\n trait.scorePointsDescriptors.push('');\n }\n } else {\n trait.scorePointsDescriptors = trait.scorePointsDescriptors.slice(0, howManyScorePointLabelsShouldHave);\n }\n }\n });\n });\n\n if (validatedModel.excludeZero) {\n // check if any scale has maxPoints set to 1\n const shouldAddColumn0 = validatedModel.scales.some((scale) => scale.maxPoints === 1);\n\n if (shouldAddColumn0) {\n // excludeZero should be false and disabled when maxPoints is 1\n validatedModel.excludeZero = false;\n // add column 0 for all scales\n validatedModel.scales = addOrRemoveScaleColumn(scales, excludeZeroTypes.add0);\n }\n }\n\n return validatedModel;\n };\n\n set model(m) {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n }\n\n set configuration(c) {\n this._configuration = configurationWithDefaults(c);\n this._render();\n }\n\n onModelChanged = (m) => {\n this._model = this.updateModelAccordingToReceivedProps(modelWithDefaults(m));\n this._render();\n this.dispatchEvent(new ModelUpdatedEvent(this._model, false));\n };\n\n onConfigurationChanged = (c) => {\n this._configuration = configurationWithDefaults(c);\n\n this._render();\n };\n\n insertSound(handler) {\n this.dispatchEvent(new InsertSoundEvent(handler));\n }\n\n onDeleteSound(src, done) {\n this.dispatchEvent(new DeleteSoundEvent(src, done));\n }\n\n insertImage(handler) {\n this.dispatchEvent(new InsertImageEvent(handler));\n }\n\n onDeleteImage(src, done) {\n this.dispatchEvent(new DeleteImageEvent(src, done));\n }\n\n _render() {\n if (this._model) {\n let element = React.createElement(Main, {\n model: this._model,\n configuration: this._configuration,\n onModelChanged: this.onModelChanged,\n onConfigurationChanged: this.onConfigurationChanged,\n uploadSoundSupport: {\n add: this.insertSound.bind(this),\n delete: this.onDeleteSound.bind(this),\n },\n imageSupport: {\n add: this.insertImage.bind(this),\n delete: this.onDeleteImage.bind(this),\n },\n });\n\n ReactDOM.render(element, this);\n }\n }\n}\n"],"file":"index.js"}