@pie-element/complex-rubric 2.1.2-next.57 → 2.1.2-next.72

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.
@@ -7,6 +7,7 @@ The schema defines the following properties:
7
7
  This element must be one of the following enum values:
8
8
 
9
9
  * `multiTraitRubric`
10
+ * `rubricless`
10
11
  * `simpleRubric`
11
12
 
12
13
  # `rubrics` (object, required)
@@ -143,6 +144,30 @@ Identifier to identify the Pie Element in html markup, Must be unique within a p
143
144
 
144
145
  The html Element tag name
145
146
 
147
+ ## `rubricless` (object, required)
148
+
149
+ Properties of the `rubricless` object:
150
+
151
+ ### `maxPoints` (number)
152
+
153
+ Indicates the max limit for scoring points
154
+
155
+ ### `excludeZeros` (boolean)
156
+
157
+ Indicates if point 0 should be shown
158
+
159
+ ### `rubriclessInstructionEnabled` (boolean, required)
160
+
161
+ Indicates that rubricInstruction is enabled
162
+
163
+ ### `id` (string, required)
164
+
165
+ Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
166
+
167
+ ### `element` (string, required)
168
+
169
+ The html Element tag name
170
+
146
171
  # `id` (string, required)
147
172
 
148
173
  Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
@@ -468,6 +493,134 @@ Dialog box title
468
493
 
469
494
  Dialog box text
470
495
 
496
+ ## `RubriclessConfigure` (object)
497
+
498
+ Properties of the `RubriclessConfigure` object:
499
+
500
+ ### `settingsPanelDisabled` (boolean)
501
+
502
+ Indicates if the settings panel is not available
503
+
504
+ ### `showExcludeZero` (object)
505
+
506
+ Properties of the `showExcludeZero` object:
507
+
508
+ #### `settings` (boolean)
509
+
510
+ Indicates if the item has to be displayed in the Settings Panel
511
+
512
+ #### `label` (string)
513
+
514
+ Indicates the label for the item that has to be displayed in the Settings Panel
515
+
516
+ ### `showMaxPoint` (object)
517
+
518
+ Properties of the `showMaxPoint` object:
519
+
520
+ #### `settings` (boolean)
521
+
522
+ Indicates if the item has to be displayed in the Settings Panel
523
+
524
+ #### `label` (string)
525
+
526
+ Indicates the label for the item that has to be displayed in the Settings Panel
527
+
528
+ ### `width` (string)
529
+
530
+ How large can the rubric be
531
+
532
+ ### `mathMlOptions` (object)
533
+
534
+ Properties of the `mathMlOptions` object:
535
+
536
+ #### `mmlOutput` (number)
537
+
538
+ Indicates if model should have mathML output instead of latex
539
+
540
+ #### `mmlEditing` (number)
541
+
542
+ Indicates if mathML that's already in model should be editable
543
+
544
+ ### `maxMaxPoints` (number)
545
+
546
+ Indicates the max limit for scoring points
547
+
548
+ ### `rubricless` (boolean, enum, required)
549
+
550
+ Indicates that it is rubricless
551
+
552
+ This element must be one of the following enum values:
553
+
554
+ * `true`
555
+
556
+ ### `rubriclessInstruction` (object, required)
557
+
558
+ Properties of the `rubriclessInstruction` object:
559
+
560
+ #### `settings` (boolean, enum, required)
561
+
562
+ This element must be one of the following enum values:
563
+
564
+ * `true`
565
+
566
+ #### `label` (string, enum, required)
567
+
568
+ This element must be one of the following enum values:
569
+
570
+ * `Instruction`
571
+
572
+ ### `showPrompt` (boolean)
573
+
574
+ Determines whether prompt field will be displayed or not
575
+
576
+ Default: `true`
577
+
578
+ ### `promptLabel` (string)
579
+
580
+ The label for the item stem/prompt field
581
+
582
+ Default: `"Item Stemm"`
583
+
584
+ ### `contentDimensions` (object)
585
+
586
+ Indicates the dimensions configuration for the authoring container
587
+ Note: Some items have a default minimum width because of their content, but if
588
+ the minWidth is lower than this, the overflow behavior will take care of that
589
+
590
+ Properties of the `contentDimensions` object:
591
+
592
+ #### `maxHeight` (string,number)
593
+
594
+ Indicates the max height of the authoring container
595
+
596
+ Default: `"undefined"`
597
+
598
+ #### `maxWidth` (string,number)
599
+
600
+ Indicates the max width of the authoring container
601
+
602
+ Default: `"undefined"`
603
+
604
+ #### `minHeight` (string,number)
605
+
606
+ Indicates the min height of the authoring container
607
+
608
+ Default: `"undefined"`
609
+
610
+ #### `minWidth` (string,number)
611
+
612
+ Indicates the min width of the authoring container
613
+
614
+ Default: `"undefined"`
615
+
616
+ Default: `": {}"`
617
+
618
+ ### `settingsPartialScoring` (boolean)
619
+
620
+ Indicates whether the settings panel wil allow the author to modify settings for partial scoring
621
+
622
+ Default: `true`
623
+
471
624
  ## `RubricType` (string)
