@pie-element/complex-rubric 7.1.1-next.0 → 7.1.1-next.29

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 (118) hide show
  1. package/CHANGELOG.md +1439 -0
  2. package/LICENSE.md +5 -0
  3. package/README.md +3 -0
  4. package/configure/CHANGELOG.md +1093 -0
  5. package/configure/lib/defaults.js +271 -0
  6. package/configure/lib/defaults.js.map +1 -0
  7. package/configure/lib/index.js +150 -0
  8. package/configure/lib/index.js.map +1 -0
  9. package/configure/lib/main.js +172 -0
  10. package/configure/lib/main.js.map +1 -0
  11. package/configure/package.json +27 -0
  12. package/configure/src/__tests__/index.test.js +94 -0
  13. package/configure/src/__tests__/main.test.jsx +140 -0
  14. package/configure/src/defaults.js +213 -0
  15. package/configure/src/index.js +169 -0
  16. package/configure/src/main.jsx +162 -0
  17. package/controller/CHANGELOG.md +932 -0
  18. package/controller/lib/defaults.js +42 -0
  19. package/controller/lib/defaults.js.map +1 -0
  20. package/controller/lib/index.js +239 -0
  21. package/controller/lib/index.js.map +1 -0
  22. package/controller/lib/utils.js +11 -0
  23. package/controller/lib/utils.js.map +1 -0
  24. package/controller/package.json +16 -0
  25. package/controller/src/__tests__/index.test.js +55 -0
  26. package/controller/src/defaults.js +39 -0
  27. package/controller/src/index.js +220 -0
  28. package/controller/src/utils.js +3 -0
  29. package/docs/config-schema.json +4255 -0
  30. package/docs/config-schema.json.md +3162 -0
  31. package/docs/demo/config.js +8 -0
  32. package/docs/demo/generate.js +196 -0
  33. package/docs/demo/index.html +1 -0
  34. package/docs/demo/session.js +6 -0
  35. package/docs/pie-schema.json +3302 -0
  36. package/docs/pie-schema.json.md +2364 -0
  37. package/lib/index.js +141 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/print.js +129 -0
  40. package/lib/print.js.map +1 -0
  41. package/module/configure.js +1 -0
  42. package/module/controller.js +262 -0
  43. package/module/demo.js +221 -0
  44. package/module/element.js +1 -0
  45. package/module/index.html +21 -0
  46. package/module/manifest.json +22 -0
  47. package/module/print-demo.js +259 -0
  48. package/module/print.html +18 -0
  49. package/module/print.js +1 -0
  50. package/package.json +20 -57
  51. package/src/__tests__/index.test.js +256 -0
  52. package/src/index.js +152 -0
  53. package/src/print.js +140 -0
  54. package/dist/author/defaults.d.ts +0 -231
  55. package/dist/author/defaults.js +0 -177
  56. package/dist/author/index.d.ts +0 -34
  57. package/dist/author/index.js +0 -87
  58. package/dist/author/main.d.ts +0 -23
  59. package/dist/author/main.js +0 -106
  60. package/dist/controller/defaults.d.ts +0 -39
  61. package/dist/controller/defaults.js +0 -42
  62. package/dist/controller/index.d.ts +0 -25
  63. package/dist/controller/index.js +0 -107
  64. package/dist/controller/utils.d.ts +0 -9
  65. package/dist/controller/utils.js +0 -4
  66. package/dist/delivery/index.d.ts +0 -23
  67. package/dist/delivery/index.js +0 -96
  68. package/dist/index.d.ts +0 -1
  69. package/dist/index.iife.d.ts +0 -8
  70. package/dist/index.iife.js +0 -145
  71. package/dist/index.js +0 -2
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +0 -12
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +0 -9
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +0 -12
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +0 -13
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +0 -6
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +0 -8
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +0 -16
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  117. package/dist/print/index.d.ts +0 -24
  118. package/dist/print/index.js +0 -84
