@pie-lib/plot 2.10.0 → 2.12.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 +24 -52
- package/package.json +4 -4
- package/lib/draggable.js +0 -65
- package/lib/draggable.js.map +0 -1
- package/lib/graph-props.js +0 -53
- package/lib/graph-props.js.map +0 -1
- package/lib/grid-draggable.js +0 -381
- package/lib/grid-draggable.js.map +0 -1
- package/lib/index.js +0 -59
- package/lib/index.js.map +0 -1
- package/lib/label.js +0 -176
- package/lib/label.js.map +0 -1
- package/lib/root.js +0 -422
- package/lib/root.js.map +0 -1
- package/lib/trig.js +0 -196
- package/lib/trig.js.map +0 -1
- package/lib/types.js +0 -68
- package/lib/types.js.map +0 -1
- package/lib/utils.js +0 -232
- package/lib/utils.js.map +0 -1
package/lib/label.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/label.jsx"],"names":["LabelComponent","props","classes","disabledLabel","graphHeight","graphWidth","isChartBottomLabel","isDefineChartBottomLabel","isChartLeftLabel","isDefineChartLeftLabel","placeholder","text","side","onChange","mathMlOptions","charactersLimit","titleHeight","rotatedToHorizontal","setRotatedToHorizontal","activePlugins","isChart","chartValue","defaultStyle","width","top","left","rotatedStyle","rotateLabel","chartLabel","axisLabel","rotateLeftLabel","rotateRightLabel","editLabel","customBottom","displayNone","__html","position","noPadding","noBorder","propTypes","PropTypes","object","bool","number","string","func","theme","label","fill","color","secondary","fontSize","typography","textAlign","margin","spacing","unit","padding","pointerEvents","backgroundColor","borderRadius","boxShadow","zIndex","transformOrigin","transformStyle","display"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AACA,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAW;AAAA;;AAChC,MACEC,OADF,GAgBID,KAhBJ,CACEC,OADF;AAAA,MAEEC,aAFF,GAgBIF,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AAAA,SAAS,EAAE;AACTI,MAAAA,QAAQ,EAAE,UADD;AAETuB,MAAAA,eAAe,EAAE,OAFR;AAGTC,MAAAA,YAAY,EAAE,KAHL;AAITC,MAAAA,SAAS,EAAE,iCAJF;AAKTC,MAAAA,MAAM,EAAE;AALC,KApByB;AA2BpChC,IAAAA,eAAe,EAAE;AACf,2BAAqB,gBADN;AAEfiC,MAAAA,eAAe,EAAE,KAFF;AAGfC,MAAAA,cAAc,EAAE,aAHD;AAIf5B,MAAAA,QAAQ,EAAE;AAJK,KA3BmB;AAiCpCL,IAAAA,gBAAgB,EAAE;AAChB,2BAAqB,eADL;AAEhBgC,MAAAA,eAAe,EAAE,KAFD;AAGhBC,MAAAA,cAAc,EAAE,aAHA;AAIhB5B,MAAAA,QAAQ,EAAE;AAJM,KAjCkB;AAuCpCH,IAAAA,YAAY,EAAE;AACZG,MAAAA,QAAQ,EAAE;AADE,KAvCsB;AA0CpCF,IAAAA,WAAW,EAAE;AACX+B,MAAAA,OAAO,EAAE;AADE;AA1CuB,GAAZ;AAAA,CAAX,EA6CXjE,cA7CW,C","sourcesContent":["import React, { useState } from 'react';\nimport { color, Readable } from '@pie-lib/render-ui';\nimport cn from 'classnames';\nimport EditableHtml from '@pie-lib/editable-html';\nimport { withStyles } from '@material-ui/core/styles';\nimport PropTypes from 'prop-types';\nimport { extractTextFromHTML, isEmptyString } from './utils';\nconst LabelComponent = (props) => {\n const {\n classes,\n disabledLabel,\n graphHeight,\n graphWidth,\n isChartBottomLabel,\n isDefineChartBottomLabel,\n isChartLeftLabel,\n isDefineChartLeftLabel,\n placeholder,\n text,\n side,\n onChange,\n mathMlOptions = {},\n charactersLimit,\n titleHeight,\n } = props;\n const [rotatedToHorizontal, setRotatedToHorizontal] = useState(false);\n const activePlugins = [\n 'bold',\n 'italic',\n 'underline',\n 'strikethrough',\n 'math',\n // 'languageCharacters'\n ];\n\n const isChart = isChartBottomLabel || isChartLeftLabel || isDefineChartBottomLabel || isDefineChartLeftLabel;\n\n const chartValue = side === 'left' && isDefineChartLeftLabel && graphHeight - 220;\n const defaultStyle = {\n width: chartValue || (side === 'left' || side === 'right' ? graphHeight - 8 : graphWidth - 8),\n top:\n chartValue ||\n (isChartLeftLabel && `${graphHeight - 70}px`) ||\n (side === 'left' && `${graphHeight - 8}px`) ||\n (isChartBottomLabel && `${graphHeight - 60 + titleHeight}px`) ||\n (side === 'bottom' && `${graphHeight - 120 + titleHeight}px`) ||\n 0,\n left:\n (side === 'right' && `${graphWidth - 8}px`) ||\n ((isDefineChartLeftLabel || isDefineChartBottomLabel) && '40px') ||\n (isChartBottomLabel && '-10px') ||\n 0,\n };\n\n const rotatedStyle = {\n width: graphWidth - 8,\n top: (side === 'right' && `${graphHeight - 22}px`) || 0,\n left: 0,\n };\n\n const rotateLabel = () => !disabledLabel && (side === 'left' || side === 'right') && setRotatedToHorizontal(true);\n\n return (\n <Readable false>\n <div\n className={cn(isChart ? classes.chartLabel : classes.axisLabel, {\n [classes.rotateLeftLabel]: side === 'left' && !rotatedToHorizontal,\n [classes.rotateRightLabel]: side === 'right' && !rotatedToHorizontal,\n [classes.editLabel]: rotatedToHorizontal,\n [classes.customBottom]: isChartBottomLabel || isDefineChartBottomLabel,\n [classes.displayNone]: disabledLabel && !isChart && isEmptyString(extractTextFromHTML(text)),\n })}\n style={rotatedToHorizontal ? rotatedStyle : defaultStyle}\n onClick={rotateLabel}\n >\n {disabledLabel ? (\n <div className={classes.disabledLabel} dangerouslySetInnerHTML={{ __html: text || '' }} />\n ) : (\n <EditableHtml\n markup={text || ''}\n onChange={onChange}\n placeholder={!disabledLabel && placeholder}\n toolbarOpts={{\n position: side === 'bottom' ? 'top' : 'bottom',\n noPadding: true,\n noBorder: true,\n }}\n disableScrollbar\n activePlugins={activePlugins}\n onDone={() => setRotatedToHorizontal(false)}\n mathMlOptions={mathMlOptions}\n charactersLimit={charactersLimit}\n />\n )}\n </div>\n </Readable>\n );\n};\nLabelComponent.propTypes = {\n classes: PropTypes.object,\n disabledLabel: PropTypes.bool,\n graphHeight: PropTypes.number,\n graphWidth: PropTypes.number,\n isChartBottomLabel: PropTypes.bool,\n isDefineChartBottomLabel: PropTypes.bool,\n isChartLeftLabel: PropTypes.bool,\n isDefineChartLeftLabel: PropTypes.bool,\n placeholder: PropTypes.string,\n text: PropTypes.string,\n side: PropTypes.string,\n onChange: PropTypes.func,\n mathMlOptions: PropTypes.object,\n charactersLimit: PropTypes.number,\n titleHeight: PropTypes.number,\n};\n\nexport default withStyles((theme) => ({\n label: {\n fill: color.secondary(),\n },\n axisLabel: {\n fontSize: theme.typography.fontSize - 2,\n textAlign: 'center',\n margin: theme.spacing.unit / 2,\n padding: `${theme.spacing.unit / 2}px 0`,\n },\n chartLabel: {\n fontSize: theme.typography.fontSize + 2,\n textAlign: 'center',\n margin: theme.spacing.unit / 2,\n padding: `${theme.spacing.unit / 2}px 0`,\n },\n disabledLabel: {\n pointerEvents: 'none',\n width: '100%',\n },\n editLabel: {\n position: 'absolute',\n backgroundColor: 'white',\n borderRadius: '4px',\n boxShadow: '0px 5px 8px rgba(0, 0, 0, 0.15)',\n zIndex: 10,\n },\n rotateLeftLabel: {\n '-webkit-transform': 'rotate(-90deg)',\n transformOrigin: '0 0',\n transformStyle: 'preserve-3d',\n position: 'absolute',\n },\n rotateRightLabel: {\n '-webkit-transform': 'rotate(90deg)',\n transformOrigin: '0 0',\n transformStyle: 'preserve-3d',\n position: 'absolute',\n },\n customBottom: {\n position: 'absolute',\n },\n displayNone: {\n display: 'none',\n },\n}))(LabelComponent);\n"],"file":"label.js"}
|
package/lib/root.js
DELETED
|
@@ -1,422 +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"] = exports.Root = void 0;
|
|
9
|
-
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
17
|
-
|
|
18
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
19
|
-
|
|
20
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
-
|
|
22
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
-
|
|
24
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
25
|
-
|
|
26
|
-
var _react = _interopRequireDefault(require("react"));
|
|
27
|
-
|
|
28
|
-
var _types = require("./types");
|
|
29
|
-
|
|
30
|
-
var _styles = require("@material-ui/core/styles");
|
|
31
|
-
|
|
32
|
-
var _d3Selection = require("d3-selection");
|
|
33
|
-
|
|
34
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
35
|
-
|
|
36
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
37
|
-
|
|
38
|
-
var _editableHtml = _interopRequireDefault(require("@pie-lib/editable-html"));
|
|
39
|
-
|
|
40
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
41
|
-
|
|
42
|
-
var _label = _interopRequireDefault(require("./label"));
|
|
43
|
-
|
|
44
|
-
var _utils = require("./utils");
|
|
45
|
-
|
|
46
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
47
|
-
|
|
48
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
-
|
|
50
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
51
|
-
|
|
52
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
|
-
|
|
54
|
-
var Root = /*#__PURE__*/function (_React$Component) {
|
|
55
|
-
(0, _inherits2["default"])(Root, _React$Component);
|
|
56
|
-
|
|
57
|
-
var _super = _createSuper(Root);
|
|
58
|
-
|
|
59
|
-
function Root(props) {
|
|
60
|
-
var _this;
|
|
61
|
-
|
|
62
|
-
(0, _classCallCheck2["default"])(this, Root);
|
|
63
|
-
_this = _super.call(this, props);
|
|
64
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "mouseMove", function (g) {
|
|
65
|
-
var _this$props = _this.props,
|
|
66
|
-
graphProps = _this$props.graphProps,
|
|
67
|
-
onMouseMove = _this$props.onMouseMove;
|
|
68
|
-
|
|
69
|
-
if (!onMouseMove) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
var scale = graphProps.scale,
|
|
74
|
-
snap = graphProps.snap;
|
|
75
|
-
var coords = (0, _d3Selection.mouse)(g._groups[0][0]);
|
|
76
|
-
var x = scale.x.invert(coords[0]);
|
|
77
|
-
var y = scale.y.invert(coords[1]);
|
|
78
|
-
var snapped = {
|
|
79
|
-
x: snap.x(x),
|
|
80
|
-
y: snap.y(y)
|
|
81
|
-
};
|
|
82
|
-
onMouseMove(snapped);
|
|
83
|
-
});
|
|
84
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeLabel", function (newValue, side) {
|
|
85
|
-
var _this$props2 = _this.props,
|
|
86
|
-
labels = _this$props2.labels,
|
|
87
|
-
onChangeLabels = _this$props2.onChangeLabels,
|
|
88
|
-
isChart = _this$props2.isChart;
|
|
89
|
-
|
|
90
|
-
if (!onChangeLabels) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (isChart) {
|
|
95
|
-
if (side === 'left') {
|
|
96
|
-
onChangeLabels('range', newValue);
|
|
97
|
-
} else {
|
|
98
|
-
onChangeLabels('domain', newValue);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
onChangeLabels(_objectSpread(_objectSpread({}, labels), {}, (0, _defineProperty2["default"])({}, side, newValue)));
|
|
105
|
-
});
|
|
106
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "measureTitleHeight", function () {
|
|
107
|
-
var titleElement = document.getElementById('editable-title');
|
|
108
|
-
|
|
109
|
-
if (titleElement) {
|
|
110
|
-
var titleHeight = titleElement.clientHeight;
|
|
111
|
-
|
|
112
|
-
_this.setState({
|
|
113
|
-
titleHeight: titleHeight,
|
|
114
|
-
prevTitle: _this.props.title
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeyDown", function () {
|
|
119
|
-
setTimeout(_this.measureTitleHeight, 0);
|
|
120
|
-
});
|
|
121
|
-
_this.state = {
|
|
122
|
-
titleHeight: 0
|
|
123
|
-
};
|
|
124
|
-
return _this;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
(0, _createClass2["default"])(Root, [{
|
|
128
|
-
key: "componentDidMount",
|
|
129
|
-
value: function componentDidMount() {
|
|
130
|
-
var g = (0, _d3Selection.select)(this.g);
|
|
131
|
-
g.on('mousemove', this.mouseMove.bind(this, g));
|
|
132
|
-
this.measureTitleHeight();
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "componentWillUnmount",
|
|
136
|
-
value: function componentWillUnmount() {
|
|
137
|
-
var g = (0, _d3Selection.select)(this.g);
|
|
138
|
-
g.on('mousemove', null);
|
|
139
|
-
}
|
|
140
|
-
}, {
|
|
141
|
-
key: "componentDidUpdate",
|
|
142
|
-
value: function componentDidUpdate(prevProps) {
|
|
143
|
-
if (prevProps.title !== this.props.title) {
|
|
144
|
-
this.measureTitleHeight();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
key: "render",
|
|
149
|
-
value: function render() {
|
|
150
|
-
var _this2 = this;
|
|
151
|
-
|
|
152
|
-
var _this$props3 = this.props,
|
|
153
|
-
disabledTitle = _this$props3.disabledTitle,
|
|
154
|
-
disabledLabels = _this$props3.disabledLabels,
|
|
155
|
-
labels = _this$props3.labels,
|
|
156
|
-
labelsPlaceholders = _this$props3.labelsPlaceholders,
|
|
157
|
-
titlePlaceholder = _this$props3.titlePlaceholder,
|
|
158
|
-
graphProps = _this$props3.graphProps,
|
|
159
|
-
children = _this$props3.children,
|
|
160
|
-
classes = _this$props3.classes,
|
|
161
|
-
defineChart = _this$props3.defineChart,
|
|
162
|
-
onChangeTitle = _this$props3.onChangeTitle,
|
|
163
|
-
isChart = _this$props3.isChart,
|
|
164
|
-
showLabels = _this$props3.showLabels,
|
|
165
|
-
showPixelGuides = _this$props3.showPixelGuides,
|
|
166
|
-
showTitle = _this$props3.showTitle,
|
|
167
|
-
title = _this$props3.title,
|
|
168
|
-
rootRef = _this$props3.rootRef,
|
|
169
|
-
_this$props3$mathMlOp = _this$props3.mathMlOptions,
|
|
170
|
-
mathMlOptions = _this$props3$mathMlOp === void 0 ? {} : _this$props3$mathMlOp,
|
|
171
|
-
labelsCharactersLimit = _this$props3.labelsCharactersLimit;
|
|
172
|
-
var _graphProps$size = graphProps.size,
|
|
173
|
-
_graphProps$size$widt = _graphProps$size.width,
|
|
174
|
-
width = _graphProps$size$widt === void 0 ? 500 : _graphProps$size$widt,
|
|
175
|
-
_graphProps$size$heig = _graphProps$size.height,
|
|
176
|
-
height = _graphProps$size$heig === void 0 ? 500 : _graphProps$size$heig,
|
|
177
|
-
domain = graphProps.domain,
|
|
178
|
-
range = graphProps.range;
|
|
179
|
-
var topPadding = 40;
|
|
180
|
-
var leftPadding = (0, _utils.isEmptyString)((0, _utils.extractTextFromHTML)(labels === null || labels === void 0 ? void 0 : labels.left)) && (0, _utils.isEmptyObject)(labelsPlaceholders) ? 48 : 70;
|
|
181
|
-
var rightPadding = (0, _utils.isEmptyString)((0, _utils.extractTextFromHTML)(labels === null || labels === void 0 ? void 0 : labels.right)) && (0, _utils.isEmptyObject)(labelsPlaceholders) ? 48 : 70;
|
|
182
|
-
var finalWidth = width + leftPadding + rightPadding + (domain.padding || 0) * 2;
|
|
183
|
-
var finalHeight = height + topPadding * 2 + (range.padding || 0) * 2;
|
|
184
|
-
var activeTitlePlugins = ['bold', 'italic', 'underline', 'superscript', 'subscript', 'strikethrough', 'math' // 'languageCharacters'
|
|
185
|
-
];
|
|
186
|
-
var actualHeight = defineChart && showPixelGuides ? height - 160 : height;
|
|
187
|
-
var nbOfVerticalLines = parseInt(width / 100);
|
|
188
|
-
var nbOfHorizontalLines = parseInt(actualHeight / 100);
|
|
189
|
-
var sideGridlinesPadding = parseInt(actualHeight % 100);
|
|
190
|
-
var titleHeight = this.state.titleHeight;
|
|
191
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
192
|
-
className: classes.root
|
|
193
|
-
}, showPixelGuides && /*#__PURE__*/_react["default"].createElement("div", {
|
|
194
|
-
className: classes.topPixelGuides,
|
|
195
|
-
style: {
|
|
196
|
-
marginLeft: isChart ? 80 : showLabels ? 30 : 10
|
|
197
|
-
}
|
|
198
|
-
}, (0, _toConsumableArray2["default"])(Array(nbOfVerticalLines + 1).keys()).map(function (value) {
|
|
199
|
-
return /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
200
|
-
"false": true,
|
|
201
|
-
key: "top-guide-".concat(value)
|
|
202
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
203
|
-
className: classes.topPixelIndicator
|
|
204
|
-
}, /*#__PURE__*/_react["default"].createElement("div", null, value * 100, "px"), /*#__PURE__*/_react["default"].createElement("div", null, "|")));
|
|
205
|
-
})), showTitle && (disabledTitle ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
206
|
-
id: "editable-title",
|
|
207
|
-
style: _objectSpread(_objectSpread({}, isChart && {
|
|
208
|
-
width: finalWidth
|
|
209
|
-
}), (0, _utils.isEmptyString)((0, _utils.extractTextFromHTML)(title)) && {
|
|
210
|
-
display: 'none'
|
|
211
|
-
}),
|
|
212
|
-
className: (0, _classnames["default"])(isChart ? classes.chartTitle : classes.graphTitle, classes.disabledTitle),
|
|
213
|
-
dangerouslySetInnerHTML: {
|
|
214
|
-
__html: title || ''
|
|
215
|
-
}
|
|
216
|
-
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
217
|
-
id: "editable-title"
|
|
218
|
-
}, /*#__PURE__*/_react["default"].createElement(_editableHtml["default"], {
|
|
219
|
-
style: isChart && {
|
|
220
|
-
width: finalWidth
|
|
221
|
-
},
|
|
222
|
-
className: (0, _classnames["default"])((0, _defineProperty2["default"])({}, classes.rightMargin, showPixelGuides), isChart ? classes.chartTitle : classes.graphTitle),
|
|
223
|
-
markup: title || '',
|
|
224
|
-
onChange: onChangeTitle,
|
|
225
|
-
placeholder: defineChart && titlePlaceholder || !disabledTitle && 'Click here to add a title for this graph',
|
|
226
|
-
toolbarOpts: {
|
|
227
|
-
noPadding: true,
|
|
228
|
-
noBorder: true
|
|
229
|
-
},
|
|
230
|
-
activePlugins: activeTitlePlugins,
|
|
231
|
-
disableScrollbar: true,
|
|
232
|
-
onKeyDown: this.handleKeyDown
|
|
233
|
-
}))), showLabels && !isChart && /*#__PURE__*/_react["default"].createElement(_label["default"], {
|
|
234
|
-
side: "top",
|
|
235
|
-
text: labels.top,
|
|
236
|
-
disabledLabel: disabledLabels,
|
|
237
|
-
placeholder: labelsPlaceholders === null || labelsPlaceholders === void 0 ? void 0 : labelsPlaceholders.top,
|
|
238
|
-
graphHeight: finalHeight,
|
|
239
|
-
graphWidth: finalWidth,
|
|
240
|
-
onChange: function onChange(value) {
|
|
241
|
-
return _this2.onChangeLabel(value, 'top');
|
|
242
|
-
},
|
|
243
|
-
mathMlOptions: mathMlOptions,
|
|
244
|
-
charactersLimit: labelsCharactersLimit
|
|
245
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
246
|
-
className: classes.wrapper
|
|
247
|
-
}, showLabels && /*#__PURE__*/_react["default"].createElement(_label["default"], {
|
|
248
|
-
side: "left",
|
|
249
|
-
text: labels.left,
|
|
250
|
-
disabledLabel: disabledLabels,
|
|
251
|
-
placeholder: labelsPlaceholders === null || labelsPlaceholders === void 0 ? void 0 : labelsPlaceholders.left,
|
|
252
|
-
graphHeight: finalHeight,
|
|
253
|
-
graphWidth: finalWidth,
|
|
254
|
-
isChartLeftLabel: isChart && !defineChart,
|
|
255
|
-
isDefineChartLeftLabel: isChart && defineChart,
|
|
256
|
-
onChange: function onChange(value) {
|
|
257
|
-
return _this2.onChangeLabel(value, 'left');
|
|
258
|
-
},
|
|
259
|
-
mathMlOptions: mathMlOptions,
|
|
260
|
-
charactersLimit: labelsCharactersLimit
|
|
261
|
-
}), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
262
|
-
width: finalWidth,
|
|
263
|
-
height: finalHeight,
|
|
264
|
-
className: defineChart ? classes.defineChart : classes.chart
|
|
265
|
-
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
266
|
-
ref: function ref(r) {
|
|
267
|
-
_this2.g = r;
|
|
268
|
-
|
|
269
|
-
if (rootRef) {
|
|
270
|
-
rootRef(r);
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
className: classes.graphBox,
|
|
274
|
-
transform: "translate(".concat(leftPadding + (domain.padding || 0), ", ").concat(topPadding + (range.padding || 0), ")")
|
|
275
|
-
}, children)), showLabels && !isChart && /*#__PURE__*/_react["default"].createElement(_label["default"], {
|
|
276
|
-
side: "right",
|
|
277
|
-
text: labels.right,
|
|
278
|
-
disabledLabel: disabledLabels,
|
|
279
|
-
placeholder: labelsPlaceholders === null || labelsPlaceholders === void 0 ? void 0 : labelsPlaceholders.right,
|
|
280
|
-
graphHeight: finalHeight,
|
|
281
|
-
graphWidth: finalWidth,
|
|
282
|
-
onChange: function onChange(value) {
|
|
283
|
-
return _this2.onChangeLabel(value, 'right');
|
|
284
|
-
},
|
|
285
|
-
mathMlOptions: mathMlOptions,
|
|
286
|
-
charactersLimit: labelsCharactersLimit
|
|
287
|
-
}), showPixelGuides && /*#__PURE__*/_react["default"].createElement("div", {
|
|
288
|
-
className: classes.sidePixelGuides,
|
|
289
|
-
style: {
|
|
290
|
-
paddingTop: sideGridlinesPadding,
|
|
291
|
-
marginTop: 31
|
|
292
|
-
}
|
|
293
|
-
}, (0, _toConsumableArray2["default"])(Array(nbOfHorizontalLines + 1).keys()).reverse().map(function (value) {
|
|
294
|
-
return /*#__PURE__*/_react["default"].createElement(_renderUi.Readable, {
|
|
295
|
-
"false": true,
|
|
296
|
-
key: "top-guide-".concat(value)
|
|
297
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
298
|
-
className: classes.sidePixelIndicator
|
|
299
|
-
}, "\u2501 ", value * 100, "px"));
|
|
300
|
-
}))), showLabels && /*#__PURE__*/_react["default"].createElement(_label["default"], {
|
|
301
|
-
side: "bottom",
|
|
302
|
-
text: labels.bottom,
|
|
303
|
-
disabledLabel: disabledLabels,
|
|
304
|
-
placeholder: labelsPlaceholders === null || labelsPlaceholders === void 0 ? void 0 : labelsPlaceholders.bottom,
|
|
305
|
-
graphHeight: finalHeight,
|
|
306
|
-
graphWidth: finalWidth,
|
|
307
|
-
titleHeight: titleHeight,
|
|
308
|
-
isChartBottomLabel: isChart && !defineChart,
|
|
309
|
-
isDefineChartBottomLabel: isChart && defineChart,
|
|
310
|
-
onChange: function onChange(value) {
|
|
311
|
-
return _this2.onChangeLabel(value, 'bottom');
|
|
312
|
-
},
|
|
313
|
-
mathMlOptions: mathMlOptions,
|
|
314
|
-
charactersLimit: labelsCharactersLimit
|
|
315
|
-
}));
|
|
316
|
-
}
|
|
317
|
-
}]);
|
|
318
|
-
return Root;
|
|
319
|
-
}(_react["default"].Component); // use default color theme style to avoid color contrast issues
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
exports.Root = Root;
|
|
323
|
-
(0, _defineProperty2["default"])(Root, "propTypes", {
|
|
324
|
-
title: _propTypes["default"].string,
|
|
325
|
-
children: _types.ChildrenType,
|
|
326
|
-
defineChart: _propTypes["default"].bool,
|
|
327
|
-
disabledLabels: _propTypes["default"].bool,
|
|
328
|
-
disabledTitle: _propTypes["default"].bool,
|
|
329
|
-
graphProps: _types.GraphPropsType.isRequired,
|
|
330
|
-
isChart: _propTypes["default"].bool,
|
|
331
|
-
labels: _propTypes["default"].object,
|
|
332
|
-
labelsPlaceholders: _propTypes["default"].object,
|
|
333
|
-
onChangeTitle: _propTypes["default"].func,
|
|
334
|
-
onMouseMove: _propTypes["default"].func,
|
|
335
|
-
classes: _propTypes["default"].object.isRequired,
|
|
336
|
-
showLabels: _propTypes["default"].bool,
|
|
337
|
-
showTitle: _propTypes["default"].bool,
|
|
338
|
-
showPixelGuides: _propTypes["default"].bool,
|
|
339
|
-
rootRef: _propTypes["default"].func,
|
|
340
|
-
onChangeLabels: _propTypes["default"].func,
|
|
341
|
-
titlePlaceholder: _propTypes["default"].string,
|
|
342
|
-
mathMlOptions: _propTypes["default"].object,
|
|
343
|
-
labelsCharactersLimit: _propTypes["default"].number
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
var styles = function styles(theme) {
|
|
347
|
-
return {
|
|
348
|
-
root: {
|
|
349
|
-
border: "solid 1px ".concat(_renderUi.color.primaryLight()),
|
|
350
|
-
color: _renderUi.color.defaults.TEXT,
|
|
351
|
-
backgroundColor: theme.palette.common.white,
|
|
352
|
-
touchAction: 'none',
|
|
353
|
-
position: 'relative'
|
|
354
|
-
},
|
|
355
|
-
wrapper: {
|
|
356
|
-
display: 'flex',
|
|
357
|
-
position: 'relative'
|
|
358
|
-
},
|
|
359
|
-
svg: {},
|
|
360
|
-
defineChart: {
|
|
361
|
-
paddingLeft: '50px',
|
|
362
|
-
overflow: 'visible'
|
|
363
|
-
},
|
|
364
|
-
chart: {
|
|
365
|
-
overflow: 'visible'
|
|
366
|
-
},
|
|
367
|
-
graphBox: {
|
|
368
|
-
cursor: 'pointer',
|
|
369
|
-
userSelect: 'none'
|
|
370
|
-
},
|
|
371
|
-
graphTitle: {
|
|
372
|
-
color: _renderUi.color.defaults.TEXT,
|
|
373
|
-
fontSize: theme.typography.fontSize + 2,
|
|
374
|
-
padding: "".concat(theme.spacing.unit * 1.5, "px ").concat(theme.spacing.unit / 2, "px 0"),
|
|
375
|
-
textAlign: 'center'
|
|
376
|
-
},
|
|
377
|
-
chartTitle: {
|
|
378
|
-
color: _renderUi.color.defaults.TEXT,
|
|
379
|
-
fontSize: theme.typography.fontSize + 4,
|
|
380
|
-
padding: "".concat(theme.spacing.unit * 1.5, "px ").concat(theme.spacing.unit / 2, "px 0"),
|
|
381
|
-
textAlign: 'center'
|
|
382
|
-
},
|
|
383
|
-
disabledTitle: {
|
|
384
|
-
pointerEvents: 'none'
|
|
385
|
-
},
|
|
386
|
-
rightMargin: {
|
|
387
|
-
marginRight: '74px'
|
|
388
|
-
},
|
|
389
|
-
topPixelGuides: {
|
|
390
|
-
display: 'flex',
|
|
391
|
-
paddingTop: '6px'
|
|
392
|
-
},
|
|
393
|
-
topPixelIndicator: {
|
|
394
|
-
display: 'flex',
|
|
395
|
-
flexDirection: 'column',
|
|
396
|
-
alignItems: 'center',
|
|
397
|
-
width: '100px',
|
|
398
|
-
pointerEvents: 'none',
|
|
399
|
-
userSelect: 'none'
|
|
400
|
-
},
|
|
401
|
-
sidePixelGuides: {
|
|
402
|
-
width: '70px',
|
|
403
|
-
display: 'flex',
|
|
404
|
-
flexDirection: 'column',
|
|
405
|
-
marginRight: '6px'
|
|
406
|
-
},
|
|
407
|
-
sidePixelIndicator: {
|
|
408
|
-
textAlign: 'right',
|
|
409
|
-
height: '20px',
|
|
410
|
-
pointerEvents: 'none',
|
|
411
|
-
userSelect: 'none',
|
|
412
|
-
'&:not(:last-child)': {
|
|
413
|
-
marginBottom: '80px'
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
};
|
|
418
|
-
|
|
419
|
-
var _default = (0, _styles.withStyles)(styles)(Root);
|
|
420
|
-
|
|
421
|
-
exports["default"] = _default;
|
|
422
|
-
//# sourceMappingURL=root.js.map
|
package/lib/root.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/root.jsx"],"names":["Root","props","g","graphProps","onMouseMove","scale","snap","coords","_groups","x","invert","y","snapped","newValue","side","labels","onChangeLabels","isChart","titleElement","document","getElementById","titleHeight","clientHeight","setState","prevTitle","title","setTimeout","measureTitleHeight","state","on","mouseMove","bind","prevProps","disabledTitle","disabledLabels","labelsPlaceholders","titlePlaceholder","children","classes","defineChart","onChangeTitle","showLabels","showPixelGuides","showTitle","rootRef","mathMlOptions","labelsCharactersLimit","size","width","height","domain","range","topPadding","leftPadding","left","rightPadding","right","finalWidth","padding","finalHeight","activeTitlePlugins","actualHeight","nbOfVerticalLines","parseInt","nbOfHorizontalLines","sideGridlinesPadding","root","topPixelGuides","marginLeft","Array","keys","map","value","topPixelIndicator","display","chartTitle","graphTitle","__html","rightMargin","noPadding","noBorder","handleKeyDown","top","onChangeLabel","wrapper","chart","r","graphBox","sidePixelGuides","paddingTop","marginTop","reverse","sidePixelIndicator","bottom","React","Component","PropTypes","string","ChildrenType","bool","GraphPropsType","isRequired","object","func","number","styles","theme","border","color","primaryLight","defaults","TEXT","backgroundColor","palette","common","white","touchAction","position","svg","paddingLeft","overflow","cursor","userSelect","fontSize","typography","spacing","unit","textAlign","pointerEvents","marginRight","flexDirection","alignItems","marginBottom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,I;;;;;AACX,gBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,kGA8BP,UAACC,CAAD,EAAO;AACjB,wBAAoC,MAAKD,KAAzC;AAAA,UAAQE,UAAR,eAAQA,UAAR;AAAA,UAAoBC,WAApB,eAAoBA,WAApB;;AAEA,UAAI,CAACA,WAAL,EAAkB;AAChB;AACD;;AAED,UAAQC,KAAR,GAAwBF,UAAxB,CAAQE,KAAR;AAAA,UAAeC,IAAf,GAAwBH,UAAxB,CAAeG,IAAf;AACA,UAAMC,MAAM,GAAG,wBAAML,CAAC,CAACM,OAAF,CAAU,CAAV,EAAa,CAAb,CAAN,CAAf;AACA,UAAMC,CAAC,GAAGJ,KAAK,CAACI,CAAN,CAAQC,MAAR,CAAeH,MAAM,CAAC,CAAD,CAArB,CAAV;AACA,UAAMI,CAAC,GAAGN,KAAK,CAACM,CAAN,CAAQD,MAAR,CAAeH,MA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SAAS,EAAE;AAJD,KA9Ba;AAoCzB9F,IAAAA,aAAa,EAAE;AACb+F,MAAAA,aAAa,EAAE;AADF,KApCU;AAuCzBlD,IAAAA,WAAW,EAAE;AACXmD,MAAAA,WAAW,EAAE;AADF,KAvCY;AA0CzB9D,IAAAA,cAAc,EAAE;AACdO,MAAAA,OAAO,EAAE,MADK;AAEde,MAAAA,UAAU,EAAE;AAFE,KA1CS;AA8CzBhB,IAAAA,iBAAiB,EAAE;AACjBC,MAAAA,OAAO,EAAE,MADQ;AAEjBwD,MAAAA,aAAa,EAAE,QAFE;AAGjBC,MAAAA,UAAU,EAAE,QAHK;AAIjBnF,MAAAA,KAAK,EAAE,OAJU;AAKjBgF,MAAAA,aAAa,EAAE,MALE;AAMjBN,MAAAA,UAAU,EAAE;AANK,KA9CM;AAsDzBlC,IAAAA,eAAe,EAAE;AACfxC,MAAAA,KAAK,EAAE,MADQ;AAEf0B,MAAAA,OAAO,EAAE,MAFM;AAGfwD,MAAAA,aAAa,EAAE,QAHA;AAIfD,MAAAA,WAAW,EAAE;AAJE,KAtDQ;AA4DzBrC,IAAAA,kBAAkB,EAAE;AAClBmC,MAAAA,SAAS,EAAE,OADO;AAElB9E,MAAAA,MAAM,EAAE,MAFU;AAGlB+E,MAAAA,aAAa,EAAE,MAHG;AAIlBN,MAAAA,UAAU,EAAE,MAJM;AAMlB,4BAAsB;AACpBU,QAAAA,YAAY,EAAE;AADM;AANJ;AA5DK,GAAZ;AAAA,CAAf;;eAwEe,wBAAW3B,MAAX,EAAmBzG,IAAnB,C","sourcesContent":["import React from 'react';\nimport { ChildrenType } from './types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { select, mouse } from 'd3-selection';\nimport PropTypes from 'prop-types';\nimport { GraphPropsType } from './types';\nimport { color, Readable } from '@pie-lib/render-ui';\nimport EditableHtml from '@pie-lib/editable-html';\nimport cn from 'classnames';\nimport Label from './label';\nimport { extractTextFromHTML, isEmptyObject, isEmptyString } from './utils';\n\nexport class Root extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n titleHeight: 0,\n };\n }\n\n static propTypes = {\n title: PropTypes.string,\n children: ChildrenType,\n defineChart: PropTypes.bool,\n disabledLabels: PropTypes.bool,\n disabledTitle: PropTypes.bool,\n graphProps: GraphPropsType.isRequired,\n isChart: PropTypes.bool,\n labels: PropTypes.object,\n labelsPlaceholders: PropTypes.object,\n onChangeTitle: PropTypes.func,\n onMouseMove: PropTypes.func,\n classes: PropTypes.object.isRequired,\n showLabels: PropTypes.bool,\n showTitle: PropTypes.bool,\n showPixelGuides: PropTypes.bool,\n rootRef: PropTypes.func,\n onChangeLabels: PropTypes.func,\n titlePlaceholder: PropTypes.string,\n mathMlOptions: PropTypes.object,\n labelsCharactersLimit: PropTypes.number,\n };\n\n mouseMove = (g) => {\n const { graphProps, onMouseMove } = this.props;\n\n if (!onMouseMove) {\n return;\n }\n\n const { scale, snap } = graphProps;\n const coords = mouse(g._groups[0][0]);\n const x = scale.x.invert(coords[0]);\n const y = scale.y.invert(coords[1]);\n\n const snapped = {\n x: snap.x(x),\n y: snap.y(y),\n };\n\n onMouseMove(snapped);\n };\n\n componentDidMount() {\n const g = select(this.g);\n g.on('mousemove', this.mouseMove.bind(this, g));\n this.measureTitleHeight();\n }\n\n componentWillUnmount() {\n const g = select(this.g);\n g.on('mousemove', null);\n }\n\n componentDidUpdate(prevProps) {\n if (prevProps.title !== this.props.title) {\n this.measureTitleHeight();\n }\n }\n\n onChangeLabel = (newValue, side) => {\n const { labels, onChangeLabels, isChart } = this.props;\n\n if (!onChangeLabels) {\n return;\n }\n\n if (isChart) {\n if (side === 'left') {\n onChangeLabels('range', newValue);\n } else {\n onChangeLabels('domain', newValue);\n }\n\n return;\n }\n\n onChangeLabels({\n ...labels,\n [side]: newValue,\n });\n };\n\n measureTitleHeight = () => {\n const titleElement = document.getElementById('editable-title');\n if (titleElement) {\n const titleHeight = titleElement.clientHeight;\n this.setState({ titleHeight, prevTitle: this.props.title });\n }\n };\n\n handleKeyDown = () => {\n setTimeout(this.measureTitleHeight, 0);\n };\n\n render() {\n const {\n disabledTitle,\n disabledLabels,\n labels,\n labelsPlaceholders,\n titlePlaceholder,\n graphProps,\n children,\n classes,\n defineChart,\n onChangeTitle,\n isChart,\n showLabels,\n showPixelGuides,\n showTitle,\n title,\n rootRef,\n mathMlOptions = {},\n labelsCharactersLimit,\n } = this.props;\n const {\n size: { width = 500, height = 500 },\n domain,\n range,\n } = graphProps;\n\n const topPadding = 40;\n const leftPadding = isEmptyString(extractTextFromHTML(labels?.left)) && isEmptyObject(labelsPlaceholders) ? 48 : 70;\n const rightPadding =\n isEmptyString(extractTextFromHTML(labels?.right)) && isEmptyObject(labelsPlaceholders) ? 48 : 70;\n const finalWidth = width + leftPadding + rightPadding + (domain.padding || 0) * 2;\n const finalHeight = height + topPadding * 2 + (range.padding || 0) * 2;\n\n const activeTitlePlugins = [\n 'bold',\n 'italic',\n 'underline',\n 'superscript',\n 'subscript',\n 'strikethrough',\n 'math',\n // 'languageCharacters'\n ];\n\n const actualHeight = defineChart && showPixelGuides ? height - 160 : height;\n const nbOfVerticalLines = parseInt(width / 100);\n const nbOfHorizontalLines = parseInt(actualHeight / 100);\n const sideGridlinesPadding = parseInt(actualHeight % 100);\n const { titleHeight } = this.state;\n return (\n <div className={classes.root}>\n {showPixelGuides && (\n <div className={classes.topPixelGuides} style={{ marginLeft: isChart ? 80 : showLabels ? 30 : 10 }}>\n {[...Array(nbOfVerticalLines + 1).keys()].map((value) => (\n <Readable false key={`top-guide-${value}`}>\n <div className={classes.topPixelIndicator}>\n <div>{value * 100}px</div>\n <div>|</div>\n </div>\n </Readable>\n ))}\n </div>\n )}\n {showTitle &&\n (disabledTitle ? (\n <div\n id=\"editable-title\"\n style={{\n ...(isChart && { width: finalWidth }),\n ...(isEmptyString(extractTextFromHTML(title)) && { display: 'none' }),\n }}\n className={cn(isChart ? classes.chartTitle : classes.graphTitle, classes.disabledTitle)}\n dangerouslySetInnerHTML={{ __html: title || '' }}\n />\n ) : (\n <div id=\"editable-title\">\n <EditableHtml\n style={\n isChart && {\n width: finalWidth,\n }\n }\n className={cn(\n { [classes.rightMargin]: showPixelGuides },\n isChart ? classes.chartTitle : classes.graphTitle,\n )}\n markup={title || ''}\n onChange={onChangeTitle}\n placeholder={\n (defineChart && titlePlaceholder) || (!disabledTitle && 'Click here to add a title for this graph')\n }\n toolbarOpts={{ noPadding: true, noBorder: true }}\n activePlugins={activeTitlePlugins}\n disableScrollbar\n onKeyDown={this.handleKeyDown}\n />\n </div>\n ))}\n {showLabels && !isChart && (\n <Label\n side=\"top\"\n text={labels.top}\n disabledLabel={disabledLabels}\n placeholder={labelsPlaceholders?.top}\n graphHeight={finalHeight}\n graphWidth={finalWidth}\n onChange={(value) => this.onChangeLabel(value, 'top')}\n mathMlOptions={mathMlOptions}\n charactersLimit={labelsCharactersLimit}\n />\n )}\n <div className={classes.wrapper}>\n {showLabels && (\n <Label\n side=\"left\"\n text={labels.left}\n disabledLabel={disabledLabels}\n placeholder={labelsPlaceholders?.left}\n graphHeight={finalHeight}\n graphWidth={finalWidth}\n isChartLeftLabel={isChart && !defineChart}\n isDefineChartLeftLabel={isChart && defineChart}\n onChange={(value) => this.onChangeLabel(value, 'left')}\n mathMlOptions={mathMlOptions}\n charactersLimit={labelsCharactersLimit}\n />\n )}\n <svg width={finalWidth} height={finalHeight} className={defineChart ? classes.defineChart : classes.chart}>\n <g\n ref={(r) => {\n this.g = r;\n if (rootRef) {\n rootRef(r);\n }\n }}\n className={classes.graphBox}\n transform={`translate(${leftPadding + (domain.padding || 0)}, ${topPadding + (range.padding || 0)})`}\n >\n {children}\n </g>\n </svg>\n {showLabels && !isChart && (\n <Label\n side=\"right\"\n text={labels.right}\n disabledLabel={disabledLabels}\n placeholder={labelsPlaceholders?.right}\n graphHeight={finalHeight}\n graphWidth={finalWidth}\n onChange={(value) => this.onChangeLabel(value, 'right')}\n mathMlOptions={mathMlOptions}\n charactersLimit={labelsCharactersLimit}\n />\n )}\n {showPixelGuides && (\n <div\n className={classes.sidePixelGuides}\n style={{\n paddingTop: sideGridlinesPadding,\n marginTop: 31,\n }}\n >\n {[...Array(nbOfHorizontalLines + 1).keys()].reverse().map((value) => (\n <Readable false key={`top-guide-${value}`}>\n <div className={classes.sidePixelIndicator}>━ {value * 100}px</div>\n </Readable>\n ))}\n </div>\n )}\n </div>\n {showLabels && (\n <Label\n side=\"bottom\"\n text={labels.bottom}\n disabledLabel={disabledLabels}\n placeholder={labelsPlaceholders?.bottom}\n graphHeight={finalHeight}\n graphWidth={finalWidth}\n titleHeight={titleHeight}\n isChartBottomLabel={isChart && !defineChart}\n isDefineChartBottomLabel={isChart && defineChart}\n onChange={(value) => this.onChangeLabel(value, 'bottom')}\n mathMlOptions={mathMlOptions}\n charactersLimit={labelsCharactersLimit}\n />\n )}\n </div>\n );\n }\n}\n\n// use default color theme style to avoid color contrast issues\nconst styles = (theme) => ({\n root: {\n border: `solid 1px ${color.primaryLight()}`,\n color: color.defaults.TEXT,\n backgroundColor: theme.palette.common.white,\n touchAction: 'none',\n position: 'relative',\n },\n wrapper: {\n display: 'flex',\n position: 'relative',\n },\n svg: {},\n defineChart: {\n paddingLeft: '50px',\n overflow: 'visible',\n },\n chart: {\n overflow: 'visible',\n },\n graphBox: {\n cursor: 'pointer',\n userSelect: 'none',\n },\n graphTitle: {\n color: color.defaults.TEXT,\n fontSize: theme.typography.fontSize + 2,\n padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit / 2}px 0`,\n textAlign: 'center',\n },\n chartTitle: {\n color: color.defaults.TEXT,\n fontSize: theme.typography.fontSize + 4,\n padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit / 2}px 0`,\n textAlign: 'center',\n },\n disabledTitle: {\n pointerEvents: 'none',\n },\n rightMargin: {\n marginRight: '74px',\n },\n topPixelGuides: {\n display: 'flex',\n paddingTop: '6px',\n },\n topPixelIndicator: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n width: '100px',\n pointerEvents: 'none',\n userSelect: 'none',\n },\n sidePixelGuides: {\n width: '70px',\n display: 'flex',\n flexDirection: 'column',\n marginRight: '6px',\n },\n sidePixelIndicator: {\n textAlign: 'right',\n height: '20px',\n pointerEvents: 'none',\n userSelect: 'none',\n\n '&:not(:last-child)': {\n marginBottom: '80px',\n },\n },\n});\n\nexport default withStyles(styles)(Root);\n"],"file":"root.js"}
|