472
625
 
473
626
  ## `RubricModels` (object)
@@ -604,6 +757,30 @@ Identifier to identify the Pie Element in html markup, Must be unique within a p
604
757
 
605
758
  The html Element tag name
606
759
 
760
+ ### `rubricless` (object, required)
761
+
762
+ Properties of the `rubricless` object:
763
+
764
+ #### `maxPoints` (number)
765
+
766
+ Indicates the max limit for scoring points
767
+
768
+ #### `excludeZeros` (boolean)
769
+
770
+ Indicates if point 0 should be shown
771
+
772
+ #### `rubriclessInstructionEnabled` (boolean, required)
773
+
774
+ Indicates that rubricInstruction is enabled
775
+
776
+ #### `id` (string, required)
777
+
778
+ Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
779
+
780
+ #### `element` (string, required)
781
+
782
+ The html Element tag name
783
+
607
784
  ## `RubricPie` (object)
608
785
 
609
786
  Model for the RubricPie Interaction
@@ -802,4 +979,28 @@ Trait description
802
979
 
803
980
  Score point descriptors. Starting from 0 to max.
804
981
 
805
- The object is an array with all elements of the type `string`.
982
+ The object is an array with all elements of the type `string`.
983
+
984
+ ## `RubriclessPie` (object)
985
+
986
+ Properties of the `RubriclessPie` object:
987
+
988
+ ### `maxPoints` (number)
989
+
990
+ Indicates the max limit for scoring points
991
+
992
+ ### `excludeZeros` (boolean)
993
+
994
+ Indicates if point 0 should be shown
995
+
996
+ ### `rubriclessInstructionEnabled` (boolean, required)
997
+
998
+ Indicates that rubricInstruction is enabled
999
+
1000
+ ### `id` (string, required)
1001
+
1002
+ Identifier to identify the Pie Element in html markup, Must be unique within a pie item config.
1003
+
1004
+ ### `element` (string, required)
1005
+
1006
+ The html Element tag name
package/lib/index.js CHANGED
@@ -121,6 +121,12 @@ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
121
121
  _this2.setMultiTraitRubricModel(_this2.multiTraitRubric);
122
122
  });
123
123
  break;
124
+
125
+ case _rubric2.RUBRIC_TYPES.RUBRICLESS:
126
+ customElements.whenDefined(RUBRIC_TAG_NAME).then(function () {
127
+ _this2.setRubriclessModel(_this2.rubricless);
128
+ });
129
+ break;
124
130
  }
125
131
 
126
132
  if (oldType !== this.type) {
@@ -147,6 +153,16 @@ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
147
153
  });