@@ -0,0 +1,162 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { RUBRIC_TYPES } from '@pie-lib/rubric';
4
+ import { layout } from '@pie-lib/config-ui';
5
+ import Radio from '@mui/material/Radio';
6
+ import RadioGroup from '@mui/material/RadioGroup';
7
+ import FormControlLabel from '@mui/material/FormControlLabel';
8
+ import { styled } from '@mui/material/styles';
9
+ import { color } from '@pie-lib/render-ui';
10
+
11
+ const StyledFormControlLabel = styled(FormControlLabel)({
12
+ '&.MuiFormControlLabel-root': {
13
+ width: 'fit-content',
14
+ paddingRight: '24px',
15
+ boxSizing: 'border-box',
16
+ '&:hover': {
17
+ background: 'var(--pie-secondary-background, rgba(241,241,241,1))',
18
+ },
19
+ },
20
+ });
21
+
22
+ const StyledRadio = styled(Radio)({
23
+ '&.MuiRadio-root': {
24
+ color: `${color.tertiary()} !important`,
25
+ },
26
+ });
27
+
28
+ const rubricLabels = {
29
+ [RUBRIC_TYPES.MULTI_TRAIT_RUBRIC]: 'Multi Trait Rubric',
30
+ [RUBRIC_TYPES.SIMPLE_RUBRIC]: 'Simple Rubric',
31
+ [RUBRIC_TYPES.RUBRICLESS]: 'Rubricless',
32
+ };
33
+
34
+ export class Main extends React.Component {
35
+ static propTypes = {
36
+ canUpdateModel: PropTypes.bool,
37
+ configuration: PropTypes.object,
38
+ model: PropTypes.object,
39
+ onModelChanged: PropTypes.func,
40
+ onConfigurationChanged: PropTypes.func,
41
+ };
42
+
43
+ onModelChanged = (model) => {
44
+ const { onModelChanged } = this.props;
45
+
46
+ return onModelChanged(model);
47
+ };
48
+
49
+ onChangeRubricType = (e) => {
50
+ const { model } = this.props;
51
+
52
+ const rubricType = e.target.value;
53
+ this.onModelChanged({ ...model, rubricType });
54
+ };
55
+
56
+ render() {
57
+ const { model, configuration, canUpdateModel } = this.props;
58
+
59
+ const { extraCSSRules, rubrics = {} } = model || {};
60
+ let { rubricType } = model;
61
+ const {
62
+ contentDimensions = {},
63
+ rubricOptions = [],
64
+ multiTraitRubric,
65
+ simpleRubric,
66
+ rubricless,
67
+ width,
68
+ } = configuration;
69
+ let rubricTag = '';
70
+
71
+ if (!rubricType) {
72
+ rubricType = RUBRIC_TYPES.SIMPLE_RUBRIC;
73
+ }
74
+
75
+ const isRubricTypeAvailable = rubricOptions.indexOf(rubricType) > -1;
76
+
77
+ if (canUpdateModel) {
78
+ switch (rubricType) {
79
+ case RUBRIC_TYPES.SIMPLE_RUBRIC:
80
+ default:
81
+ rubricTag = (
82
+ <rubric-configure
83
+ id="simpleRubric"
84
+ key="simple-rubric"
85
+ ref={(ref) => {
86
+ if (ref) {
87
+ this.simpleRubric = ref;
88
+ this.simpleRubric.model = { ...rubrics.simpleRubric, errors: model.errors || {} };
89
+ this.simpleRubric.configuration = { ...simpleRubric, width };
90
+ }
91
+ }}
92
+ />
93
+ );
94
+ break;
95
+
96
+ case RUBRIC_TYPES.MULTI_TRAIT_RUBRIC:
97
+ rubricTag = (
98
+ <multi-trait-rubric-configure
99
+ id="multiTraitRubric"
100
+ key="multi-trait-rubric"
101
+ ref={(ref) => {
102
+ if (ref) {
103
+ this.multiTraitRubric = ref;
104
+
105
+ this.multiTraitRubric.model = { ...rubrics.multiTraitRubric, errors: model.errors || {} };
106
+ this.multiTraitRubric.configuration = { ...multiTraitRubric, width: width || multiTraitRubric.width };
107
+ }
108
+ }}
109
+ />
110
+ );
111
+ break;
112
+
113
+ case RUBRIC_TYPES.RUBRICLESS:
114
+ rubricTag = (
115
+ <rubric-configure
116
+ id="rubricless"
117
+ key="rubricless"
118
+ ref={(ref) => {
119
+ if (ref) {
120
+ this.rubricless = ref;
121
+
122
+ this.rubricless.model = rubrics.rubricless;
123
+ this.rubricless.configuration = { ...rubricless, width };
124
+ }
125
+ }}
126
+ />
127
+ );
128
+ break;
129
+ }
130
+ }
131
+
132
+ return (
133
+ <layout.ConfigLayout
134
+ extraCSSRules={extraCSSRules}
135
+ dimensions={contentDimensions}
136
+ hideSettings={true}
137
+ settings={null}
138
+ >
139
+ <RadioGroup
140
+ aria-label="rubric-type"
141
+ name="rubricType"
142
+ value={model.rubricType}
143
+ onChange={this.onChangeRubricType}
144
+ >
145
+ {rubricOptions.length > 1 &&
146
+ rubricOptions.map((availableRubric, i) => (
147
+ <StyledFormControlLabel
148
+ key={i}
149
+ value={availableRubric}
150
+ control={<StyledRadio checked={rubricType === availableRubric} />}
151
+ label={rubricLabels[availableRubric]}
152
+ />
153
+ ))}
154
+ </RadioGroup>
155
+
156
+ {isRubricTypeAvailable && rubricTag}
157
+ </layout.ConfigLayout>
158
+ );
159
+ }
160
+ }
161
+
162
+ export default Main;