@pie-element/likert 0.1.3 → 0.1.4-next.1016
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.
- package/CHANGELOG.md +150 -0
- package/configure/CHANGELOG.md +117 -0
- package/configure/lib/defaults.js +5 -0
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/likertEntities.js +1 -1
- package/configure/lib/main.js +14 -7
- package/configure/lib/main.js.map +1 -1
- package/configure/package.json +3 -3
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/index.js +3 -3
- package/controller/package.json +1 -1
- package/docs/config-schema.json +16 -0
- package/docs/config-schema.json.md +12 -0
- package/docs/pie-schema.json +6 -0
- package/docs/pie-schema.json.md +4 -0
- package/lib/choice-input.js +2 -2
- package/lib/choice-input.js.map +1 -1
- package/lib/index.js +5 -2
- package/lib/index.js.map +1 -1
- package/lib/likert.js +7 -10
- package/lib/likert.js.map +1 -1
- package/lib/main.js +1 -1
- package/lib/main.js.map +1 -1
- package/package.json +4 -4
- package/module/configure.js +0 -1306
- package/module/controller.js +0 -55
- package/module/demo.js +0 -49
- package/module/element.js +0 -408
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/controller.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var defaults = {
|
|
2
|
-
choices: []
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
const prepareChoice = choice => {
|
|
6
|
-
return {
|
|
7
|
-
label: choice.label,
|
|
8
|
-
value: choice.value
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function createDefaultModel(model = {}) {
|
|
13
|
-
return new Promise(resolve => resolve({ ...defaults, ...model }));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const normalize = question => ({ ...defaults, ...question });
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {*} question
|
|
21
|
-
* @param {*} session
|
|
22
|
-
* @param {*} env
|
|
23
|
-
*/
|
|
24
|
-
async function model(question, session, env) {
|
|
25
|
-
const normalizedQuestion = normalize(question);
|
|
26
|
-
|
|
27
|
-
let choices = normalizedQuestion.choices.map(prepareChoice);
|
|
28
|
-
|
|
29
|
-
const out = {
|
|
30
|
-
...normalizedQuestion,
|
|
31
|
-
choices,
|
|
32
|
-
disabled: env.mode !== 'gather',
|
|
33
|
-
mode: env.mode
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const { role, mode } = env || {};
|
|
37
|
-
|
|
38
|
-
if (role === 'instructor' && (mode === 'view' || mode === 'evaluate')) {
|
|
39
|
-
out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled
|
|
40
|
-
? normalizedQuestion.teacherInstructions
|
|
41
|
-
: null;
|
|
42
|
-
} else {
|
|
43
|
-
out.teacherInstructions = null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return out;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function outcome() {
|
|
50
|
-
return new Promise(resolve => {
|
|
51
|
-
resolve({ score: 0, empty: false });
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { createDefaultModel, model, normalize, outcome };
|
package/module/demo.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import Configure from './configure.js';
|
|
2
|
-
import Element from './element.js';
|
|
3
|
-
import * as controller from './controller.js';
|
|
4
|
-
|
|
5
|
-
var model = (id, element) => ({
|
|
6
|
-
id,
|
|
7
|
-
element,
|
|
8
|
-
likertScale: 'likert3',
|
|
9
|
-
likertType: 'agreement',
|
|
10
|
-
likertOrientation: 'horizontal',
|
|
11
|
-
choices: [
|
|
12
|
-
{
|
|
13
|
-
label: 'Disagree',
|
|
14
|
-
value: -1
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: 'Unsure',
|
|
18
|
-
value: 0
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
label: 'Agree',
|
|
22
|
-
value: 1
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
prompt: 'How likely are you to report a problem?'
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
var generate = {
|
|
29
|
-
model: model
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const { model: model$1 } = generate;
|
|
33
|
-
|
|
34
|
-
var config = {
|
|
35
|
-
elements: {
|
|
36
|
-
'likert-element': '../..'
|
|
37
|
-
},
|
|
38
|
-
models: [model$1('1', 'likert-element')]
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
//Note: demo-el is a custom element loaded in the markup.
|
|
42
|
-
customElements.whenDefined('demo-el').then(() => {
|
|
43
|
-
config.models.forEach(m => {
|
|
44
|
-
const de = document.createElement('demo-el');
|
|
45
|
-
document.body.appendChild(de);
|
|
46
|
-
de.def = { tagName: m.element, Element, Configure, controller };
|
|
47
|
-
de.model = m;
|
|
48
|
-
});
|
|
49
|
-
});
|
package/module/element.js
DELETED
|
@@ -1,408 +0,0 @@
|
|
|
1
|
-
import {_dll_react, _dll_material_ui__core, _dll_prop_types, _dll_material_ui__core_styles, _dll_pie_lib__render_ui, _dll_react_dom, _dll_pie_framework__pie_player_events, _dll_pie_lib__math_rendering} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
|
|
2
|
-
function createCommonjsModule(fn, module) {
|
|
3
|
-
return (module = {
|
|
4
|
-
exports: {}
|
|
5
|
-
}, fn(module, module.exports), module.exports);
|
|
6
|
-
}
|
|
7
|
-
var classnames = createCommonjsModule(function (module) {
|
|
8
|
-
(function () {
|
|
9
|
-
var hasOwn = ({}).hasOwnProperty;
|
|
10
|
-
function classNames() {
|
|
11
|
-
var classes = [];
|
|
12
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
13
|
-
var arg = arguments[i];
|
|
14
|
-
if (!arg) continue;
|
|
15
|
-
var argType = typeof arg;
|
|
16
|
-
if (argType === 'string' || argType === 'number') {
|
|
17
|
-
classes.push(arg);
|
|
18
|
-
} else if (Array.isArray(arg) && arg.length) {
|
|
19
|
-
var inner = classNames.apply(null, arg);
|
|
20
|
-
if (inner) {
|
|
21
|
-
classes.push(inner);
|
|
22
|
-
}
|
|
23
|
-
} else if (argType === 'object') {
|
|
24
|
-
for (var key in arg) {
|
|
25
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
26
|
-
classes.push(key);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return classes.join(' ');
|
|
32
|
-
}
|
|
33
|
-
if (module.exports) {
|
|
34
|
-
classNames.default = classNames;
|
|
35
|
-
module.exports = classNames;
|
|
36
|
-
} else {
|
|
37
|
-
window.classNames = classNames;
|
|
38
|
-
}
|
|
39
|
-
})();
|
|
40
|
-
});
|
|
41
|
-
const LIKERT_ORIENTATION = {
|
|
42
|
-
horizontal: 'horizontal',
|
|
43
|
-
vertical: 'vertical'
|
|
44
|
-
};
|
|
45
|
-
const React = _dll_react;
|
|
46
|
-
const {FormControlLabel: FormControlLabel} = _dll_material_ui__core;
|
|
47
|
-
const {Radio: Radio} = _dll_material_ui__core;
|
|
48
|
-
const PropTypes = _dll_prop_types;
|
|
49
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
50
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
51
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/likert/src/choice-input.jsx";
|
|
52
|
-
const radioStyles = {
|
|
53
|
-
root: {
|
|
54
|
-
color: `var(--choice-input-color, ${color.text()})`
|
|
55
|
-
},
|
|
56
|
-
checked: {
|
|
57
|
-
color: `var(--choice-input-selected-color, ${color.text()})`
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
const RadioStyled = withStyles(radioStyles)(props => {
|
|
61
|
-
const {classes, checked, onChange, disabled} = props;
|
|
62
|
-
return React.createElement(Radio, {
|
|
63
|
-
checked: checked,
|
|
64
|
-
onChange: onChange,
|
|
65
|
-
disabled: disabled,
|
|
66
|
-
classes: {
|
|
67
|
-
root: classes.root,
|
|
68
|
-
checked: classes.checked
|
|
69
|
-
},
|
|
70
|
-
__self: undefined,
|
|
71
|
-
__source: {
|
|
72
|
-
fileName: _jsxFileName,
|
|
73
|
-
lineNumber: 23
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
const choiceInputStyles = () => ({
|
|
78
|
-
labelRoot: {
|
|
79
|
-
color: color.text(),
|
|
80
|
-
textAlign: 'center',
|
|
81
|
-
cursor: 'pointer'
|
|
82
|
-
},
|
|
83
|
-
checkboxHolderRoot: {
|
|
84
|
-
display: 'flex',
|
|
85
|
-
alignItems: 'center',
|
|
86
|
-
flex: 1,
|
|
87
|
-
padding: '0 5px',
|
|
88
|
-
'& label': {}
|
|
89
|
-
},
|
|
90
|
-
formControlLabelRoot: {
|
|
91
|
-
margin: 0
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
class ChoiceInput extends React.Component {
|
|
95
|
-
constructor(...args) {
|
|
96
|
-
super(...args);
|
|
97
|
-
ChoiceInput.prototype.__init.call(this);
|
|
98
|
-
}
|
|
99
|
-
static __initStatic() {
|
|
100
|
-
this.propTypes = {
|
|
101
|
-
checked: PropTypes.bool.isRequired,
|
|
102
|
-
disabled: PropTypes.bool.isRequired,
|
|
103
|
-
label: PropTypes.string.isRequired,
|
|
104
|
-
likertOrientation: PropTypes.string.isRequired,
|
|
105
|
-
onChange: PropTypes.func.isRequired,
|
|
106
|
-
value: PropTypes.number.isRequired,
|
|
107
|
-
classes: PropTypes.object
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
static __initStatic2() {
|
|
111
|
-
this.defaultProps = {
|
|
112
|
-
checked: false
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
__init() {
|
|
116
|
-
this.onToggleChoice = () => {
|
|
117
|
-
this.props.onChange({
|
|
118
|
-
value: this.props.value,
|
|
119
|
-
selected: !this.props.checked
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
render() {
|
|
124
|
-
const {disabled, label, checked, likertOrientation, classes} = this.props;
|
|
125
|
-
const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'row' : 'column';
|
|
126
|
-
return React.createElement('div', {
|
|
127
|
-
className: classes.checkboxHolderRoot,
|
|
128
|
-
style: {
|
|
129
|
-
flexDirection
|
|
130
|
-
},
|
|
131
|
-
__self: this,
|
|
132
|
-
__source: {
|
|
133
|
-
fileName: _jsxFileName,
|
|
134
|
-
lineNumber: 88
|
|
135
|
-
}
|
|
136
|
-
}, React.createElement(FormControlLabel, {
|
|
137
|
-
disabled: disabled,
|
|
138
|
-
className: classes.formControlLabelRoot,
|
|
139
|
-
control: React.createElement(RadioStyled, {
|
|
140
|
-
checked: checked,
|
|
141
|
-
onChange: this.onToggleChoice,
|
|
142
|
-
__self: this,
|
|
143
|
-
__source: {
|
|
144
|
-
fileName: _jsxFileName,
|
|
145
|
-
lineNumber: 93
|
|
146
|
-
}
|
|
147
|
-
}),
|
|
148
|
-
__self: this,
|
|
149
|
-
__source: {
|
|
150
|
-
fileName: _jsxFileName,
|
|
151
|
-
lineNumber: 89
|
|
152
|
-
}
|
|
153
|
-
}), React.createElement('p', {
|
|
154
|
-
className: classes.labelRoot,
|
|
155
|
-
onClick: this.onToggleChoice,
|
|
156
|
-
dangerouslySetInnerHTML: {
|
|
157
|
-
__html: label
|
|
158
|
-
},
|
|
159
|
-
__self: this,
|
|
160
|
-
__source: {
|
|
161
|
-
fileName: _jsxFileName,
|
|
162
|
-
lineNumber: 99
|
|
163
|
-
}
|
|
164
|
-
}));
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
ChoiceInput.__initStatic();
|
|
168
|
-
ChoiceInput.__initStatic2();
|
|
169
|
-
var ChoiceInput$1 = withStyles(choiceInputStyles)(ChoiceInput);
|
|
170
|
-
const React$1 = _dll_react;
|
|
171
|
-
const PropTypes$1 = _dll_prop_types;
|
|
172
|
-
const {withStyles: withStyles$1} = _dll_material_ui__core_styles;
|
|
173
|
-
const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
|
|
174
|
-
const _jsxFileName$1 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/likert/src/likert.jsx";
|
|
175
|
-
const styles = {
|
|
176
|
-
corespringChoice: {
|
|
177
|
-
'& *': {
|
|
178
|
-
fontFamily: 'Roboto, Arial, Helvetica, sans-serif',
|
|
179
|
-
'-webkit-font-smoothing': 'antialiased'
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
prompt: {
|
|
183
|
-
verticalAlign: 'middle',
|
|
184
|
-
color: 'var(--pie-primary-text, var(--pie-text, #000000))',
|
|
185
|
-
paddingBottom: '20px'
|
|
186
|
-
},
|
|
187
|
-
choicesWrapper: {
|
|
188
|
-
display: 'flex'
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
class Likert extends React$1.Component {
|
|
192
|
-
static __initStatic() {
|
|
193
|
-
this.propTypes = {
|
|
194
|
-
choices: PropTypes$1.array,
|
|
195
|
-
prompt: PropTypes$1.string,
|
|
196
|
-
teacherInstructions: PropTypes$1.string,
|
|
197
|
-
session: PropTypes$1.object,
|
|
198
|
-
disabled: PropTypes$1.bool.isRequired,
|
|
199
|
-
onSessionChange: PropTypes$1.func.isRequired,
|
|
200
|
-
likertOrientation: PropTypes$1.string.isRequired,
|
|
201
|
-
classes: PropTypes$1.object.isRequired
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
UNSAFE_componentWillReceiveProps() {}
|
|
205
|
-
isSelected(value) {
|
|
206
|
-
return this.props.session && this.props.session.value === value;
|
|
207
|
-
}
|
|
208
|
-
render() {
|
|
209
|
-
const {disabled, choices = [], prompt, onSessionChange, teacherInstructions, classes, likertOrientation} = this.props;
|
|
210
|
-
const flexDirection = likertOrientation === LIKERT_ORIENTATION.vertical ? 'column' : 'row';
|
|
211
|
-
return React$1.createElement('div', {
|
|
212
|
-
className: classes.corespringChoice,
|
|
213
|
-
__self: this,
|
|
214
|
-
__source: {
|
|
215
|
-
fileName: _jsxFileName$1,
|
|
216
|
-
lineNumber: 58
|
|
217
|
-
}
|
|
218
|
-
}, teacherInstructions && React$1.createElement(Collapsible, {
|
|
219
|
-
labels: {
|
|
220
|
-
hidden: 'Show Teacher Instructions',
|
|
221
|
-
visible: 'Hide Teacher Instructions'
|
|
222
|
-
},
|
|
223
|
-
__self: this,
|
|
224
|
-
__source: {
|
|
225
|
-
fileName: _jsxFileName$1,
|
|
226
|
-
lineNumber: 60
|
|
227
|
-
}
|
|
228
|
-
}, React$1.createElement('div', {
|
|
229
|
-
dangerouslySetInnerHTML: {
|
|
230
|
-
__html: teacherInstructions
|
|
231
|
-
},
|
|
232
|
-
__self: this,
|
|
233
|
-
__source: {
|
|
234
|
-
fileName: _jsxFileName$1,
|
|
235
|
-
lineNumber: 66
|
|
236
|
-
}
|
|
237
|
-
})), React$1.createElement('br', {
|
|
238
|
-
__self: this,
|
|
239
|
-
__source: {
|
|
240
|
-
fileName: _jsxFileName$1,
|
|
241
|
-
lineNumber: 69
|
|
242
|
-
}
|
|
243
|
-
}), React$1.createElement('br', {
|
|
244
|
-
__self: this,
|
|
245
|
-
__source: {
|
|
246
|
-
fileName: _jsxFileName$1,
|
|
247
|
-
lineNumber: 70
|
|
248
|
-
}
|
|
249
|
-
}), React$1.createElement('div', {
|
|
250
|
-
className: classes.prompt,
|
|
251
|
-
dangerouslySetInnerHTML: {
|
|
252
|
-
__html: prompt
|
|
253
|
-
},
|
|
254
|
-
__self: this,
|
|
255
|
-
__source: {
|
|
256
|
-
fileName: _jsxFileName$1,
|
|
257
|
-
lineNumber: 71
|
|
258
|
-
}
|
|
259
|
-
}), React$1.createElement('div', {
|
|
260
|
-
className: classes.choicesWrapper,
|
|
261
|
-
style: {
|
|
262
|
-
flexDirection
|
|
263
|
-
},
|
|
264
|
-
__self: this,
|
|
265
|
-
__source: {
|
|
266
|
-
fileName: _jsxFileName$1,
|
|
267
|
-
lineNumber: 75
|
|
268
|
-
}
|
|
269
|
-
}, choices.map((choice, index) => React$1.createElement(ChoiceInput$1, {
|
|
270
|
-
key: `choice-${index}`,
|
|
271
|
-
label: choice.label,
|
|
272
|
-
value: choice.value,
|
|
273
|
-
index: index,
|
|
274
|
-
disabled: disabled,
|
|
275
|
-
onChange: onSessionChange,
|
|
276
|
-
likertOrientation: likertOrientation,
|
|
277
|
-
checked: this.isSelected(choice.value),
|
|
278
|
-
__self: this,
|
|
279
|
-
__source: {
|
|
280
|
-
fileName: _jsxFileName$1,
|
|
281
|
-
lineNumber: 77
|
|
282
|
-
}
|
|
283
|
-
}))));
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
Likert.__initStatic();
|
|
287
|
-
Likert.defaultProps = {
|
|
288
|
-
session: {
|
|
289
|
-
value: []
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
var Likert$1 = withStyles$1(styles)(Likert);
|
|
293
|
-
const React$2 = _dll_react;
|
|
294
|
-
const PropTypes$2 = _dll_prop_types;
|
|
295
|
-
const {withStyles: withStyles$2} = _dll_material_ui__core_styles;
|
|
296
|
-
const {createMuiTheme: createMuiTheme} = _dll_material_ui__core_styles;
|
|
297
|
-
const {MuiThemeProvider: MuiThemeProvider} = _dll_material_ui__core_styles;
|
|
298
|
-
const {PreviewLayout: PreviewLayout} = _dll_pie_lib__render_ui;
|
|
299
|
-
const _jsxFileName$2 = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/likert/src/main.jsx";
|
|
300
|
-
class Main extends React$2.Component {
|
|
301
|
-
static __initStatic() {
|
|
302
|
-
this.propTypes = {
|
|
303
|
-
model: PropTypes$2.object,
|
|
304
|
-
session: PropTypes$2.object,
|
|
305
|
-
onSessionChange: PropTypes$2.func,
|
|
306
|
-
classes: PropTypes$2.object.isRequired
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
static __initStatic2() {
|
|
310
|
-
this.defaultProps = {
|
|
311
|
-
model: {},
|
|
312
|
-
session: {}
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
render() {
|
|
316
|
-
const {model, onSessionChange, session, classes} = this.props;
|
|
317
|
-
return React$2.createElement(PreviewLayout, {
|
|
318
|
-
__self: this,
|
|
319
|
-
__source: {
|
|
320
|
-
fileName: _jsxFileName$2,
|
|
321
|
-
lineNumber: 25
|
|
322
|
-
}
|
|
323
|
-
}, React$2.createElement('div', {
|
|
324
|
-
className: classnames(classes.root, classes[model.className]),
|
|
325
|
-
__self: this,
|
|
326
|
-
__source: {
|
|
327
|
-
fileName: _jsxFileName$2,
|
|
328
|
-
lineNumber: 26
|
|
329
|
-
}
|
|
330
|
-
}, React$2.createElement(Likert$1, {
|
|
331
|
-
...model,
|
|
332
|
-
session: session,
|
|
333
|
-
onSessionChange: onSessionChange,
|
|
334
|
-
__self: this,
|
|
335
|
-
__source: {
|
|
336
|
-
fileName: _jsxFileName$2,
|
|
337
|
-
lineNumber: 27
|
|
338
|
-
}
|
|
339
|
-
})));
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
Main.__initStatic();
|
|
343
|
-
Main.__initStatic2();
|
|
344
|
-
const Styled = withStyles$2({}, {
|
|
345
|
-
name: 'Main'
|
|
346
|
-
})(Main);
|
|
347
|
-
const theme = createMuiTheme({
|
|
348
|
-
typography: {
|
|
349
|
-
useNextVariants: true
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
const Root = props => React$2.createElement(MuiThemeProvider, {
|
|
353
|
-
theme: theme,
|
|
354
|
-
__self: undefined,
|
|
355
|
-
__source: {
|
|
356
|
-
fileName: _jsxFileName$2,
|
|
357
|
-
lineNumber: 47
|
|
358
|
-
}
|
|
359
|
-
}, React$2.createElement(Styled, {
|
|
360
|
-
...props,
|
|
361
|
-
__self: undefined,
|
|
362
|
-
__source: {
|
|
363
|
-
fileName: _jsxFileName$2,
|
|
364
|
-
lineNumber: 48
|
|
365
|
-
}
|
|
366
|
-
}));
|
|
367
|
-
const React$3 = _dll_react;
|
|
368
|
-
const ReactDOM = _dll_react_dom;
|
|
369
|
-
const {SessionChangedEvent: SessionChangedEvent} = _dll_pie_framework__pie_player_events;
|
|
370
|
-
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
371
|
-
const isComplete = session => !!(session && session.value && session.value.length);
|
|
372
|
-
class Likert$2 extends HTMLElement {
|
|
373
|
-
constructor() {
|
|
374
|
-
super();
|
|
375
|
-
}
|
|
376
|
-
set model(m) {
|
|
377
|
-
this._model = m;
|
|
378
|
-
this._render();
|
|
379
|
-
}
|
|
380
|
-
set session(s) {
|
|
381
|
-
this._session = s;
|
|
382
|
-
this._render();
|
|
383
|
-
}
|
|
384
|
-
sessionChanged(s) {
|
|
385
|
-
this._session.value = s.value;
|
|
386
|
-
const complete = isComplete(this._session, this._model);
|
|
387
|
-
this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), complete));
|
|
388
|
-
this._render();
|
|
389
|
-
}
|
|
390
|
-
connectedCallback() {
|
|
391
|
-
this._render();
|
|
392
|
-
}
|
|
393
|
-
_render() {
|
|
394
|
-
if (!this._model || !this._session) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
const el = React$3.createElement(Root, {
|
|
398
|
-
model: this._model,
|
|
399
|
-
session: this._session,
|
|
400
|
-
onSessionChange: this.sessionChanged.bind(this)
|
|
401
|
-
});
|
|
402
|
-
ReactDOM.render(el, this, () => {
|
|
403
|
-
renderMath(this);
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
export default Likert$2;
|
|
408
|
-
export {isComplete};
|
package/module/index.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>@pie-element/likert@0.0.9</title>
|
|
6
|
-
<link
|
|
7
|
-
href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
|
|
8
|
-
rel="stylesheet"
|
|
9
|
-
/>
|
|
10
|
-
<script
|
|
11
|
-
type="module"
|
|
12
|
-
src="https://unpkg.com/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
|
|
13
|
-
<script type="module" src="./demo.js"></script>
|
|
14
|
-
</head>
|
|
15
|
-
<body></body>
|
|
16
|
-
</html>
|