148
154
  }
149
155
  }
156
+ }, {
157
+ key: "setRubriclessModel",
158
+ value: function setRubriclessModel(rubricless) {
159
+ if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {
160
+ var mode = this._model.mode;
161
+ rubricless.model = _objectSpread(_objectSpread({}, this._model.rubrics.rubricless), {}, {
162
+ mode: mode
163
+ });
164
+ }
165
+ }
150
166
  }, {
151
167
  key: "multiTraitRubric",
152
168
  get: function get() {
@@ -157,6 +173,11 @@ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
157
173
  get: function get() {
158
174
  return this.querySelector("".concat(RUBRIC_TAG_NAME, "#simpleRubric"));
159
175
  }
176
+ }, {
177
+ key: "rubricless",
178
+ get: function get() {
179
+ return this.querySelector("".concat(RUBRIC_TAG_NAME, "#rubricless"));
180
+ }
160
181
  }, {
161
182
  key: "connectedCallback",
162
183
  value: function connectedCallback() {
@@ -165,7 +186,16 @@ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
165
186
  }, {
166
187
  key: "_render",
167
188
  value: function _render() {
168
- var rubricTag = this._type === _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC ? "<".concat(RUBRIC_TAG_NAME, " id=\"simpleRubric\" />") : "<".concat(MULTI_TRAIT_RUBRIC_TAG_NAME, " id=\"multiTraitRubric\" />");
189
+ var rubricTag;
190
+
191
+ if (this._type === _rubric2.RUBRIC_TYPES.SIMPLE_RUBRIC) {
192
+ rubricTag = "<".concat(RUBRIC_TAG_NAME, " id=\"simpleRubric\" />");
193
+ } else if (this._type === _rubric2.RUBRIC_TYPES.RUBRICLESS) {
194
+ rubricTag = "<".concat(RUBRIC_TAG_NAME, " id=\"rubricless\" />");
195
+ } else {
196
+ rubricTag = "<".concat(MULTI_TRAIT_RUBRIC_TAG_NAME, " id=\"multiTraitRubric\" />");
197
+ }
198
+
169
199
  this.innerHTML = rubricTag; // when item is re-rendered (due to connectedCallback), if the custom element is already defined,
170
200
  // we need to set the model and session, otherwise the setters are not reached again
171
201
 
@@ -183,6 +213,13 @@ var ComplexRubric = /*#__PURE__*/function (_HTMLElement) {
183
213
  this.setMultiTraitRubricModel(this.multiTraitRubric);
184
214
  }
185
215
 
216
+ break;
217
+
218
+ case _rubric2.RUBRIC_TYPES.RUBRICLESS:
219
+ if (customElements.get(RUBRIC_TAG_NAME)) {
220
+ this.setRubriclessModel(this.rubricless);
221
+ }
222
+
186
223
  break;
187
224
  }
188
225
  }
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.js"],"names":["RUBRIC_TAG_NAME","MULTI_TRAIT_RUBRIC_TAG_NAME","ComplexRubricSimple","Rubric","ComplexRubricMultiTrait","MultiTraitRubric","defineRubrics","customElements","get","define","ComplexRubric","_model","_type","RUBRIC_TYPES","SIMPLE_RUBRIC","t","m","oldType","type","rubricType","whenDefined","then","setRubricModel","simpleRubric","MULTI_TRAIT_RUBRIC","setMultiTraitRubricModel","multiTraitRubric","_render","rubrics","mode","model","querySelector","rubricTag","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,eAAe,GAAG,uBAAxB;AACA,IAAMC,2BAA2B,GAAG,4BAApC;;IAEMC,mB;;;;;;;;;;;EAA4BC,kB;;IAG5BC,uB;;;;;;;;;;;EAAgCC,4B;;AAGtC,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,GAAM;AAC1B,MAAI,CAACC,cAAc,CAACC,GAAf,CAAmBR,eAAnB,CAAL,EAA0C;AACxCO,IAA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mGbxB,a","sourcesContent":["import Rubric from '@pie-element/rubric';\nimport MultiTraitRubric from '@pie-element/multi-trait-rubric';\nimport { RUBRIC_TYPES } from '@pie-lib/pie-toolbox/rubric';\n\nconst RUBRIC_TAG_NAME = 'complex-rubric-simple';\nconst MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';\n\nclass ComplexRubricSimple extends Rubric {\n}\n\nclass ComplexRubricMultiTrait extends MultiTraitRubric {\n}\n\nconst defineRubrics = () => {\n if (!customElements.get(RUBRIC_TAG_NAME)) {\n customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);\n }\n\n if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {\n customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);\n }\n};\n\ndefineRubrics();\n\nclass ComplexRubric extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;\n }\n\n set type(t) {\n this._type = t;\n }\n\n get type() {\n return this._type;\n }\n\n set model(m) {\n this._model = m;\n const oldType = this._type;\n this.type = m.rubricType;\n\n switch (this._type) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {\n this.setRubricModel(this.simpleRubric);\n });\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() => {\n this.setMultiTraitRubricModel(this.multiTraitRubric);\n });\n break;\n }\n\n if (oldType !== this.type) {\n this._render();\n }\n }\n\n setRubricModel(simpleRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {\n const { mode } = this._model;\n\n simpleRubric.model = {\n ...this._model.rubrics.simpleRubric,\n mode,\n };\n }\n }\n\n setMultiTraitRubricModel(multiTraitRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {\n const { mode } = this._model;\n\n multiTraitRubric.model = {\n ...this._model.rubrics.multiTraitRubric,\n mode,\n };\n }\n }\n\n get multiTraitRubric() {\n return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);\n }\n\n get simpleRubric() {\n return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n const rubricTag =\n this._type === RUBRIC_TYPES.SIMPLE_RUBRIC\n ? `<${RUBRIC_TAG_NAME} id=\"simpleRubric\" />`\n : `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id=\"multiTraitRubric\" />`;\n\n this.innerHTML = rubricTag;\n\n // when item is re-rendered (due to connectedCallback), if the custom element is already defined,\n // we need to set the model and session, otherwise the setters are not reached again\n switch (this._type) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n if (customElements.get(RUBRIC_TAG_NAME)) {\n this.setRubricModel(this.simpleRubric);\n }\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n if (customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {\n this.setMultiTraitRubricModel(this.multiTraitRubric);\n }\n break;\n }\n }\n}\n\nexport default ComplexRubric;\n"],"file":"index.js"}
1
+ {"version":3,"sources":["../src/index.js"],"names":["RUBRIC_TAG_NAME","MULTI_TRAIT_RUBRIC_TAG_NAME","ComplexRubricSimple","Rubric","ComplexRubricMultiTrait","MultiTraitRubric","defineRubrics","customElements","get","define","ComplexRubric","_model","_type","RUBRIC_TYPES","SIMPLE_RUBRIC","t","m","oldType","type","rubricType","whenDefined","then","setRubricModel","simpleRubric","MULTI_TRAIT_RUBRIC","setMultiTraitRubricModel","multiTraitRubric","RUBRICLESS","setRubriclessModel","rubricless","_render","rubrics","mode","model","querySelector","rubricTag","innerHTML","HTMLElement"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,eAAe,GAAG,uBAAxB;AACA,IAA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trait-rubric';\nimport { RUBRIC_TYPES } from '@pie-lib/pie-toolbox/rubric';\n\nconst RUBRIC_TAG_NAME = 'complex-rubric-simple';\nconst MULTI_TRAIT_RUBRIC_TAG_NAME = 'complex-rubric-multi-trait';\n\nclass ComplexRubricSimple extends Rubric {\n}\n\nclass ComplexRubricMultiTrait extends MultiTraitRubric {\n}\n\nconst defineRubrics = () => {\n if (!customElements.get(RUBRIC_TAG_NAME)) {\n customElements.define(RUBRIC_TAG_NAME, ComplexRubricSimple);\n }\n\n if (!customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {\n customElements.define(MULTI_TRAIT_RUBRIC_TAG_NAME, ComplexRubricMultiTrait);\n }\n};\n\ndefineRubrics();\n\nclass ComplexRubric extends HTMLElement {\n constructor() {\n super();\n this._model = {};\n this._type = RUBRIC_TYPES.SIMPLE_RUBRIC;\n }\n\n set type(t) {\n this._type = t;\n }\n\n get type() {\n return this._type;\n }\n\n set model(m) {\n this._model = m;\n const oldType = this._type;\n this.type = m.rubricType;\n\n switch (this._type) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {\n this.setRubricModel(this.simpleRubric);\n });\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n customElements.whenDefined(MULTI_TRAIT_RUBRIC_TAG_NAME).then(() => {\n this.setMultiTraitRubricModel(this.multiTraitRubric);\n });\n break;\n case RUBRIC_TYPES.RUBRICLESS:\n customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {\n this.setRubriclessModel(this.rubricless);\n });\n break;\n }\n\n if (oldType !== this.type) {\n this._render();\n }\n }\n\n setRubricModel(simpleRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.simpleRubric) {\n const { mode } = this._model;\n\n simpleRubric.model = {\n ...this._model.rubrics.simpleRubric,\n mode,\n };\n }\n }\n\n setMultiTraitRubricModel(multiTraitRubric) {\n if (this._model && this._model.rubrics && this._model.rubrics.multiTraitRubric) {\n const { mode } = this._model;\n\n multiTraitRubric.model = {\n ...this._model.rubrics.multiTraitRubric,\n mode,\n };\n }\n }\n\n setRubriclessModel(rubricless) {\n if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {\n const { mode } = this._model;\n\n rubricless.model = {\n ...this._model.rubrics.rubricless,\n mode,\n };\n }\n }\n\n get multiTraitRubric() {\n return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);\n }\n\n get simpleRubric() {\n return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);\n }\n\n get rubricless() {\n return this.querySelector(`${RUBRIC_TAG_NAME}#rubricless`);\n }\n\n connectedCallback() {\n this._render();\n }\n\n _render() {\n let rubricTag;\n if (this._type === RUBRIC_TYPES.SIMPLE_RUBRIC) {\n rubricTag = `<${RUBRIC_TAG_NAME} id=\"simpleRubric\" />`\n }\n else if (this._type === RUBRIC_TYPES.RUBRICLESS){\n rubricTag = `<${RUBRIC_TAG_NAME} id=\"rubricless\" />`;\n }\n else{\n rubricTag = `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id=\"multiTraitRubric\" />`;\n }\n\n this.innerHTML = rubricTag;\n\n // when item is re-rendered (due to connectedCallback), if the custom element is already defined,\n // we need to set the model and session, otherwise the setters are not reached again\n switch (this._type) {\n case RUBRIC_TYPES.SIMPLE_RUBRIC:\n default:\n if (customElements.get(RUBRIC_TAG_NAME)) {\n this.setRubricModel(this.simpleRubric);\n }\n break;\n case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:\n if (customElements.get(MULTI_TRAIT_RUBRIC_TAG_NAME)) {\n this.setMultiTraitRubricModel(this.multiTraitRubric);\n }\n break;\n case RUBRIC_TYPES.RUBRICLESS:\n if (customElements.get(RUBRIC_TAG_NAME)) {\n this.setRubriclessModel(this.rubricless);\n }\n break;\n\n }\n }\n}\n\nexport default ComplexRubric;\n"],"file":"index.js"}
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "2.1.2-next.57+2eabcbd03",
4
+ "version": "2.1.2-next.72+34eccd52c",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-element/multi-trait-rubric": "^3.0.4-next.57+2eabcbd03",
11
- "@pie-element/rubric": "^3.0.4-next.57+2eabcbd03",
10
+ "@pie-element/multi-trait-rubric": "^3.0.4-next.72+34eccd52c",
11
+ "@pie-element/rubric": "^3.0.4-next.72+34eccd52c",
12
12
  "@pie-framework/pie-player-events": "^0.1.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11",
16
16
  "prop-types": "^15.7.2"
17
17
  },
18
- "gitHead": "2eabcbd036e318bb24552f4140ca7384ad865951",
18
+ "gitHead": "34eccd52c44259eddf3e2b816b00b82f83bc2bf8",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },
package/src/index.js CHANGED
@@ -55,6 +55,11 @@ class ComplexRubric extends HTMLElement {
55
55
  this.setMultiTraitRubricModel(this.multiTraitRubric);
56
56
  });
57
57
  break;
58
+ case RUBRIC_TYPES.RUBRICLESS:
59
+ customElements.whenDefined(RUBRIC_TAG_NAME).then(() => {
60
+ this.setRubriclessModel(this.rubricless);
61
+ });
62
+ break;
58
63
  }
