@pie-element/inline-dropdown 3.8.2 → 3.8.3-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 +149 -0
- package/configure/CHANGELOG.md +125 -0
- package/configure/lib/defaults.js +28 -1
- package/configure/lib/defaults.js.map +1 -1
- package/configure/lib/index.js +3 -3
- package/configure/lib/inline-dropdown-toolbar.js +26 -8
- package/configure/lib/inline-dropdown-toolbar.js.map +1 -1
- package/configure/lib/main.js +175 -18
- package/configure/lib/main.js.map +1 -1
- package/configure/lib/markupUtils.js +9 -2
- package/configure/lib/markupUtils.js.map +1 -1
- package/configure/lib/utils.js +16 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +27 -0
- package/controller/lib/index.js +39 -6
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +100 -0
- package/docs/config-schema.json.md +77 -1
- package/docs/demo/generate.js +21 -10
- package/docs/pie-schema.json +59 -0
- package/docs/pie-schema.json.md +44 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +65 -18
- package/lib/inline-dropdown.js.map +1 -1
- package/package.json +6 -6
- package/module/configure.js +0 -1338
- package/module/controller.js +0 -20998
- package/module/demo.js +0 -93
- package/module/element.js +0 -225
- package/module/index.html +0 -16
- package/module/manifest.json +0 -10
package/module/demo.js
DELETED
|
@@ -1,93 +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
|
-
disabled: false,
|
|
9
|
-
mode: 'gather',
|
|
10
|
-
prompt: 'Use the dropdowns to complete the sentence',
|
|
11
|
-
promptEnabled: true,
|
|
12
|
-
shuffle: true,
|
|
13
|
-
markup: '<div><p>The {{0}} jumped {{1}} the {{2}}</p></div>',
|
|
14
|
-
choices: {
|
|
15
|
-
'0': [
|
|
16
|
-
{
|
|
17
|
-
label: 'cow ',
|
|
18
|
-
value: '0',
|
|
19
|
-
correct: true
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: 'dog ',
|
|
23
|
-
value: '1',
|
|
24
|
-
correct: false
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: 'cat ',
|
|
28
|
-
value: '2',
|
|
29
|
-
correct: false
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
'1': [
|
|
33
|
-
{
|
|
34
|
-
label: 'over ',
|
|
35
|
-
value: '0',
|
|
36
|
-
correct: true
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: 'under ',
|
|
40
|
-
value: '1',
|
|
41
|
-
correct: false
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: 'across ',
|
|
45
|
-
value: '2',
|
|
46
|
-
correct: false
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
'2': [
|
|
50
|
-
{
|
|
51
|
-
label: 'moon ',
|
|
52
|
-
value: '0',
|
|
53
|
-
correct: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
label: 'sun',
|
|
57
|
-
value: '2',
|
|
58
|
-
correct: false
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
label: 'house ',
|
|
62
|
-
value: '3',
|
|
63
|
-
correct: false
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
},
|
|
67
|
-
alternateResponse: {
|
|
68
|
-
'2': ['2']
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
var generate = {
|
|
73
|
-
model: model
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const { model: model$1 } = generate;
|
|
77
|
-
|
|
78
|
-
var config = {
|
|
79
|
-
elements: {
|
|
80
|
-
'inline-dropdown': '../..'
|
|
81
|
-
},
|
|
82
|
-
models: [model$1('1', 'inline-dropdown')]
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
//Note: demo-el is a custom element loaded in the markup.
|
|
86
|
-
customElements.whenDefined('demo-el').then(() => {
|
|
87
|
-
config.models.forEach(m => {
|
|
88
|
-
const de = document.createElement('demo-el');
|
|
89
|
-
document.body.appendChild(de);
|
|
90
|
-
de.def = { tagName: m.element, Element, Configure, controller };
|
|
91
|
-
de.model = m;
|
|
92
|
-
});
|
|
93
|
-
});
|
package/module/element.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import {_dll_material_ui__core_styles, _dll_react, _dll_react_dom, _dll_prop_types, _dll_lodash, _dll_pie_lib__correct_answer_toggle, _dll_pie_lib__mask_markup, _dll_pie_lib__render_ui, _dll_pie_lib__math_rendering, _dll_pie_framework__pie_player_events} from "../../../@pie-ui/shared-lib@^4.3.3/module/index.js";
|
|
2
|
-
const React = _dll_react;
|
|
3
|
-
const ReactDOM = _dll_react_dom;
|
|
4
|
-
const PropTypes = _dll_prop_types;
|
|
5
|
-
const {isEmpty: isEmpty} = _dll_lodash;
|
|
6
|
-
const CorrectAnswerToggle = _dll_pie_lib__correct_answer_toggle;
|
|
7
|
-
const {InlineDropdown: DropDown} = _dll_pie_lib__mask_markup;
|
|
8
|
-
const {color: color} = _dll_pie_lib__render_ui;
|
|
9
|
-
const {Collapsible: Collapsible} = _dll_pie_lib__render_ui;
|
|
10
|
-
const {hasText: hasText} = _dll_pie_lib__render_ui;
|
|
11
|
-
const {renderMath: renderMath} = _dll_pie_lib__math_rendering;
|
|
12
|
-
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
13
|
-
const _jsxFileName = "/home/ede/dev/github/pie-framework/pie-elements/node_modules/@pie-ui/inline-dropdown/src/inline-dropdown.jsx";
|
|
14
|
-
class InlineDropdown extends React.Component {
|
|
15
|
-
constructor(...args) {
|
|
16
|
-
super(...args);
|
|
17
|
-
InlineDropdown.prototype.__init.call(this);
|
|
18
|
-
InlineDropdown.prototype.__init2.call(this);
|
|
19
|
-
}
|
|
20
|
-
static __initStatic() {
|
|
21
|
-
this.propTypes = {
|
|
22
|
-
classes: PropTypes.object,
|
|
23
|
-
prompt: PropTypes.string,
|
|
24
|
-
disabled: PropTypes.bool,
|
|
25
|
-
markup: PropTypes.string,
|
|
26
|
-
mode: PropTypes.string,
|
|
27
|
-
rationale: PropTypes.string,
|
|
28
|
-
teacherInstructions: PropTypes.string,
|
|
29
|
-
choices: PropTypes.object,
|
|
30
|
-
value: PropTypes.object,
|
|
31
|
-
feedback: PropTypes.object,
|
|
32
|
-
onChange: PropTypes.func
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
static __initStatic2() {
|
|
36
|
-
this.defaultProps = {
|
|
37
|
-
value: {}
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
__init() {
|
|
41
|
-
this.state = {
|
|
42
|
-
showCorrectAnswer: false
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
46
|
-
if (isEmpty(nextProps.feedback)) {
|
|
47
|
-
this.setState({
|
|
48
|
-
showCorrectAnswer: false
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
componentDidUpdate() {
|
|
53
|
-
const domNode = ReactDOM.findDOMNode(this);
|
|
54
|
-
renderMath(domNode);
|
|
55
|
-
}
|
|
56
|
-
__init2() {
|
|
57
|
-
this.toggleShowCorrect = () => {
|
|
58
|
-
this.setState({
|
|
59
|
-
showCorrectAnswer: !this.state.showCorrectAnswer
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
render() {
|
|
64
|
-
const {showCorrectAnswer} = this.state;
|
|
65
|
-
const {classes, prompt, mode, rationale, teacherInstructions} = this.props;
|
|
66
|
-
return React.createElement('div', {
|
|
67
|
-
className: classes.mainContainer,
|
|
68
|
-
__self: this,
|
|
69
|
-
__source: {
|
|
70
|
-
fileName: _jsxFileName,
|
|
71
|
-
lineNumber: 56
|
|
72
|
-
}
|
|
73
|
-
}, teacherInstructions && hasText(teacherInstructions) && React.createElement(Collapsible, {
|
|
74
|
-
labels: {
|
|
75
|
-
hidden: 'Show Teacher Instructions',
|
|
76
|
-
visible: 'Hide Teacher Instructions'
|
|
77
|
-
},
|
|
78
|
-
__self: this,
|
|
79
|
-
__source: {
|
|
80
|
-
fileName: _jsxFileName,
|
|
81
|
-
lineNumber: 59
|
|
82
|
-
}
|
|
83
|
-
}, React.createElement('div', {
|
|
84
|
-
dangerouslySetInnerHTML: {
|
|
85
|
-
__html: teacherInstructions
|
|
86
|
-
},
|
|
87
|
-
__self: this,
|
|
88
|
-
__source: {
|
|
89
|
-
fileName: _jsxFileName,
|
|
90
|
-
lineNumber: 62
|
|
91
|
-
}
|
|
92
|
-
})), React.createElement(CorrectAnswerToggle, {
|
|
93
|
-
show: mode === 'evaluate',
|
|
94
|
-
toggled: showCorrectAnswer,
|
|
95
|
-
onToggle: this.toggleShowCorrect,
|
|
96
|
-
__self: this,
|
|
97
|
-
__source: {
|
|
98
|
-
fileName: _jsxFileName,
|
|
99
|
-
lineNumber: 67
|
|
100
|
-
}
|
|
101
|
-
}), React.createElement('br', {
|
|
102
|
-
__self: this,
|
|
103
|
-
__source: {
|
|
104
|
-
fileName: _jsxFileName,
|
|
105
|
-
lineNumber: 72
|
|
106
|
-
}
|
|
107
|
-
}), prompt && React.createElement('div', {
|
|
108
|
-
dangerouslySetInnerHTML: {
|
|
109
|
-
__html: prompt
|
|
110
|
-
},
|
|
111
|
-
__self: this,
|
|
112
|
-
__source: {
|
|
113
|
-
fileName: _jsxFileName,
|
|
114
|
-
lineNumber: 73
|
|
115
|
-
}
|
|
116
|
-
}), React.createElement('br', {
|
|
117
|
-
__self: this,
|
|
118
|
-
__source: {
|
|
119
|
-
fileName: _jsxFileName,
|
|
120
|
-
lineNumber: 74
|
|
121
|
-
}
|
|
122
|
-
}), rationale && hasText(rationale) && React.createElement(Collapsible, {
|
|
123
|
-
labels: {
|
|
124
|
-
hidden: 'Show Rationale',
|
|
125
|
-
visible: 'Hide Rationale'
|
|
126
|
-
},
|
|
127
|
-
__self: this,
|
|
128
|
-
__source: {
|
|
129
|
-
fileName: _jsxFileName,
|
|
130
|
-
lineNumber: 77
|
|
131
|
-
}
|
|
132
|
-
}, React.createElement('div', {
|
|
133
|
-
dangerouslySetInnerHTML: {
|
|
134
|
-
__html: rationale
|
|
135
|
-
},
|
|
136
|
-
__self: this,
|
|
137
|
-
__source: {
|
|
138
|
-
fileName: _jsxFileName,
|
|
139
|
-
lineNumber: 80
|
|
140
|
-
}
|
|
141
|
-
})), React.createElement(DropDown, {
|
|
142
|
-
...this.props,
|
|
143
|
-
showCorrectAnswer: showCorrectAnswer,
|
|
144
|
-
__self: this,
|
|
145
|
-
__source: {
|
|
146
|
-
fileName: _jsxFileName,
|
|
147
|
-
lineNumber: 84
|
|
148
|
-
}
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
InlineDropdown.__initStatic();
|
|
153
|
-
InlineDropdown.__initStatic2();
|
|
154
|
-
const styles = theme => ({
|
|
155
|
-
mainContainer: {
|
|
156
|
-
color: color.text(),
|
|
157
|
-
backgroundColor: color.background(),
|
|
158
|
-
padding: theme.spacing.unit
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
var InlineDropdown$1 = withStyles(styles)(InlineDropdown);
|
|
162
|
-
const React$1 = _dll_react;
|
|
163
|
-
const ReactDOM$1 = _dll_react_dom;
|
|
164
|
-
const {ModelSetEvent: ModelSetEvent} = _dll_pie_framework__pie_player_events;
|
|
165
|
-
const {SessionChangedEvent: SessionChangedEvent} = _dll_pie_framework__pie_player_events;
|
|
166
|
-
const {renderMath: renderMath$1} = _dll_pie_lib__math_rendering;
|
|
167
|
-
class RootInlineDropdown extends HTMLElement {
|
|
168
|
-
constructor() {
|
|
169
|
-
super();
|
|
170
|
-
RootInlineDropdown.prototype.__init.call(this);
|
|
171
|
-
RootInlineDropdown.prototype.__init2.call(this);
|
|
172
|
-
RootInlineDropdown.prototype.__init3.call(this);
|
|
173
|
-
this._model = null;
|
|
174
|
-
this._session = null;
|
|
175
|
-
}
|
|
176
|
-
set model(m) {
|
|
177
|
-
this._model = m;
|
|
178
|
-
this.dispatchEvent(new ModelSetEvent(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model));
|
|
179
|
-
this._render();
|
|
180
|
-
}
|
|
181
|
-
set session(s) {
|
|
182
|
-
this._session = s;
|
|
183
|
-
this._render();
|
|
184
|
-
}
|
|
185
|
-
get session() {
|
|
186
|
-
return this._session;
|
|
187
|
-
}
|
|
188
|
-
__init() {
|
|
189
|
-
this._render = () => {
|
|
190
|
-
if (this._model && this._session) {
|
|
191
|
-
let elem = React$1.createElement(InlineDropdown$1, {
|
|
192
|
-
prompt: this._model.prompt,
|
|
193
|
-
rationale: this._model.rationale,
|
|
194
|
-
teacherInstructions: this._model.teacherInstructions,
|
|
195
|
-
disabled: this._model.disabled,
|
|
196
|
-
markup: this._model.markup,
|
|
197
|
-
mode: this._model.mode,
|
|
198
|
-
choices: this._model.choices,
|
|
199
|
-
value: this._session.value,
|
|
200
|
-
feedback: this._model.feedback,
|
|
201
|
-
onChange: this.changeSession
|
|
202
|
-
});
|
|
203
|
-
ReactDOM$1.render(elem, this, () => {
|
|
204
|
-
renderMath$1(this);
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
__init2() {
|
|
210
|
-
this.dispatchChangedEvent = () => {
|
|
211
|
-
this.dispatchEvent(new SessionChangedEvent(this.tagName.toLowerCase(), this.session && !!this.session.value));
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
__init3() {
|
|
215
|
-
this.changeSession = value => {
|
|
216
|
-
this.session.value = value;
|
|
217
|
-
this.dispatchChangedEvent();
|
|
218
|
-
this._render();
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
connectedCallback() {
|
|
222
|
-
this._render();
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export default RootInlineDropdown;
|
package/module/index.html
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<!doctype html>
|
|
3
|
-
<html>
|
|
4
|
-
<head>
|
|
5
|
-
<title>@pie-element/inline-dropdown@3.5.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>
|