@pie-element/charting 2.7.29 → 4.0.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 +42 -0
- package/configure/CHANGELOG.md +42 -0
- package/configure/lib/charting-config.js +23 -4
- package/configure/lib/charting-config.js.map +1 -1
- package/configure/lib/configure.js +21 -13
- package/configure/lib/configure.js.map +1 -1
- package/configure/lib/correct-response.js +161 -41
- package/configure/lib/correct-response.js.map +1 -1
- package/configure/lib/defaults.js +11 -4
- package/configure/lib/defaults.js.map +1 -1
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +16 -0
- package/controller/lib/index.js +24 -20
- package/controller/lib/index.js.map +1 -1
- package/controller/package.json +1 -1
- package/docs/config-schema.json +63 -0
- package/docs/config-schema.json.md +49 -1
- package/docs/demo/generate.js +6 -26
- package/docs/demo/session.js +3 -9
- package/docs/pie-schema.json +21 -48
- package/docs/pie-schema.json.md +16 -8
- package/lib/main.js +0 -3
- package/lib/main.js.map +1 -1
- package/package.json +6 -6
- package/configure/lib/chart-type.js +0 -72
- package/configure/lib/chart-type.js.map +0 -1
package/docs/pie-schema.json
CHANGED
|
@@ -52,11 +52,6 @@
|
|
|
52
52
|
"type": "number",
|
|
53
53
|
"title": "value"
|
|
54
54
|
},
|
|
55
|
-
"initial": {
|
|
56
|
-
"description": "Indicates if category is default category",
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"title": "initial"
|
|
59
|
-
},
|
|
60
55
|
"interactive": {
|
|
61
56
|
"description": "Indicates if category label & value are interactive",
|
|
62
57
|
"type": "boolean",
|
|
@@ -104,7 +99,6 @@
|
|
|
104
99
|
"correctness",
|
|
105
100
|
"deletable",
|
|
106
101
|
"editable",
|
|
107
|
-
"initial",
|
|
108
102
|
"interactive",
|
|
109
103
|
"label",
|
|
110
104
|
"value"
|
|
@@ -128,11 +122,6 @@
|
|
|
128
122
|
"type": "number",
|
|
129
123
|
"title": "value"
|
|
130
124
|
},
|
|
131
|
-
"initial": {
|
|
132
|
-
"description": "Indicates if category is default category",
|
|
133
|
-
"type": "boolean",
|
|
134
|
-
"title": "initial"
|
|
135
|
-
},
|
|
136
125
|
"interactive": {
|
|
137
126
|
"description": "Indicates if category label & value are interactive",
|
|
138
127
|
"type": "boolean",
|
|
@@ -180,7 +169,6 @@
|
|
|
180
169
|
"correctness",
|
|
181
170
|
"deletable",
|
|
182
171
|
"editable",
|
|
183
|
-
"initial",
|
|
184
172
|
"interactive",
|
|
185
173
|
"label",
|
|
186
174
|
"value"
|
|
@@ -214,11 +202,6 @@
|
|
|
214
202
|
"type": "number",
|
|
215
203
|
"title": "value"
|
|
216
204
|
},
|
|
217
|
-
"initial": {
|
|
218
|
-
"description": "Indicates if category is default category",
|
|
219
|
-
"type": "boolean",
|
|
220
|
-
"title": "initial"
|
|
221
|
-
},
|
|
222
205
|
"interactive": {
|
|
223
206
|
"description": "Indicates if category label & value are interactive",
|
|
224
207
|
"type": "boolean",
|
|
@@ -266,7 +249,6 @@
|
|
|
266
249
|
"correctness",
|
|
267
250
|
"deletable",
|
|
268
251
|
"editable",
|
|
269
|
-
"initial",
|
|
270
252
|
"interactive",
|
|
271
253
|
"label",
|
|
272
254
|
"value"
|
|
@@ -290,11 +272,6 @@
|
|
|
290
272
|
"type": "number",
|
|
291
273
|
"title": "value"
|
|
292
274
|
},
|
|
293
|
-
"initial": {
|
|
294
|
-
"description": "Indicates if category is default category",
|
|
295
|
-
"type": "boolean",
|
|
296
|
-
"title": "initial"
|
|
297
|
-
},
|
|
298
275
|
"interactive": {
|
|
299
276
|
"description": "Indicates if category label & value are interactive",
|
|
300
277
|
"type": "boolean",
|
|
@@ -342,7 +319,6 @@
|
|
|
342
319
|
"correctness",
|
|
343
320
|
"deletable",
|
|
344
321
|
"editable",
|
|
345
|
-
"initial",
|
|
346
322
|
"interactive",
|
|
347
323
|
"label",
|
|
348
324
|
"value"
|
|
@@ -390,11 +366,6 @@
|
|
|
390
366
|
"step"
|
|
391
367
|
]
|
|
392
368
|
},
|
|
393
|
-
"editCategoryEnabled": {
|
|
394
|
-
"description": "Indicates if user can edit default categories",
|
|
395
|
-
"type": "boolean",
|
|
396
|
-
"title": "editCategoryEnabled"
|
|
397
|
-
},
|
|
398
369
|
"graph": {
|
|
399
370
|
"title": "Chart",
|
|
400
371
|
"type": "object",
|
|
@@ -530,7 +501,6 @@
|
|
|
530
501
|
"correctAnswer",
|
|
531
502
|
"data",
|
|
532
503
|
"domain",
|
|
533
|
-
"editCategoryEnabled",
|
|
534
504
|
"element",
|
|
535
505
|
"graph",
|
|
536
506
|
"id",
|
|
@@ -578,6 +548,27 @@
|
|
|
578
548
|
}
|
|
579
549
|
}
|
|
580
550
|
},
|
|
551
|
+
"ConfigureMaxImageDimensionsProp": {
|
|
552
|
+
"title": "ConfigureMaxImageDimensionsProp",
|
|
553
|
+
"type": "object",
|
|
554
|
+
"properties": {
|
|
555
|
+
"teacherInstructions": {
|
|
556
|
+
"description": "Indicates the max dimension for images in teacher instructions",
|
|
557
|
+
"type": "number",
|
|
558
|
+
"title": "teacherInstructions"
|
|
559
|
+
},
|
|
560
|
+
"prompt": {
|
|
561
|
+
"description": "Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified",
|
|
562
|
+
"type": "number",
|
|
563
|
+
"title": "prompt"
|
|
564
|
+
},
|
|
565
|
+
"rationale": {
|
|
566
|
+
"description": "Indicates the max dimension for images in rationale",
|
|
567
|
+
"type": "number",
|
|
568
|
+
"title": "rationale"
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
},
|
|
581
572
|
"Answer": {
|
|
582
573
|
"title": "Answer",
|
|
583
574
|
"type": "object",
|
|
@@ -605,11 +596,6 @@
|
|
|
605
596
|
"type": "number",
|
|
606
597
|
"title": "value"
|
|
607
598
|
},
|
|
608
|
-
"initial": {
|
|
609
|
-
"description": "Indicates if category is default category",
|
|
610
|
-
"type": "boolean",
|
|
611
|
-
"title": "initial"
|
|
612
|
-
},
|
|
613
599
|
"interactive": {
|
|
614
600
|
"description": "Indicates if category label & value are interactive",
|
|
615
601
|
"type": "boolean",
|
|
@@ -657,7 +643,6 @@
|
|
|
657
643
|
"correctness",
|
|
658
644
|
"deletable",
|
|
659
645
|
"editable",
|
|
660
|
-
"initial",
|
|
661
646
|
"interactive",
|
|
662
647
|
"label",
|
|
663
648
|
"value"
|
|
@@ -681,11 +666,6 @@
|
|
|
681
666
|
"type": "number",
|
|
682
667
|
"title": "value"
|
|
683
668
|
},
|
|
684
|
-
"initial": {
|
|
685
|
-
"description": "Indicates if category is default category",
|
|
686
|
-
"type": "boolean",
|
|
687
|
-
"title": "initial"
|
|
688
|
-
},
|
|
689
669
|
"interactive": {
|
|
690
670
|
"description": "Indicates if category label & value are interactive",
|
|
691
671
|
"type": "boolean",
|
|
@@ -733,7 +713,6 @@
|
|
|
733
713
|
"correctness",
|
|
734
714
|
"deletable",
|
|
735
715
|
"editable",
|
|
736
|
-
"initial",
|
|
737
716
|
"interactive",
|
|
738
717
|
"label",
|
|
739
718
|
"value"
|
|
@@ -763,11 +742,6 @@
|
|
|
763
742
|
"type": "number",
|
|
764
743
|
"title": "value"
|
|
765
744
|
},
|
|
766
|
-
"initial": {
|
|
767
|
-
"description": "Indicates if category is default category",
|
|
768
|
-
"type": "boolean",
|
|
769
|
-
"title": "initial"
|
|
770
|
-
},
|
|
771
745
|
"interactive": {
|
|
772
746
|
"description": "Indicates if category label & value are interactive",
|
|
773
747
|
"type": "boolean",
|
|
@@ -815,7 +789,6 @@
|
|
|
815
789
|
"correctness",
|
|
816
790
|
"deletable",
|
|
817
791
|
"editable",
|
|
818
|
-
"initial",
|
|
819
792
|
"interactive",
|
|
820
793
|
"label",
|
|
821
794
|
"value"
|
package/docs/pie-schema.json.md
CHANGED
|
@@ -69,10 +69,6 @@ Label step value
|
|
|
69
69
|
|
|
70
70
|
Axis Label
|
|
71
71
|
|
|
72
|
-
# `editCategoryEnabled` (boolean, required)
|
|
73
|
-
|
|
74
|
-
Indicates if user can edit default categories
|
|
75
|
-
|
|
76
72
|
# `graph` (object, required)
|
|
77
73
|
|
|
78
74
|
Properties of the `graph` object:
|
|
@@ -201,6 +197,22 @@ Indicates the label for the item that has to be displayed in the Settings Panel
|
|
|
201
197
|
Indicates the value of the item if it affects config-ui
|
|
202
198
|
(eg.: if item is a switch and displaying an input on the config-ui depends on the switch value: on/off)
|
|
203
199
|
|
|
200
|
+
## `ConfigureMaxImageDimensionsProp` (object)
|
|
201
|
+
|
|
202
|
+
Properties of the `ConfigureMaxImageDimensionsProp` object:
|
|
203
|
+
|
|
204
|
+
### `teacherInstructions` (number)
|
|
205
|
+
|
|
206
|
+
Indicates the max dimension for images in teacher instructions
|
|
207
|
+
|
|
208
|
+
### `prompt` (number)
|
|
209
|
+
|
|
210
|
+
Indicates the max dimension for images in prompt - this is also the default dimension for all other input fields if it's not specified
|
|
211
|
+
|
|
212
|
+
### `rationale` (number)
|
|
213
|
+
|
|
214
|
+
Indicates the max dimension for images in rationale
|
|
215
|
+
|
|
204
216
|
## `Answer` (object)
|
|
205
217
|
|
|
206
218
|
Properties of the `Answer` object:
|
|
@@ -229,10 +241,6 @@ Indicates category label
|
|
|
229
241
|
|
|
230
242
|
Indicates category value
|
|
231
243
|
|
|
232
|
-
### `initial` (boolean, required)
|
|
233
|
-
|
|
234
|
-
Indicates if category is default category
|
|
235
|
-
|
|
236
244
|
### `interactive` (boolean, required)
|
|
237
245
|
|
|
238
246
|
Indicates if category label & value are interactive
|
package/lib/main.js
CHANGED
|
@@ -106,7 +106,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
106
106
|
domain = model.domain,
|
|
107
107
|
range = model.range,
|
|
108
108
|
title = model.title,
|
|
109
|
-
editCategoryEnabled = model.editCategoryEnabled,
|
|
110
109
|
addCategoryEnabled = model.addCategoryEnabled,
|
|
111
110
|
categoryDefaultLabel = model.categoryDefaultLabel,
|
|
112
111
|
rationale = model.rationale,
|
|
@@ -144,7 +143,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
144
143
|
data: correctData || categories,
|
|
145
144
|
title: title,
|
|
146
145
|
onDataChange: this.changeData,
|
|
147
|
-
editCategoryEnabled: false,
|
|
148
146
|
addCategoryEnabled: false,
|
|
149
147
|
categoryDefaultLabel: categoryDefaultLabel
|
|
150
148
|
}) : /*#__PURE__*/_react["default"].createElement(_charting.Chart, {
|
|
@@ -156,7 +154,6 @@ var Main = /*#__PURE__*/function (_React$Component) {
|
|
|
156
154
|
data: correctedAnswer || categories,
|
|
157
155
|
title: title,
|
|
158
156
|
onDataChange: this.changeData,
|
|
159
|
-
editCategoryEnabled: editCategoryEnabled,
|
|
160
157
|
addCategoryEnabled: addCategoryEnabled,
|
|
161
158
|
categoryDefaultLabel: categoryDefaultLabel
|
|
162
159
|
}), /*#__PURE__*/_react["default"].createElement("br", null), rationale && (0, _renderUi.hasText)(rationale) && /*#__PURE__*/_react["default"].createElement(_renderUi.Collapsible, {
|
package/lib/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","
|
|
1
|
+
{"version":3,"sources":["../src/main.jsx"],"names":["Main","props","data","setState","categories","onAnswersChange","showingCorrect","state","model","nextProps","nextData","classes","teacherInstructions","prompt","chartType","size","domain","range","title","addCategoryEnabled","categoryDefaultLabel","rationale","correctedAnswer","correctAnswer","correctData","map","interactive","editable","showToggle","length","mainContainer","toggleCorrect","hidden","visible","chartTypes","Bar","Histogram","LineDot","LineCross","DotPlot","LinePlot","changeData","React","Component","PropTypes","object","isRequired","func","array","styles","theme","padding","spacing","unit","color","text","backgroundColor","background","overflow"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AAUX,gBAAYC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EAAEC;AAjBxB,QAjDJ,eAsEE,2CAtEF,EAuEGC,SAAS,IAAI,uBAAQA,SAAR,CAAb,iBACC,gCAAC,qBAAD;AACE,QAAA,MAAM,EAAE;AAAEW,UAAAA,MAAM,EAAE,gBAAV;AAA4BC,UAAAA,OAAO,EAAE;AAArC;AADV,sBAGE,gCAAC,uBAAD;AAAe,QAAA,MAAM,EAAEZ;AAAvB,QAHF,CAxEJ,CADF;AAiFD;;;EAtJuBqB,kBAAMC,S;;;iCAAnB3C,I,eACQ;AACjBW,EAAAA,OAAO,EAAEiC,sBAAUC,MADF;AAEjBrC,EAAAA,KAAK,EAAEoC,sBAAUC,MAAV,CAAiBC,UAFP;AAGjBzC,EAAAA,eAAe,EAAEuC,sBAAUG,IAHV;AAIjB3C,EAAAA,UAAU,EAAEwC,sBAAUI;AAJL,C;iCADRhD,I,kBAQW;AAAEW,EAAAA,OAAO,EAAE;AAAX,C;;AAiJxB,IAAMsC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBpB,IAAAA,aAAa,EAAE;AACbqB,MAAAA,OAAO,EAAED,KAAK,CAACE,OAAN,CAAcC,IADV;AAEbC,MAAAA,KAAK,EAAEA,gBAAMC,IAAN,EAFM;AAGbC,MAAAA,eAAe,EAAEF,gBAAMG,UAAN,EAHJ;AAIbC,MAAAA,QAAQ,EAAE;AAJG;AADU,GAAZ;AAAA,CAAf;;eASe,wBAAWT,MAAX,EAAmBjD,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport {color, Collapsible, hasText, PreviewPrompt} from '@pie-lib/render-ui';\nimport { Chart, chartTypes } from '@pie-lib/charting';\nimport isEqual from 'lodash/isEqual';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\n\nexport class Main extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n model: PropTypes.object.isRequired,\n onAnswersChange: PropTypes.func,\n categories: PropTypes.array,\n };\n\n static defaultProps = { classes: {} };\n\n constructor(props) {\n super(props);\n\n this.state = {\n categories: props.categories || props.model.data,\n showingCorrect: false,\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: { data: nextData = [] } = {} } = nextProps;\n const { model: { data = [] } = {} } = this.props;\n\n if (!isEqual(nextData, data)) {\n this.setState({ categories: nextData });\n }\n }\n\n changeData = (data) =>\n this.setState(\n {\n categories: data,\n },\n () => this.props.onAnswersChange(data)\n );\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n render() {\n const { categories, showingCorrect } = this.state;\n const { model, classes } = this.props;\n const {\n teacherInstructions,\n prompt,\n chartType,\n size,\n domain,\n range,\n title,\n addCategoryEnabled,\n categoryDefaultLabel,\n rationale,\n correctedAnswer,\n correctAnswer,\n } = model;\n\n const correctData =\n correctAnswer && correctAnswer.data\n ? correctAnswer.data.map((data) => {\n return {\n ...data,\n interactive: false,\n editable: false,\n };\n })\n : [];\n\n const showToggle = correctData && correctData.length > 0;\n\n return (\n <div className={classes.mainContainer}>\n <CorrectAnswerToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n />\n\n {teacherInstructions && hasText(teacherInstructions) && (\n <React.Fragment>\n <Collapsible\n labels={{\n hidden: 'Show Teacher Instructions',\n visible: 'Hide Teacher Instructions',\n }}\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </Collapsible>\n <br />\n </React.Fragment>\n )}\n\n {prompt && (\n <React.Fragment>\n <PreviewPrompt className=\"prompt\" prompt={prompt} />\n <br />\n </React.Fragment>\n )}\n\n {showingCorrect && showToggle ? (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctData || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={false}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n ) : (\n <Chart\n chartType={chartType}\n size={size}\n domain={domain}\n range={range}\n charts={[\n chartTypes.Bar(),\n chartTypes.Histogram(),\n chartTypes.LineDot(),\n chartTypes.LineCross(),\n chartTypes.DotPlot(),\n chartTypes.LinePlot(),\n ]}\n data={correctedAnswer || categories}\n title={title}\n onDataChange={this.changeData}\n addCategoryEnabled={addCategoryEnabled}\n categoryDefaultLabel={categoryDefaultLabel}\n />\n )}\n\n <br />\n {rationale && hasText(rationale) && (\n <Collapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n >\n <PreviewPrompt prompt={rationale} />\n </Collapsible>\n )}\n </div>\n );\n }\n}\n\nconst styles = (theme) => ({\n mainContainer: {\n padding: theme.spacing.unit,\n color: color.text(),\n backgroundColor: color.background(),\n overflow: 'hidden'\n }\n});\n\nexport default withStyles(styles)(Main);\n"],"file":"main.js"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"repository": "pie-framework/pie-elements",
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "4.0.0",
|
|
8
8
|
"description": "",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@material-ui/core": "^3.9.2",
|
|
15
15
|
"@pie-framework/pie-player-events": "^0.1.0",
|
|
16
|
-
"@pie-lib/charting": "^
|
|
17
|
-
"@pie-lib/correct-answer-toggle": "^2.3.
|
|
18
|
-
"@pie-lib/math-rendering": "^2.4.
|
|
19
|
-
"@pie-lib/render-ui": "^4.12.
|
|
16
|
+
"@pie-lib/charting": "^5.1.0",
|
|
17
|
+
"@pie-lib/correct-answer-toggle": "^2.3.39",
|
|
18
|
+
"@pie-lib/math-rendering": "^2.4.3",
|
|
19
|
+
"@pie-lib/render-ui": "^4.12.9",
|
|
20
20
|
"classnames": "^2.2.5",
|
|
21
21
|
"debug": "^4.1.1",
|
|
22
22
|
"lodash": "^4.17.15",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"author": "",
|
|
27
27
|
"license": "ISC",
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ff92cee6f9a7bf3f3dc75dbafd2263710f0a6b3d",
|
|
29
29
|
"main": "lib/index.js",
|
|
30
30
|
"module": "src/index.js"
|
|
31
31
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _styles = require("@material-ui/core/styles");
|
|
13
|
-
|
|
14
|
-
var _MenuItem = _interopRequireDefault(require("@material-ui/core/MenuItem"));
|
|
15
|
-
|
|
16
|
-
var _FormControl = _interopRequireDefault(require("@material-ui/core/FormControl"));
|
|
17
|
-
|
|
18
|
-
var _InputLabel = _interopRequireDefault(require("@material-ui/core/InputLabel"));
|
|
19
|
-
|
|
20
|
-
var _Select = _interopRequireDefault(require("@material-ui/core/Select"));
|
|
21
|
-
|
|
22
|
-
var _OutlinedInput = _interopRequireDefault(require("@material-ui/core/OutlinedInput"));
|
|
23
|
-
|
|
24
|
-
var ChartType = (0, _styles.withStyles)(function (theme) {
|
|
25
|
-
return {
|
|
26
|
-
formControl: {
|
|
27
|
-
width: '100%'
|
|
28
|
-
},
|
|
29
|
-
chartType: {
|
|
30
|
-
paddingTop: theme.spacing.unit * 2,
|
|
31
|
-
paddingBottom: theme.spacing.unit * 2
|
|
32
|
-
},
|
|
33
|
-
chartTypeLabel: {
|
|
34
|
-
transform: 'translate(0px, -16px) scale(0.75) !important'
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
})(function (_ref) {
|
|
38
|
-
var onChange = _ref.onChange,
|
|
39
|
-
value = _ref.value,
|
|
40
|
-
classes = _ref.classes;
|
|
41
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
42
|
-
className: classes.chartType
|
|
43
|
-
}, /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
44
|
-
variant: "outlined",
|
|
45
|
-
className: classes.formControl
|
|
46
|
-
}, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
|
|
47
|
-
htmlFor: "type-helper",
|
|
48
|
-
className: classes.chartTypeLabel
|
|
49
|
-
}, "ChartType"), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
50
|
-
value: value,
|
|
51
|
-
onChange: onChange,
|
|
52
|
-
input: /*#__PURE__*/_react["default"].createElement(_OutlinedInput["default"], {
|
|
53
|
-
name: "type",
|
|
54
|
-
id: "type-helper"
|
|
55
|
-
})
|
|
56
|
-
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
57
|
-
value: 'histogram'
|
|
58
|
-
}, "Histogram"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
59
|
-
value: 'bar'
|
|
60
|
-
}, "Bar"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
61
|
-
value: 'lineDot'
|
|
62
|
-
}, "Line Dot"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
63
|
-
value: 'lineCross'
|
|
64
|
-
}, "Line Cross"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
65
|
-
value: 'dotPlot'
|
|
66
|
-
}, "Dot Plot"), /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
67
|
-
value: 'linePlot'
|
|
68
|
-
}, "Line Plot"))));
|
|
69
|
-
});
|
|
70
|
-
var _default = ChartType;
|
|
71
|
-
exports["default"] = _default;
|
|
72
|
-
//# sourceMappingURL=chart-type.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/chart-type.js"],"names":["ChartType","theme","formControl","width","chartType","paddingTop","spacing","unit","paddingBottom","chartTypeLabel","transform","onChange","value","classes"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,SAAS,GAAG,wBAAW,UAAAC,KAAK;AAAA,SAAK;AACrCC,IAAAA,WAAW,EAAE;AACXC,MAAAA,KAAK,EAAE;AADI,KADwB;AAIrCC,IAAAA,SAAS,EAAE;AACTC,MAAAA,UAAU,EAAEJ,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB,CADxB;AAETC,MAAAA,aAAa,EAAEP,KAAK,CAACK,OAAN,CAAcC,IAAd,GAAqB;AAF3B,KAJ0B;AAQrCE,IAAAA,cAAc,EAAE;AACdC,MAAAA,SAAS,EAAE;AADG;AARqB,GAAL;AAAA,CAAhB,EAWd,gBAAkC;AAAA,MAA/BC,QAA+B,QAA/BA,QAA+B;AAAA,MAArBC,KAAqB,QAArBA,KAAqB;AAAA,MAAdC,OAAc,QAAdA,OAAc;AACpC,sBACE;AAAK,IAAA,SAAS,EAAEA,OAAO,CAACT;AAAxB,kBACE,gCAAC,uBAAD;AAAa,IAAA,OAAO,EAAC,UAArB;AAAgC,IAAA,SAAS,EAAES,OAAO,CAACX;AAAnD,kBACE,gCAAC,sBAAD;AAAY,IAAA,OAAO,EAAC,aAApB;AAAkC,IAAA,SAAS,EAAEW,OAAO,CAACJ;AAArD,iBADF,eAGE,gCAAC,kBAAD;AACE,IAAA,KAAK,EAAEG,KADT;AAEE,IAAA,QAAQ,EAAED,QAFZ;AAGE,IAAA,KAAK,eAAE,gCAAC,yBAAD;AAAe,MAAA,IAAI,EAAC,MAApB;AAA2B,MAAA,EAAE,EAAC;AAA9B;AAHT,kBAKE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,iBALF,eAME,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,WANF,eAOE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,gBAPF,eAQE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,kBARF,eASE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,gBATF,eAUE,gCAAC,oBAAD;AAAU,IAAA,KAAK,EAAE;AAAjB,iBAVF,CAHF,CADF,CADF;AAoBD,CAhCiB,CAAlB;eAkCeX,S","sourcesContent":["import React from 'react';\nimport { withStyles } from '@material-ui/core/styles';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport FormControl from '@material-ui/core/FormControl';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Select from '@material-ui/core/Select';\nimport OutlinedInput from '@material-ui/core/OutlinedInput';\n\nconst ChartType = withStyles(theme => ({\n formControl: {\n width: '100%'\n },\n chartType: {\n paddingTop: theme.spacing.unit * 2,\n paddingBottom: theme.spacing.unit * 2\n },\n chartTypeLabel: {\n transform: 'translate(0px, -16px) scale(0.75) !important'\n }\n}))(({ onChange, value, classes }) => {\n return (\n <div className={classes.chartType}>\n <FormControl variant=\"outlined\" className={classes.formControl}>\n <InputLabel htmlFor=\"type-helper\" className={classes.chartTypeLabel}>ChartType</InputLabel>\n\n <Select\n value={value}\n onChange={onChange}\n input={<OutlinedInput name=\"type\" id=\"type-helper\" />}\n >\n <MenuItem value={'histogram'}>Histogram</MenuItem>\n <MenuItem value={'bar'}>Bar</MenuItem>\n <MenuItem value={'lineDot'}>Line Dot</MenuItem>\n <MenuItem value={'lineCross'}>Line Cross</MenuItem>\n <MenuItem value={'dotPlot'}>Dot Plot</MenuItem>\n <MenuItem value={'linePlot'}>Line Plot</MenuItem>\n </Select>\n </FormControl>\n </div>\n );\n});\n\nexport default ChartType;\n"],"file":"chart-type.js"}
|