59
64
 
60
65
  if (oldType !== this.type) {
@@ -84,6 +89,17 @@ class ComplexRubric extends HTMLElement {
84
89
  }
85
90
  }
86
91
 
92
+ setRubriclessModel(rubricless) {
93
+ if (this._model && this._model.rubrics && this._model.rubrics.rubricless) {
94
+ const { mode } = this._model;
95
+
96
+ rubricless.model = {
97
+ ...this._model.rubrics.rubricless,
98
+ mode,
99
+ };
100
+ }
101
+ }
102
+
87
103
  get multiTraitRubric() {
88
104
  return this.querySelector(`${MULTI_TRAIT_RUBRIC_TAG_NAME}#multiTraitRubric`);
89
105
  }
@@ -92,15 +108,25 @@ class ComplexRubric extends HTMLElement {
92
108
  return this.querySelector(`${RUBRIC_TAG_NAME}#simpleRubric`);
93
109
  }
94
110
 
111
+ get rubricless() {
112
+ return this.querySelector(`${RUBRIC_TAG_NAME}#rubricless`);
113
+ }
114
+
95
115
  connectedCallback() {
96
116
  this._render();
97
117
  }
98
118
 
99
119
  _render() {
100
- const rubricTag =
101
- this._type === RUBRIC_TYPES.SIMPLE_RUBRIC
102
- ? `<${RUBRIC_TAG_NAME} id="simpleRubric" />`
103
- : `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id="multiTraitRubric" />`;
120
+ let rubricTag;
121
+ if (this._type === RUBRIC_TYPES.SIMPLE_RUBRIC) {
122
+ rubricTag = `<${RUBRIC_TAG_NAME} id="simpleRubric" />`
123
+ }
124
+ else if (this._type === RUBRIC_TYPES.RUBRICLESS){
125
+ rubricTag = `<${RUBRIC_TAG_NAME} id="rubricless" />`;
126
+ }
127
+ else{
128
+ rubricTag = `<${MULTI_TRAIT_RUBRIC_TAG_NAME} id="multiTraitRubric" />`;
129
+ }
104
130
 
105
131
  this.innerHTML = rubricTag;
106
132
 
@@ -118,6 +144,12 @@ class ComplexRubric extends HTMLElement {
118
144
  this.setMultiTraitRubricModel(this.multiTraitRubric);
119
145
  }
120
146
  break;
147
+ case RUBRIC_TYPES.RUBRICLESS:
148
+ if (customElements.get(RUBRIC_TAG_NAME)) {
149
+ this.setRubriclessModel(this.rubricless);
150
+ }
151
+ break;
152
+
121
153
  }
122
154
  }
123
155
  }