@pie-element/passage 2.3.2-next.9 → 2.4.0
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 +15 -0
- package/controller/CHANGELOG.md +13 -0
- package/controller/lib/index.js +19 -11
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/demo/generate.js +1 -0
- package/lib/index.js +7 -2
- package/lib/index.js.map +1 -1
- package/lib/print.js +13 -4
- package/lib/print.js.map +1 -1
- package/lib/stimulus-tabs.js +40 -7
- package/lib/stimulus-tabs.js.map +1 -1
- package/module/controller.js +2797 -5
- package/module/demo.js +1 -0
- package/module/element.js +68 -27
- package/module/manifest.json +5 -1
- package/module/print-demo.js +1 -0
- package/module/print.js +81 -34
- package/package.json +3 -3
package/module/demo.js
CHANGED
|
@@ -8,6 +8,7 @@ generate.model = (id, element) => ({
|
|
|
8
8
|
element,
|
|
9
9
|
passages: [
|
|
10
10
|
{
|
|
11
|
+
teacherInstructions: 'Teacher instructions tab 1',
|
|
11
12
|
title: 'Hope Is the Thing with Feathers',
|
|
12
13
|
text: '<p><font style="visibility:hidden">00000</font>Hope is the thing with feathers<br /><font style="visibility:hidden">00000</font>That perches in the soul,<br /><font style="visibility:hidden">00000</font>And sings the tune without the words,<br /><font style="visibility:hidden">00000</font>And never stops at all,</p><p>5<font style="visibility:hidden">0000</font>And sweetest in the gale is heard;<br /><font style="visibility:hidden">00000</font>And sore must be the storm<br /><font style="visibility:hidden">00000</font>That could abash the little bird<br /><font style="visibility:hidden">00000</font>That kept so many warm.</p><p><font style="visibility:hidden">00000</font>I’ve heard it in the chillest land,<br />10<font style="visibility:hidden">000</font>And on the strangest sea;<br /><font style="visibility:hidden">00000</font>Yet, never, in extremity,<br /><font style="visibility:hidden">00000</font>It asked a crumb of me.</p><p><span class="no-number">"Hope is the Thing With Feathers" by Emily Dickinson, from <em>The Complete Poems of Emily Dickinson</em>. In the public domain.</span></p>',
|
|
13
14
|
},
|
package/module/element.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.1.0/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.0/module/index.js";
|
|
2
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3
4
|
function getDefaultExportFromCjs(x) {
|
|
4
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -8576,9 +8577,11 @@ withTheme.default = _default;
|
|
|
8576
8577
|
getDefaultExportFromCjs(styles$1);
|
|
8577
8578
|
const React$1 = _dll_react;
|
|
8578
8579
|
const PropTypes = _dll_prop_types;
|
|
8580
|
+
const classNames = _dll_classnames;
|
|
8581
|
+
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8579
8582
|
const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8583
|
+
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8580
8584
|
const {Purpose: Purpose} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8581
|
-
const classNames = _dll_classnames;
|
|
8582
8585
|
const _jsxFileName = "/home/circleci/repo/packages/passage/src/stimulus-tabs.jsx";
|
|
8583
8586
|
const styles = theme => ({
|
|
8584
8587
|
root: {
|
|
@@ -8612,6 +8615,9 @@ const styles = theme => ({
|
|
|
8612
8615
|
},
|
|
8613
8616
|
breakSpaces: {
|
|
8614
8617
|
whiteSpace: 'break-spaces'
|
|
8618
|
+
},
|
|
8619
|
+
teacherInstructions: {
|
|
8620
|
+
marginBottom: theme.spacing.unit * 2
|
|
8615
8621
|
}
|
|
8616
8622
|
});
|
|
8617
8623
|
class StimulusTabs extends React$1.Component {
|
|
@@ -8689,8 +8695,38 @@ class StimulusTabs extends React$1.Component {
|
|
|
8689
8695
|
return div.innerHTML;
|
|
8690
8696
|
};
|
|
8691
8697
|
}
|
|
8698
|
+
renderInstructions(showTeacherInstructions, teacherInstructions, disabledTabs = false) {
|
|
8699
|
+
if (!showTeacherInstructions || !teacherInstructions) {
|
|
8700
|
+
return;
|
|
8701
|
+
}
|
|
8702
|
+
const teacherInstructionsDiv = React$1.createElement(PreviewPrompt, {
|
|
8703
|
+
tagName: "div",
|
|
8704
|
+
className: "prompt",
|
|
8705
|
+
defaultClassName: "teacher-instructions",
|
|
8706
|
+
prompt: teacherInstructions,
|
|
8707
|
+
__self: this,
|
|
8708
|
+
__source: {
|
|
8709
|
+
fileName: _jsxFileName,
|
|
8710
|
+
lineNumber: 126
|
|
8711
|
+
}
|
|
8712
|
+
});
|
|
8713
|
+
if (disabledTabs) {
|
|
8714
|
+
return teacherInstructionsDiv;
|
|
8715
|
+
}
|
|
8716
|
+
return React$1.createElement(Collapsible, {
|
|
8717
|
+
labels: {
|
|
8718
|
+
hidden: 'Show Teacher Instructions',
|
|
8719
|
+
visible: 'Hide Teacher Instructions'
|
|
8720
|
+
},
|
|
8721
|
+
__self: this,
|
|
8722
|
+
__source: {
|
|
8723
|
+
fileName: _jsxFileName,
|
|
8724
|
+
lineNumber: 139
|
|
8725
|
+
}
|
|
8726
|
+
}, teacherInstructionsDiv);
|
|
8727
|
+
}
|
|
8692
8728
|
render() {
|
|
8693
|
-
const {classes, tabs, disabledTabs} = this.props;
|
|
8729
|
+
const {classes, tabs, disabledTabs, showTeacherInstructions} = this.props;
|
|
8694
8730
|
const {activeTab} = this.state;
|
|
8695
8731
|
if (tabs && tabs.length > 1) {
|
|
8696
8732
|
return disabledTabs ? React$1.createElement('div', {
|
|
@@ -8698,7 +8734,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8698
8734
|
__self: this,
|
|
8699
8735
|
__source: {
|
|
8700
8736
|
fileName: _jsxFileName,
|
|
8701
|
-
lineNumber:
|
|
8737
|
+
lineNumber: 156
|
|
8702
8738
|
}
|
|
8703
8739
|
}, tabs.map(tab => React$1.createElement('div', {
|
|
8704
8740
|
key: tab.id,
|
|
@@ -8710,7 +8746,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8710
8746
|
__self: this,
|
|
8711
8747
|
__source: {
|
|
8712
8748
|
fileName: _jsxFileName,
|
|
8713
|
-
lineNumber:
|
|
8749
|
+
lineNumber: 158
|
|
8714
8750
|
}
|
|
8715
8751
|
}, React$1.createElement('div', {
|
|
8716
8752
|
className: classes.tabContainer,
|
|
@@ -8720,7 +8756,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8720
8756
|
__self: this,
|
|
8721
8757
|
__source: {
|
|
8722
8758
|
fileName: _jsxFileName,
|
|
8723
|
-
lineNumber:
|
|
8759
|
+
lineNumber: 166
|
|
8724
8760
|
}
|
|
8725
8761
|
}, React$1.createElement('div', {
|
|
8726
8762
|
className: classNames(classes.title, 'title'),
|
|
@@ -8730,14 +8766,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8730
8766
|
__self: this,
|
|
8731
8767
|
__source: {
|
|
8732
8768
|
fileName: _jsxFileName,
|
|
8733
|
-
lineNumber:
|
|
8769
|
+
lineNumber: 172
|
|
8734
8770
|
}
|
|
8735
|
-
}), React$1.createElement(Purpose, {
|
|
8771
|
+
}), this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement(Purpose, {
|
|
8736
8772
|
purpose: "passage-text",
|
|
8737
8773
|
__self: this,
|
|
8738
8774
|
__source: {
|
|
8739
8775
|
fileName: _jsxFileName,
|
|
8740
|
-
lineNumber:
|
|
8776
|
+
lineNumber: 177
|
|
8741
8777
|
}
|
|
8742
8778
|
}, React$1.createElement('div', {
|
|
8743
8779
|
className: "text",
|
|
@@ -8748,14 +8784,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8748
8784
|
__self: this,
|
|
8749
8785
|
__source: {
|
|
8750
8786
|
fileName: _jsxFileName,
|
|
8751
|
-
lineNumber:
|
|
8787
|
+
lineNumber: 178
|
|
8752
8788
|
}
|
|
8753
8789
|
})))))) : React$1.createElement('div', {
|
|
8754
8790
|
className: classNames(classes.root, 'passages'),
|
|
8755
8791
|
__self: this,
|
|
8756
8792
|
__source: {
|
|
8757
8793
|
fileName: _jsxFileName,
|
|
8758
|
-
lineNumber:
|
|
8794
|
+
lineNumber: 185
|
|
8759
8795
|
}
|
|
8760
8796
|
}, React$1.createElement(Tabs, {
|
|
8761
8797
|
classes: {
|
|
@@ -8767,7 +8803,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8767
8803
|
__self: this,
|
|
8768
8804
|
__source: {
|
|
8769
8805
|
fileName: _jsxFileName,
|
|
8770
|
-
lineNumber:
|
|
8806
|
+
lineNumber: 186
|
|
8771
8807
|
}
|
|
8772
8808
|
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
8773
8809
|
className: classes.tab,
|
|
@@ -8778,7 +8814,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8778
8814
|
__self: this,
|
|
8779
8815
|
__source: {
|
|
8780
8816
|
fileName: _jsxFileName,
|
|
8781
|
-
lineNumber:
|
|
8817
|
+
lineNumber: 200
|
|
8782
8818
|
}
|
|
8783
8819
|
}, React$1.createElement('span', {
|
|
8784
8820
|
dangerouslySetInnerHTML: {
|
|
@@ -8787,7 +8823,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8787
8823
|
__self: this,
|
|
8788
8824
|
__source: {
|
|
8789
8825
|
fileName: _jsxFileName,
|
|
8790
|
-
lineNumber:
|
|
8826
|
+
lineNumber: 201
|
|
8791
8827
|
}
|
|
8792
8828
|
})),
|
|
8793
8829
|
value: tab.id,
|
|
@@ -8799,7 +8835,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8799
8835
|
__self: this,
|
|
8800
8836
|
__source: {
|
|
8801
8837
|
fileName: _jsxFileName,
|
|
8802
|
-
lineNumber:
|
|
8838
|
+
lineNumber: 195
|
|
8803
8839
|
}
|
|
8804
8840
|
}))), tabs.map(tab => activeTab === tab.id ? React$1.createElement('div', {
|
|
8805
8841
|
className: classes.tabContainer,
|
|
@@ -8810,14 +8846,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8810
8846
|
__self: this,
|
|
8811
8847
|
__source: {
|
|
8812
8848
|
fileName: _jsxFileName,
|
|
8813
|
-
lineNumber:
|
|
8849
|
+
lineNumber: 216
|
|
8814
8850
|
}
|
|
8815
|
-
}, React$1.createElement(Purpose, {
|
|
8851
|
+
}, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions), React$1.createElement(Purpose, {
|
|
8816
8852
|
purpose: "passage-text",
|
|
8817
8853
|
__self: this,
|
|
8818
8854
|
__source: {
|
|
8819
8855
|
fileName: _jsxFileName,
|
|
8820
|
-
lineNumber:
|
|
8856
|
+
lineNumber: 225
|
|
8821
8857
|
}
|
|
8822
8858
|
}, React$1.createElement('div', {
|
|
8823
8859
|
key: tab.id,
|
|
@@ -8827,16 +8863,16 @@ class StimulusTabs extends React$1.Component {
|
|
|
8827
8863
|
__self: this,
|
|
8828
8864
|
__source: {
|
|
8829
8865
|
fileName: _jsxFileName,
|
|
8830
|
-
lineNumber:
|
|
8866
|
+
lineNumber: 226
|
|
8831
8867
|
}
|
|
8832
8868
|
}))) : null));
|
|
8833
8869
|
} else if (tabs && tabs[0]) {
|
|
8834
|
-
return React$1.createElement('div', {
|
|
8870
|
+
return React$1.createElement(React$1.Fragment, null, this.renderInstructions(showTeacherInstructions, tabs[0].teacherInstructions, disabledTabs), React$1.createElement('div', {
|
|
8835
8871
|
className: classNames(classes.root, classes.tabContainer, classes.breakSpaces, 'passage'),
|
|
8836
8872
|
__self: this,
|
|
8837
8873
|
__source: {
|
|
8838
8874
|
fileName: _jsxFileName,
|
|
8839
|
-
lineNumber:
|
|
8875
|
+
lineNumber: 237
|
|
8840
8876
|
}
|
|
8841
8877
|
}, React$1.createElement('div', {
|
|
8842
8878
|
className: "text",
|
|
@@ -8846,9 +8882,9 @@ class StimulusTabs extends React$1.Component {
|
|
|
8846
8882
|
__self: this,
|
|
8847
8883
|
__source: {
|
|
8848
8884
|
fileName: _jsxFileName,
|
|
8849
|
-
lineNumber:
|
|
8885
|
+
lineNumber: 238
|
|
8850
8886
|
}
|
|
8851
|
-
}));
|
|
8887
|
+
})));
|
|
8852
8888
|
}
|
|
8853
8889
|
}
|
|
8854
8890
|
}
|
|
@@ -8857,9 +8893,11 @@ StimulusTabs.propTypes = {
|
|
|
8857
8893
|
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
8858
8894
|
id: PropTypes.number.isRequired,
|
|
8859
8895
|
title: PropTypes.string.isRequired,
|
|
8860
|
-
text: PropTypes.string.isRequired
|
|
8896
|
+
text: PropTypes.string.isRequired,
|
|
8897
|
+
teacherInstructions: PropTypes.string
|
|
8861
8898
|
}).isRequired).isRequired,
|
|
8862
|
-
disabledTabs: PropTypes.bool
|
|
8899
|
+
disabledTabs: PropTypes.bool,
|
|
8900
|
+
showTeacherInstructions: PropTypes.bool
|
|
8863
8901
|
};
|
|
8864
8902
|
var StimulusTabs$1 = styles$1.withStyles(styles)(StimulusTabs);
|
|
8865
8903
|
const React = _dll_react;
|
|
@@ -8886,16 +8924,19 @@ class PiePassage extends HTMLElement {
|
|
|
8886
8924
|
this._render();
|
|
8887
8925
|
}
|
|
8888
8926
|
_render() {
|
|
8927
|
+
const {showTeacherInstructions = false} = this._model;
|
|
8889
8928
|
if (this._model.passages.length > 0) {
|
|
8890
8929
|
const passagesTabs = this._model.passages.map((passage, index) => {
|
|
8891
8930
|
return {
|
|
8892
8931
|
id: index,
|
|
8893
8932
|
title: passage.title,
|
|
8894
|
-
text: passage.text
|
|
8933
|
+
text: passage.text,
|
|
8934
|
+
teacherInstructions: passage.teacherInstructions || ''
|
|
8895
8935
|
};
|
|
8896
8936
|
});
|
|
8897
8937
|
let elem = React.createElement(StimulusTabs$1, {
|
|
8898
|
-
tabs: passagesTabs
|
|
8938
|
+
tabs: passagesTabs,
|
|
8939
|
+
showTeacherInstructions
|
|
8899
8940
|
});
|
|
8900
8941
|
ReactDOM.render(elem, this);
|
|
8901
8942
|
}
|
package/module/manifest.json
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
"name": "@pie-element/passage",
|
|
3
3
|
"version": "2.3.1",
|
|
4
4
|
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"name": "@pie-lib/pie-toolbox-math-rendering-module",
|
|
7
|
+
"version": "1.1.0"
|
|
8
|
+
},
|
|
5
9
|
{
|
|
6
10
|
"name": "@pie-lib/pie-toolbox-module",
|
|
7
|
-
"version": "
|
|
11
|
+
"version": "4.0.0"
|
|
8
12
|
}
|
|
9
13
|
]
|
|
10
14
|
}
|
package/module/print-demo.js
CHANGED
|
@@ -7,6 +7,7 @@ generate.model = (id, element) => ({
|
|
|
7
7
|
element,
|
|
8
8
|
passages: [
|
|
9
9
|
{
|
|
10
|
+
teacherInstructions: 'Teacher instructions tab 1',
|
|
10
11
|
title: 'Hope Is the Thing with Feathers',
|
|
11
12
|
text: '<p><font style="visibility:hidden">00000</font>Hope is the thing with feathers<br /><font style="visibility:hidden">00000</font>That perches in the soul,<br /><font style="visibility:hidden">00000</font>And sings the tune without the words,<br /><font style="visibility:hidden">00000</font>And never stops at all,</p><p>5<font style="visibility:hidden">0000</font>And sweetest in the gale is heard;<br /><font style="visibility:hidden">00000</font>And sore must be the storm<br /><font style="visibility:hidden">00000</font>That could abash the little bird<br /><font style="visibility:hidden">00000</font>That kept so many warm.</p><p><font style="visibility:hidden">00000</font>I’ve heard it in the chillest land,<br />10<font style="visibility:hidden">000</font>And on the strangest sea;<br /><font style="visibility:hidden">00000</font>Yet, never, in extremity,<br /><font style="visibility:hidden">00000</font>It asked a crumb of me.</p><p><span class="no-number">"Hope is the Thing With Feathers" by Emily Dickinson, from <em>The Complete Poems of Emily Dickinson</em>. In the public domain.</span></p>',
|
|
12
13
|
},
|
package/module/print.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom,
|
|
1
|
+
import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.1.0/module/index.js";
|
|
2
|
+
import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.0.0/module/index.js";
|
|
2
3
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3
4
|
function getDefaultExportFromCjs(x) {
|
|
4
5
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -8539,9 +8540,11 @@ withTheme.default = _default;
|
|
|
8539
8540
|
getDefaultExportFromCjs(styles$1);
|
|
8540
8541
|
const React$1 = _dll_react;
|
|
8541
8542
|
const PropTypes = _dll_prop_types;
|
|
8543
|
+
const classNames = _dll_classnames;
|
|
8544
|
+
const {Collapsible: Collapsible} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8542
8545
|
const {color: color} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8546
|
+
const {PreviewPrompt: PreviewPrompt} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8543
8547
|
const {Purpose: Purpose} = _dll_pie_lib__pie_toolbox_render_ui;
|
|
8544
|
-
const classNames = _dll_classnames;
|
|
8545
8548
|
const _jsxFileName = "/home/circleci/repo/packages/passage/src/stimulus-tabs.jsx";
|
|
8546
8549
|
const styles = theme => ({
|
|
8547
8550
|
root: {
|
|
@@ -8575,6 +8578,9 @@ const styles = theme => ({
|
|
|
8575
8578
|
},
|
|
8576
8579
|
breakSpaces: {
|
|
8577
8580
|
whiteSpace: 'break-spaces'
|
|
8581
|
+
},
|
|
8582
|
+
teacherInstructions: {
|
|
8583
|
+
marginBottom: theme.spacing.unit * 2
|
|
8578
8584
|
}
|
|
8579
8585
|
});
|
|
8580
8586
|
class StimulusTabs extends React$1.Component {
|
|
@@ -8652,8 +8658,38 @@ class StimulusTabs extends React$1.Component {
|
|
|
8652
8658
|
return div.innerHTML;
|
|
8653
8659
|
};
|
|
8654
8660
|
}
|
|
8661
|
+
renderInstructions(showTeacherInstructions, teacherInstructions, disabledTabs = false) {
|
|
8662
|
+
if (!showTeacherInstructions || !teacherInstructions) {
|
|
8663
|
+
return;
|
|
8664
|
+
}
|
|
8665
|
+
const teacherInstructionsDiv = React$1.createElement(PreviewPrompt, {
|
|
8666
|
+
tagName: "div",
|
|
8667
|
+
className: "prompt",
|
|
8668
|
+
defaultClassName: "teacher-instructions",
|
|
8669
|
+
prompt: teacherInstructions,
|
|
8670
|
+
__self: this,
|
|
8671
|
+
__source: {
|
|
8672
|
+
fileName: _jsxFileName,
|
|
8673
|
+
lineNumber: 126
|
|
8674
|
+
}
|
|
8675
|
+
});
|
|
8676
|
+
if (disabledTabs) {
|
|
8677
|
+
return teacherInstructionsDiv;
|
|
8678
|
+
}
|
|
8679
|
+
return React$1.createElement(Collapsible, {
|
|
8680
|
+
labels: {
|
|
8681
|
+
hidden: 'Show Teacher Instructions',
|
|
8682
|
+
visible: 'Hide Teacher Instructions'
|
|
8683
|
+
},
|
|
8684
|
+
__self: this,
|
|
8685
|
+
__source: {
|
|
8686
|
+
fileName: _jsxFileName,
|
|
8687
|
+
lineNumber: 139
|
|
8688
|
+
}
|
|
8689
|
+
}, teacherInstructionsDiv);
|
|
8690
|
+
}
|
|
8655
8691
|
render() {
|
|
8656
|
-
const {classes, tabs, disabledTabs} = this.props;
|
|
8692
|
+
const {classes, tabs, disabledTabs, showTeacherInstructions} = this.props;
|
|
8657
8693
|
const {activeTab} = this.state;
|
|
8658
8694
|
if (tabs && tabs.length > 1) {
|
|
8659
8695
|
return disabledTabs ? React$1.createElement('div', {
|
|
@@ -8661,7 +8697,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8661
8697
|
__self: this,
|
|
8662
8698
|
__source: {
|
|
8663
8699
|
fileName: _jsxFileName,
|
|
8664
|
-
lineNumber:
|
|
8700
|
+
lineNumber: 156
|
|
8665
8701
|
}
|
|
8666
8702
|
}, tabs.map(tab => React$1.createElement('div', {
|
|
8667
8703
|
key: tab.id,
|
|
@@ -8673,7 +8709,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8673
8709
|
__self: this,
|
|
8674
8710
|
__source: {
|
|
8675
8711
|
fileName: _jsxFileName,
|
|
8676
|
-
lineNumber:
|
|
8712
|
+
lineNumber: 158
|
|
8677
8713
|
}
|
|
8678
8714
|
}, React$1.createElement('div', {
|
|
8679
8715
|
className: classes.tabContainer,
|
|
@@ -8683,7 +8719,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8683
8719
|
__self: this,
|
|
8684
8720
|
__source: {
|
|
8685
8721
|
fileName: _jsxFileName,
|
|
8686
|
-
lineNumber:
|
|
8722
|
+
lineNumber: 166
|
|
8687
8723
|
}
|
|
8688
8724
|
}, React$1.createElement('div', {
|
|
8689
8725
|
className: classNames(classes.title, 'title'),
|
|
@@ -8693,14 +8729,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8693
8729
|
__self: this,
|
|
8694
8730
|
__source: {
|
|
8695
8731
|
fileName: _jsxFileName,
|
|
8696
|
-
lineNumber:
|
|
8732
|
+
lineNumber: 172
|
|
8697
8733
|
}
|
|
8698
|
-
}), React$1.createElement(Purpose, {
|
|
8734
|
+
}), this.renderInstructions(showTeacherInstructions, tab.teacherInstructions, disabledTabs), React$1.createElement(Purpose, {
|
|
8699
8735
|
purpose: "passage-text",
|
|
8700
8736
|
__self: this,
|
|
8701
8737
|
__source: {
|
|
8702
8738
|
fileName: _jsxFileName,
|
|
8703
|
-
lineNumber:
|
|
8739
|
+
lineNumber: 177
|
|
8704
8740
|
}
|
|
8705
8741
|
}, React$1.createElement('div', {
|
|
8706
8742
|
className: "text",
|
|
@@ -8711,14 +8747,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8711
8747
|
__self: this,
|
|
8712
8748
|
__source: {
|
|
8713
8749
|
fileName: _jsxFileName,
|
|
8714
|
-
lineNumber:
|
|
8750
|
+
lineNumber: 178
|
|
8715
8751
|
}
|
|
8716
8752
|
})))))) : React$1.createElement('div', {
|
|
8717
8753
|
className: classNames(classes.root, 'passages'),
|
|
8718
8754
|
__self: this,
|
|
8719
8755
|
__source: {
|
|
8720
8756
|
fileName: _jsxFileName,
|
|
8721
|
-
lineNumber:
|
|
8757
|
+
lineNumber: 185
|
|
8722
8758
|
}
|
|
8723
8759
|
}, React$1.createElement(Tabs, {
|
|
8724
8760
|
classes: {
|
|
@@ -8730,7 +8766,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8730
8766
|
__self: this,
|
|
8731
8767
|
__source: {
|
|
8732
8768
|
fileName: _jsxFileName,
|
|
8733
|
-
lineNumber:
|
|
8769
|
+
lineNumber: 186
|
|
8734
8770
|
}
|
|
8735
8771
|
}, tabs.map(tab => React$1.createElement(Tab, {
|
|
8736
8772
|
className: classes.tab,
|
|
@@ -8741,7 +8777,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8741
8777
|
__self: this,
|
|
8742
8778
|
__source: {
|
|
8743
8779
|
fileName: _jsxFileName,
|
|
8744
|
-
lineNumber:
|
|
8780
|
+
lineNumber: 200
|
|
8745
8781
|
}
|
|
8746
8782
|
}, React$1.createElement('span', {
|
|
8747
8783
|
dangerouslySetInnerHTML: {
|
|
@@ -8750,7 +8786,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8750
8786
|
__self: this,
|
|
8751
8787
|
__source: {
|
|
8752
8788
|
fileName: _jsxFileName,
|
|
8753
|
-
lineNumber:
|
|
8789
|
+
lineNumber: 201
|
|
8754
8790
|
}
|
|
8755
8791
|
})),
|
|
8756
8792
|
value: tab.id,
|
|
@@ -8762,7 +8798,7 @@ class StimulusTabs extends React$1.Component {
|
|
|
8762
8798
|
__self: this,
|
|
8763
8799
|
__source: {
|
|
8764
8800
|
fileName: _jsxFileName,
|
|
8765
|
-
lineNumber:
|
|
8801
|
+
lineNumber: 195
|
|
8766
8802
|
}
|
|
8767
8803
|
}))), tabs.map(tab => activeTab === tab.id ? React$1.createElement('div', {
|
|
8768
8804
|
className: classes.tabContainer,
|
|
@@ -8773,14 +8809,14 @@ class StimulusTabs extends React$1.Component {
|
|
|
8773
8809
|
__self: this,
|
|
8774
8810
|
__source: {
|
|
8775
8811
|
fileName: _jsxFileName,
|
|
8776
|
-
lineNumber:
|
|
8812
|
+
lineNumber: 216
|
|
8777
8813
|
}
|
|
8778
|
-
}, React$1.createElement(Purpose, {
|
|
8814
|
+
}, this.renderInstructions(showTeacherInstructions, tab.teacherInstructions), React$1.createElement(Purpose, {
|
|
8779
8815
|
purpose: "passage-text",
|
|
8780
8816
|
__self: this,
|
|
8781
8817
|
__source: {
|
|
8782
8818
|
fileName: _jsxFileName,
|
|
8783
|
-
lineNumber:
|
|
8819
|
+
lineNumber: 225
|
|
8784
8820
|
}
|
|
8785
8821
|
}, React$1.createElement('div', {
|
|
8786
8822
|
key: tab.id,
|
|
@@ -8790,16 +8826,16 @@ class StimulusTabs extends React$1.Component {
|
|
|
8790
8826
|
__self: this,
|
|
8791
8827
|
__source: {
|
|
8792
8828
|
fileName: _jsxFileName,
|
|
8793
|
-
lineNumber:
|
|
8829
|
+
lineNumber: 226
|
|
8794
8830
|
}
|
|
8795
8831
|
}))) : null));
|
|
8796
8832
|
} else if (tabs && tabs[0]) {
|
|
8797
|
-
return React$1.createElement('div', {
|
|
8833
|
+
return React$1.createElement(React$1.Fragment, null, this.renderInstructions(showTeacherInstructions, tabs[0].teacherInstructions, disabledTabs), React$1.createElement('div', {
|
|
8798
8834
|
className: classNames(classes.root, classes.tabContainer, classes.breakSpaces, 'passage'),
|
|
8799
8835
|
__self: this,
|
|
8800
8836
|
__source: {
|
|
8801
8837
|
fileName: _jsxFileName,
|
|
8802
|
-
lineNumber:
|
|
8838
|
+
lineNumber: 237
|
|
8803
8839
|
}
|
|
8804
8840
|
}, React$1.createElement('div', {
|
|
8805
8841
|
className: "text",
|
|
@@ -8809,9 +8845,9 @@ class StimulusTabs extends React$1.Component {
|
|
|
8809
8845
|
__self: this,
|
|
8810
8846
|
__source: {
|
|
8811
8847
|
fileName: _jsxFileName,
|
|
8812
|
-
lineNumber:
|
|
8848
|
+
lineNumber: 238
|
|
8813
8849
|
}
|
|
8814
|
-
}));
|
|
8850
|
+
})));
|
|
8815
8851
|
}
|
|
8816
8852
|
}
|
|
8817
8853
|
}
|
|
@@ -8820,9 +8856,11 @@ StimulusTabs.propTypes = {
|
|
|
8820
8856
|
tabs: PropTypes.arrayOf(PropTypes.shape({
|
|
8821
8857
|
id: PropTypes.number.isRequired,
|
|
8822
8858
|
title: PropTypes.string.isRequired,
|
|
8823
|
-
text: PropTypes.string.isRequired
|
|
8859
|
+
text: PropTypes.string.isRequired,
|
|
8860
|
+
teacherInstructions: PropTypes.string
|
|
8824
8861
|
}).isRequired).isRequired,
|
|
8825
|
-
disabledTabs: PropTypes.bool
|
|
8862
|
+
disabledTabs: PropTypes.bool,
|
|
8863
|
+
showTeacherInstructions: PropTypes.bool
|
|
8826
8864
|
};
|
|
8827
8865
|
var StimulusTabs$1 = styles$1.withStyles(styles)(StimulusTabs);
|
|
8828
8866
|
const React = _dll_react;
|
|
@@ -8830,25 +8868,31 @@ const ReactDOM = _dll_react_dom;
|
|
|
8830
8868
|
const {debounce: debounce} = _dll_lodash;
|
|
8831
8869
|
const debug = _dll_debug;
|
|
8832
8870
|
const log = debug('pie-element:passage:print');
|
|
8833
|
-
const preparePrintPassage = model
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8871
|
+
const preparePrintPassage = (model, opts) => {
|
|
8872
|
+
const instr = opts.role === 'instructor';
|
|
8873
|
+
return model.passages.map((passage, index) => {
|
|
8874
|
+
return {
|
|
8875
|
+
id: index,
|
|
8876
|
+
title: passage.title,
|
|
8877
|
+
text: passage.text,
|
|
8878
|
+
teacherInstructions: instr && passage.teacherInstructions
|
|
8879
|
+
};
|
|
8880
|
+
});
|
|
8881
|
+
};
|
|
8840
8882
|
class PassagePrint extends HTMLElement {
|
|
8841
8883
|
constructor() {
|
|
8842
8884
|
super();
|
|
8843
8885
|
this._model = null;
|
|
8886
|
+
this._options = null;
|
|
8844
8887
|
this._session = [];
|
|
8845
8888
|
this._rerender = debounce(() => {
|
|
8846
8889
|
if (this._model && this._session) {
|
|
8847
8890
|
if (this._model.passages && this._model.passages.length > 0) {
|
|
8848
|
-
const printPassage = preparePrintPassage(this._model);
|
|
8891
|
+
const printPassage = preparePrintPassage(this._model, this._options);
|
|
8849
8892
|
const element = React.createElement(StimulusTabs$1, {
|
|
8850
8893
|
tabs: printPassage,
|
|
8851
|
-
disabledTabs: true
|
|
8894
|
+
disabledTabs: true,
|
|
8895
|
+
showTeacherInstructions: this._options.role === 'instructor'
|
|
8852
8896
|
});
|
|
8853
8897
|
ReactDOM.render(element, this);
|
|
8854
8898
|
}
|
|
@@ -8864,6 +8908,9 @@ class PassagePrint extends HTMLElement {
|
|
|
8864
8908
|
this._model = s;
|
|
8865
8909
|
this._rerender();
|
|
8866
8910
|
}
|
|
8911
|
+
set options(o) {
|
|
8912
|
+
this._options = o;
|
|
8913
|
+
}
|
|
8867
8914
|
connectedCallback() {}
|
|
8868
8915
|
}
|
|
8869
8916
|
export {PassagePrint as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/passage",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@material-ui/core": "^3.9.2",
|
|
13
13
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
14
|
-
"@pie-lib/pie-toolbox": "1.
|
|
14
|
+
"@pie-lib/pie-toolbox": "1.8.1",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"prop-types": "^15.6.1",
|
|
17
17
|
"react": "^16.8.1",
|
|
18
18
|
"react-dom": "^16.8.1"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "95bab062051a7c74c61eb71aa076e78bff998488",
|
|
21
21
|
"scripts": {
|
|
22
22
|
"postpublish": "../../scripts/postpublish"
|
|
23
23
|
},
|