@pie-element/ebsr 7.0.13 → 7.0.17
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 +32 -0
- package/configure/CHANGELOG.md +32 -0
- package/configure/package.json +3 -3
- package/lib/print.js +245 -0
- package/lib/print.js.map +1 -0
- package/module/configure.js +464 -0
- package/module/controller.js +20756 -0
- package/module/demo.js +77 -0
- package/module/element.js +2146 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +115 -0
- package/module/print.html +18 -0
- package/module/print.js +2175 -0
- package/package.json +8 -4
- package/src/print.js +183 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_material_ui__core_styles, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/shared-module@^1.4.1/module/index.js";
|
|
2
|
+
import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
|
|
3
|
+
import {_dll_pie_lib__config_ui} from "../../../@pie-lib/config-module@^1.0.24/module/index.js";
|
|
4
|
+
var lib = {};
|
|
5
|
+
Object.defineProperty(lib, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
class ModelUpdatedEvent extends CustomEvent {
|
|
9
|
+
constructor(update, reset = false) {
|
|
10
|
+
super(ModelUpdatedEvent.TYPE, {
|
|
11
|
+
bubbles: true,
|
|
12
|
+
detail: {
|
|
13
|
+
update,
|
|
14
|
+
reset
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
this.update = update;
|
|
18
|
+
this.reset = reset;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
ModelUpdatedEvent.TYPE = 'model.updated';
|
|
22
|
+
var ModelUpdatedEvent_1 = lib.ModelUpdatedEvent = ModelUpdatedEvent;
|
|
23
|
+
class DeleteImageEvent extends CustomEvent {
|
|
24
|
+
constructor(src, done) {
|
|
25
|
+
super(DeleteImageEvent.TYPE, {
|
|
26
|
+
bubbles: true,
|
|
27
|
+
detail: {
|
|
28
|
+
src,
|
|
29
|
+
done
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
this.src = src;
|
|
33
|
+
this.done = done;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
DeleteImageEvent.TYPE = 'delete.image';
|
|
37
|
+
lib.DeleteImageEvent = DeleteImageEvent;
|
|
38
|
+
class InsertImageEvent extends CustomEvent {
|
|
39
|
+
constructor(handler) {
|
|
40
|
+
super(InsertImageEvent.TYPE, {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
detail: handler
|
|
43
|
+
});
|
|
44
|
+
this.handler = handler;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
InsertImageEvent.TYPE = 'insert.image';
|
|
48
|
+
lib.InsertImageEvent = InsertImageEvent;
|
|
49
|
+
const React$1 = _dll_react;
|
|
50
|
+
const PropTypes = _dll_prop_types;
|
|
51
|
+
const {withStyles: withStyles} = _dll_material_ui__core_styles;
|
|
52
|
+
const {cloneDeep: cloneDeep$1} = _dll_lodash;
|
|
53
|
+
const {settings: settings} = _dll_pie_lib__config_ui;
|
|
54
|
+
const {layout: layout} = _dll_pie_lib__config_ui;
|
|
55
|
+
const _jsxFileName = "/home/circleci/repo/packages/ebsr/configure/src/main.jsx";
|
|
56
|
+
const {Panel, toggle, radio, dropdown} = settings;
|
|
57
|
+
const styles = theme => ({
|
|
58
|
+
design: {
|
|
59
|
+
paddingTop: theme.spacing.unit * 3
|
|
60
|
+
},
|
|
61
|
+
part: {
|
|
62
|
+
display: 'flex',
|
|
63
|
+
flexDirection: 'column',
|
|
64
|
+
padding: '16px 0 32px'
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
class Main extends React$1.Component {
|
|
68
|
+
constructor(...args) {
|
|
69
|
+
super(...args);
|
|
70
|
+
Main.prototype.__init.call(this);
|
|
71
|
+
Main.prototype.__init2.call(this);
|
|
72
|
+
}
|
|
73
|
+
static __initStatic() {
|
|
74
|
+
this.propTypes = {
|
|
75
|
+
classes: PropTypes.object,
|
|
76
|
+
configuration: PropTypes.object,
|
|
77
|
+
model: PropTypes.object,
|
|
78
|
+
onModelChanged: PropTypes.func,
|
|
79
|
+
onConfigurationChanged: PropTypes.func
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
__init() {
|
|
83
|
+
this.removeExtraChoices = choices => {
|
|
84
|
+
let correctFound = false;
|
|
85
|
+
return (choices || []).map(choice => {
|
|
86
|
+
if (correctFound) {
|
|
87
|
+
choice.correct = false;
|
|
88
|
+
return choice;
|
|
89
|
+
}
|
|
90
|
+
if (choice.correct) {
|
|
91
|
+
correctFound = true;
|
|
92
|
+
}
|
|
93
|
+
return choice;
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
__init2() {
|
|
98
|
+
this.onModelChanged = (model, key) => {
|
|
99
|
+
const {onModelChanged} = this.props;
|
|
100
|
+
if (key === 'partA.choiceMode' && model.partA.choiceMode === 'radio') {
|
|
101
|
+
model.partA.choices = this.removeExtraChoices(model.partA.choices);
|
|
102
|
+
return onModelChanged(model, true);
|
|
103
|
+
}
|
|
104
|
+
if (key === 'partB.choiceMode' && model.partB.choiceMode === 'radio') {
|
|
105
|
+
model.partB.choices = this.removeExtraChoices(model.partB.choices);
|
|
106
|
+
return onModelChanged(model, true);
|
|
107
|
+
}
|
|
108
|
+
return onModelChanged(model);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
render() {
|
|
112
|
+
const {classes, model, configuration, onConfigurationChanged} = this.props;
|
|
113
|
+
const {partLabelType, partA: modelPartA, partB: modelPartB} = model;
|
|
114
|
+
const {partA, partB, partialScoring, scoringType, ...generalConfiguration} = configuration;
|
|
115
|
+
const {feedback: feedbackA = {}, choiceMode: choiceModeA = {}, choicePrefix: choicePrefixA = {}, lockChoiceOrder: lockChoiceOrderA = {}, prompt: promptA = {}, teacherInstructions: teacherInstructionsA = {}, studentInstructions: studentInstructionsA = {}, choicesLayout: choicesLayoutA = {}, gridColumns: gridColumnsA = {}, rationale: rationaleA = {}} = partA || ({});
|
|
116
|
+
const {feedback: feedbackB = {}, choiceMode: choiceModeB = {}, choicePrefix: choicePrefixB = {}, lockChoiceOrder: lockChoiceOrderB = {}, prompt: promptB = {}, teacherInstructions: teacherInstructionsB = {}, studentInstructions: studentInstructionsB = {}, choicesLayout: choicesLayoutB = {}, gridColumns: gridColumnsB = {}, rationale: rationaleB = {}} = partB || ({});
|
|
117
|
+
const type = partLabelType || 'Numbers';
|
|
118
|
+
const typeIsNumber = type === 'Numbers';
|
|
119
|
+
const firstPart = `Part ${typeIsNumber ? '1' : 'A'}`;
|
|
120
|
+
const secondPart = `Part ${typeIsNumber ? '2' : 'B'}`;
|
|
121
|
+
const nrOfColumnsAvailable = {
|
|
122
|
+
partA: modelPartA.choices && modelPartA.choices.length ? Array.from({
|
|
123
|
+
length: modelPartA.choices.length
|
|
124
|
+
}, (_, i) => `${i + 1}`) : [],
|
|
125
|
+
partB: modelPartB.choices && modelPartB.choices.length ? Array.from({
|
|
126
|
+
length: modelPartB.choices.length
|
|
127
|
+
}, (_, i) => `${i + 1}`) : []
|
|
128
|
+
};
|
|
129
|
+
return React$1.createElement('div', {
|
|
130
|
+
className: classes.design,
|
|
131
|
+
__self: this,
|
|
132
|
+
__source: {
|
|
133
|
+
fileName: _jsxFileName,
|
|
134
|
+
lineNumber: 109
|
|
135
|
+
}
|
|
136
|
+
}, React$1.createElement(layout.ConfigLayout, {
|
|
137
|
+
settings: React$1.createElement(Panel, {
|
|
138
|
+
model: model,
|
|
139
|
+
onChangeModel: this.onModelChanged,
|
|
140
|
+
configuration: configuration,
|
|
141
|
+
onChangeConfiguration: onConfigurationChanged,
|
|
142
|
+
groups: {
|
|
143
|
+
'Settings for both': {
|
|
144
|
+
partLabels: generalConfiguration.partLabels.settings && toggle(generalConfiguration.partLabels.label),
|
|
145
|
+
partLabelType: model.partLabels && dropdown('', ['Numbers', 'Letters']),
|
|
146
|
+
partialScoring: partialScoring.settings && toggle(partialScoring.label),
|
|
147
|
+
scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric'])
|
|
148
|
+
},
|
|
149
|
+
[`Settings ${firstPart}`]: {
|
|
150
|
+
'partA.choiceMode': choiceModeA.settings && radio(choiceModeA.label, ['checkbox', 'radio']),
|
|
151
|
+
'partA.choicePrefix': choicePrefixA.settings && radio(choicePrefixA.label, ['numbers', 'letters']),
|
|
152
|
+
'partA.lockChoiceOrder': lockChoiceOrderA.settings && toggle(lockChoiceOrderA.label),
|
|
153
|
+
'partA.choicesLayout': choicesLayoutA.settings && dropdown(choicesLayoutA.label, ['vertical', 'grid', 'horizontal']),
|
|
154
|
+
'partA.gridColumns': choicesLayoutA.settings && modelPartA.choicesLayout === 'grid' && nrOfColumnsAvailable.partA.length > 0 && dropdown(gridColumnsA.label, nrOfColumnsAvailable.partA)
|
|
155
|
+
},
|
|
156
|
+
[`Properties ${firstPart}`]: {
|
|
157
|
+
'partA.feedbackEnabled': feedbackA.settings && toggle(feedbackA.label),
|
|
158
|
+
'partA.promptEnabled': promptA.settings && toggle(promptA.label),
|
|
159
|
+
'partA.teacherInstructionsEnabled': teacherInstructionsA.settings && toggle(teacherInstructionsA.label),
|
|
160
|
+
'partA.studentInstructionsEnabled': studentInstructionsA.settings && toggle(studentInstructionsA.label),
|
|
161
|
+
'partA.rationaleEnabled': rationaleA.settings && toggle(rationaleA.label)
|
|
162
|
+
},
|
|
163
|
+
[`Settings ${secondPart}`]: {
|
|
164
|
+
'partB.choiceMode': choiceModeB.settings && radio(choiceModeB.label, ['checkbox', 'radio']),
|
|
165
|
+
'partB.choicePrefix': choicePrefixB.settings && radio(choicePrefixB.label, ['numbers', 'letters']),
|
|
166
|
+
'partB.lockChoiceOrder': lockChoiceOrderB.settings && toggle(lockChoiceOrderB.label),
|
|
167
|
+
'partB.choicesLayout': choicesLayoutB.settings && dropdown(choicesLayoutB.label, ['vertical', 'grid', 'horizontal']),
|
|
168
|
+
'partB.gridColumns': choicesLayoutB.settings && modelPartB.choicesLayout === 'grid' && nrOfColumnsAvailable.partB.length > 0 && dropdown(gridColumnsB.label, nrOfColumnsAvailable.partB)
|
|
169
|
+
},
|
|
170
|
+
[`Properties ${secondPart}`]: {
|
|
171
|
+
'partB.feedbackEnabled': feedbackB.settings && toggle(feedbackB.label),
|
|
172
|
+
'partB.promptEnabled': promptB.settings && toggle(promptB.label),
|
|
173
|
+
'partB.teacherInstructionsEnabled': teacherInstructionsB.settings && toggle(teacherInstructionsB.label),
|
|
174
|
+
'partB.studentInstructionsEnabled': studentInstructionsB.settings && toggle(studentInstructionsB.label),
|
|
175
|
+
'partB.rationaleEnabled': rationaleB.settings && toggle(rationaleB.label)
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
__self: this,
|
|
179
|
+
__source: {
|
|
180
|
+
fileName: _jsxFileName,
|
|
181
|
+
lineNumber: 112
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
__self: this,
|
|
185
|
+
__source: {
|
|
186
|
+
fileName: _jsxFileName,
|
|
187
|
+
lineNumber: 110
|
|
188
|
+
}
|
|
189
|
+
}, React$1.createElement('div', {
|
|
190
|
+
__self: this,
|
|
191
|
+
__source: {
|
|
192
|
+
fileName: _jsxFileName,
|
|
193
|
+
lineNumber: 195
|
|
194
|
+
}
|
|
195
|
+
}, React$1.createElement('div', {
|
|
196
|
+
className: classes.part,
|
|
197
|
+
__self: this,
|
|
198
|
+
__source: {
|
|
199
|
+
fileName: _jsxFileName,
|
|
200
|
+
lineNumber: 196
|
|
201
|
+
}
|
|
202
|
+
}, model.partLabels && React$1.createElement('p', {
|
|
203
|
+
__self: this,
|
|
204
|
+
__source: {
|
|
205
|
+
fileName: _jsxFileName,
|
|
206
|
+
lineNumber: 197
|
|
207
|
+
}
|
|
208
|
+
}, firstPart), React$1.createElement('ebsr-multiple-choice-configure', {
|
|
209
|
+
id: "A",
|
|
210
|
+
key: "partA",
|
|
211
|
+
ref: ref => {
|
|
212
|
+
if (ref) {
|
|
213
|
+
this.partA = ref;
|
|
214
|
+
this.partA._model = cloneDeep$1(this.props.model.partA);
|
|
215
|
+
this.partA.configuration = {
|
|
216
|
+
...partA,
|
|
217
|
+
...generalConfiguration
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
__self: this,
|
|
222
|
+
__source: {
|
|
223
|
+
fileName: _jsxFileName,
|
|
224
|
+
lineNumber: 198
|
|
225
|
+
}
|
|
226
|
+
})), React$1.createElement('div', {
|
|
227
|
+
className: classes.part,
|
|
228
|
+
__self: this,
|
|
229
|
+
__source: {
|
|
230
|
+
fileName: _jsxFileName,
|
|
231
|
+
lineNumber: 215
|
|
232
|
+
}
|
|
233
|
+
}, model.partLabels && React$1.createElement('p', {
|
|
234
|
+
__self: this,
|
|
235
|
+
__source: {
|
|
236
|
+
fileName: _jsxFileName,
|
|
237
|
+
lineNumber: 216
|
|
238
|
+
}
|
|
239
|
+
}, secondPart), React$1.createElement('ebsr-multiple-choice-configure', {
|
|
240
|
+
id: "B",
|
|
241
|
+
key: "partB",
|
|
242
|
+
ref: ref => {
|
|
243
|
+
if (ref) {
|
|
244
|
+
this.partB = ref;
|
|
245
|
+
this.partB._model = cloneDeep$1(this.props.model.partB);
|
|
246
|
+
this.partB.configuration = {
|
|
247
|
+
...partB,
|
|
248
|
+
...generalConfiguration
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
__self: this,
|
|
253
|
+
__source: {
|
|
254
|
+
fileName: _jsxFileName,
|
|
255
|
+
lineNumber: 217
|
|
256
|
+
}
|
|
257
|
+
})))));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
Main.__initStatic();
|
|
261
|
+
const Styled = withStyles(styles)(Main);
|
|
262
|
+
const {cloneDeep: cloneDeep} = _dll_lodash;
|
|
263
|
+
const defaultConfig = {
|
|
264
|
+
addChoiceButton: {
|
|
265
|
+
settings: true,
|
|
266
|
+
label: 'Add a Choice'
|
|
267
|
+
},
|
|
268
|
+
choiceMode: {
|
|
269
|
+
settings: true,
|
|
270
|
+
label: 'Response Type'
|
|
271
|
+
},
|
|
272
|
+
choicePrefix: {
|
|
273
|
+
settings: true,
|
|
274
|
+
label: 'Choice Labels'
|
|
275
|
+
},
|
|
276
|
+
deleteChoice: {
|
|
277
|
+
settings: true
|
|
278
|
+
},
|
|
279
|
+
feedback: {
|
|
280
|
+
settings: true,
|
|
281
|
+
label: 'Feedback'
|
|
282
|
+
},
|
|
283
|
+
lockChoiceOrder: {
|
|
284
|
+
settings: true,
|
|
285
|
+
label: 'Lock Choice Order'
|
|
286
|
+
},
|
|
287
|
+
prompt: {
|
|
288
|
+
settings: true,
|
|
289
|
+
label: 'Prompt'
|
|
290
|
+
},
|
|
291
|
+
rationale: {
|
|
292
|
+
settings: true,
|
|
293
|
+
label: 'Rationale'
|
|
294
|
+
},
|
|
295
|
+
studentInstructions: {
|
|
296
|
+
settings: false,
|
|
297
|
+
label: 'Student Instructions'
|
|
298
|
+
},
|
|
299
|
+
teacherInstructions: {
|
|
300
|
+
settings: true,
|
|
301
|
+
label: 'Teacher Instructions'
|
|
302
|
+
},
|
|
303
|
+
choicesLayout: {
|
|
304
|
+
settings: false,
|
|
305
|
+
label: 'Choices Layout'
|
|
306
|
+
},
|
|
307
|
+
gridColumns: {
|
|
308
|
+
label: 'Grid columns'
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
const partModel = base => ({
|
|
312
|
+
choiceMode: 'radio',
|
|
313
|
+
choices: [],
|
|
314
|
+
choicePrefix: 'numbers',
|
|
315
|
+
prompt: 'Prompt',
|
|
316
|
+
rationaleEnabled: true,
|
|
317
|
+
feedbackEnabled: true,
|
|
318
|
+
promptEnabled: true,
|
|
319
|
+
teacherInstructions: '',
|
|
320
|
+
rationale: '',
|
|
321
|
+
teacherInstructionsEnabled: true,
|
|
322
|
+
studentInstructionsEnabled: true,
|
|
323
|
+
choicesLayout: 'vertical',
|
|
324
|
+
gridColumns: '2',
|
|
325
|
+
...base
|
|
326
|
+
});
|
|
327
|
+
var sensibleDefaults = {
|
|
328
|
+
model: {
|
|
329
|
+
partLabels: true,
|
|
330
|
+
partLabelType: 'Letters',
|
|
331
|
+
partialScoring: false,
|
|
332
|
+
partA: partModel({
|
|
333
|
+
prompt: 'Prompt A'
|
|
334
|
+
}),
|
|
335
|
+
partB: partModel({
|
|
336
|
+
prompt: 'Prompt B'
|
|
337
|
+
})
|
|
338
|
+
},
|
|
339
|
+
configuration: {
|
|
340
|
+
partialScoring: {
|
|
341
|
+
label: 'Allow Partial Scoring',
|
|
342
|
+
settings: false
|
|
343
|
+
},
|
|
344
|
+
scoringType: {
|
|
345
|
+
settings: false,
|
|
346
|
+
label: 'Scoring Type'
|
|
347
|
+
},
|
|
348
|
+
partA: cloneDeep(defaultConfig),
|
|
349
|
+
partB: cloneDeep(defaultConfig),
|
|
350
|
+
partLabels: {
|
|
351
|
+
settings: true,
|
|
352
|
+
label: 'Part Labels'
|
|
353
|
+
},
|
|
354
|
+
settingsPanelDisabled: true
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
const React = _dll_react;
|
|
358
|
+
const ReactDOM = _dll_react_dom;
|
|
359
|
+
const {defaults: defaults} = _dll_lodash;
|
|
360
|
+
const MODEL_UPDATED = ModelUpdatedEvent_1.TYPE;
|
|
361
|
+
const MC_TAG_NAME = 'ebsr-multiple-choice-configure';
|
|
362
|
+
class EbsrMCConfigure extends MultipleChoiceConfigure {}
|
|
363
|
+
const defineMultipleChoice = () => {
|
|
364
|
+
if (!customElements.get(MC_TAG_NAME)) {
|
|
365
|
+
customElements.define(MC_TAG_NAME, EbsrMCConfigure);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
defineMultipleChoice();
|
|
369
|
+
const prepareCustomizationObject = (config, model) => {
|
|
370
|
+
const configuration = defaults(config, sensibleDefaults.configuration);
|
|
371
|
+
configuration.settingsPanelDisabled = true;
|
|
372
|
+
return {
|
|
373
|
+
configuration,
|
|
374
|
+
model
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
const {model: modelDefault} = sensibleDefaults || ({});
|
|
378
|
+
class EbsrConfigure extends HTMLElement {
|
|
379
|
+
static __initStatic() {
|
|
380
|
+
this.createDefaultModel = ({partA = {}, partB = {}, ...model} = {}, defaults = modelDefault) => ({
|
|
381
|
+
...defaults,
|
|
382
|
+
...model,
|
|
383
|
+
partA: {
|
|
384
|
+
...defaults.partA,
|
|
385
|
+
...partA,
|
|
386
|
+
choicesLayout: partA.choicesLayout || partA.verticalMode === false && 'horizontal' || defaults.partA.choicesLayout
|
|
387
|
+
},
|
|
388
|
+
partB: {
|
|
389
|
+
...defaults.partB,
|
|
390
|
+
...partB,
|
|
391
|
+
choicesLayout: partB.choicesLayout || partB.verticalMode === false && 'horizontal' || defaults.partB.choicesLayout
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
constructor() {
|
|
396
|
+
super();
|
|
397
|
+
EbsrConfigure.prototype.__init.call(this);
|
|
398
|
+
EbsrConfigure.prototype.__init2.call(this);
|
|
399
|
+
this._model = EbsrConfigure.createDefaultModel();
|
|
400
|
+
this._configuration = sensibleDefaults.configuration;
|
|
401
|
+
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
402
|
+
}
|
|
403
|
+
set model(m) {
|
|
404
|
+
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
405
|
+
this._render();
|
|
406
|
+
}
|
|
407
|
+
dispatchModelUpdated(reset) {
|
|
408
|
+
const resetValue = !!reset;
|
|
409
|
+
this.dispatchEvent(new ModelUpdatedEvent_1(this._model, resetValue));
|
|
410
|
+
}
|
|
411
|
+
__init() {
|
|
412
|
+
this.onModelChanged = (m, reset) => {
|
|
413
|
+
this._model = EbsrConfigure.createDefaultModel(m, this._model);
|
|
414
|
+
this.dispatchModelUpdated(reset);
|
|
415
|
+
this._render();
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
set configuration(c) {
|
|
419
|
+
const info = prepareCustomizationObject(c, this._model);
|
|
420
|
+
this._configuration = info.configuration;
|
|
421
|
+
this._render();
|
|
422
|
+
}
|
|
423
|
+
onConfigurationChanged(c) {
|
|
424
|
+
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
425
|
+
if (this._model) {
|
|
426
|
+
this.onModelChanged(this._model);
|
|
427
|
+
}
|
|
428
|
+
this._render();
|
|
429
|
+
}
|
|
430
|
+
__init2() {
|
|
431
|
+
this.onModelUpdated = e => {
|
|
432
|
+
if (e.target === this) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
e.preventDefault();
|
|
436
|
+
e.stopImmediatePropagation();
|
|
437
|
+
const id = e.target && e.target.getAttribute('id');
|
|
438
|
+
if (id) {
|
|
439
|
+
if (e.update) {
|
|
440
|
+
this._model[`part${id}`] = e.update;
|
|
441
|
+
}
|
|
442
|
+
this.dispatchEvent(new ModelUpdatedEvent_1(this._model));
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
connectedCallback() {
|
|
447
|
+
this.addEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
448
|
+
this._render();
|
|
449
|
+
}
|
|
450
|
+
disconnectedCallback() {
|
|
451
|
+
this.removeEventListener(MODEL_UPDATED, this.onModelUpdated);
|
|
452
|
+
}
|
|
453
|
+
_render() {
|
|
454
|
+
let element = React.createElement(Styled, {
|
|
455
|
+
model: this._model,
|
|
456
|
+
configuration: this._configuration,
|
|
457
|
+
onModelChanged: this.onModelChanged,
|
|
458
|
+
onConfigurationChanged: this.onConfigurationChanged
|
|
459
|
+
});
|
|
460
|
+
ReactDOM.render(element, this);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
EbsrConfigure.__initStatic();
|
|
464
|
+
export {EbsrConfigure as default};
|