@pie-lib/math-input 6.6.7 → 6.6.10
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 +27 -0
- package/lib/horizontal-keypad.js +20 -15
- package/lib/horizontal-keypad.js.map +1 -1
- package/lib/index.js +11 -6
- package/lib/index.js.map +1 -1
- package/lib/keypad/index.js +76 -33
- package/lib/keypad/index.js.map +1 -1
- package/lib/keypad/keys-layout.js +5 -1
- package/lib/keypad/keys-layout.js.map +1 -1
- package/lib/keys/basic-operators.js +1 -1
- package/lib/keys/chars.js +1 -1
- package/lib/keys/comparison.js +4 -4
- package/lib/keys/comparison.js.map +1 -1
- package/lib/keys/constants.js +1 -1
- package/lib/keys/exponent.js +1 -1
- package/lib/keys/fractions.js +1 -1
- package/lib/keys/geometry.js +4 -4
- package/lib/keys/geometry.js.map +1 -1
- package/lib/keys/grades.js +16 -8
- package/lib/keys/grades.js.map +1 -1
- package/lib/keys/index.js +6 -2
- package/lib/keys/index.js.map +1 -1
- package/lib/keys/log.js +1 -1
- package/lib/keys/logic.js +1 -1
- package/lib/keys/matrices.js +1 -1
- package/lib/keys/misc.js +1 -1
- package/lib/keys/statistics.js +1 -1
- package/lib/keys/sub-sup.js +1 -1
- package/lib/keys/trigonometry.js +1 -1
- package/lib/keys/utils.js +13 -9
- package/lib/keys/utils.js.map +1 -1
- package/lib/keys/vars.js +1 -1
- package/lib/math-input.js +22 -16
- package/lib/math-input.js.map +1 -1
- package/lib/mq/input.js +16 -14
- package/lib/mq/input.js.map +1 -1
- package/lib/mq/static.js +16 -14
- package/lib/mq/static.js.map +1 -1
- package/package.json +2 -2
- package/src/horizontal-keypad.jsx +3 -1
- package/src/keypad/index.jsx +51 -5
- package/src/keys/grades.js +3 -3
package/lib/math-input.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -21,43 +23,47 @@ var _keypad = _interopRequireDefault(require("./keypad"));
|
|
|
21
23
|
|
|
22
24
|
var _debug = _interopRequireDefault(require("debug"));
|
|
23
25
|
|
|
24
|
-
function
|
|
26
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
27
|
|
|
26
|
-
function
|
|
28
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
29
|
|
|
28
|
-
function
|
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
31
|
|
|
30
32
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
33
|
|
|
32
34
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
33
35
|
|
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
37
|
|
|
36
|
-
function
|
|
38
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
39
|
|
|
38
|
-
function
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
+
|
|
42
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
43
|
+
|
|
44
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
39
45
|
|
|
40
46
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
47
|
|
|
42
|
-
function
|
|
48
|
+
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; } }
|
|
43
49
|
|
|
44
|
-
function
|
|
50
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
45
51
|
|
|
46
52
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
47
53
|
|
|
48
54
|
var log = (0, _debug["default"])('pie-lib:math-input');
|
|
49
55
|
|
|
50
|
-
var MathInput =
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
function (_React$Component) {
|
|
56
|
+
var MathInput = /*#__PURE__*/function (_React$Component) {
|
|
53
57
|
_inherits(MathInput, _React$Component);
|
|
54
58
|
|
|
59
|
+
var _super = _createSuper(MathInput);
|
|
60
|
+
|
|
55
61
|
function MathInput(props) {
|
|
56
62
|
var _this;
|
|
57
63
|
|
|
58
64
|
_classCallCheck(this, MathInput);
|
|
59
65
|
|
|
60
|
-
_this =
|
|
66
|
+
_this = _super.call(this, props);
|
|
61
67
|
|
|
62
68
|
_defineProperty(_assertThisInitialized(_this), "keypadPress", function (key) {
|
|
63
69
|
log('[keypadPress] key:', key);
|
|
@@ -117,9 +123,9 @@ function (_React$Component) {
|
|
|
117
123
|
var focused = this.state.focused;
|
|
118
124
|
var showKeypad = true; // TODO: add support for different displayModes - displayMode === 'block' || focused;
|
|
119
125
|
|
|
120
|
-
return _react["default"].createElement("div", {
|
|
126
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
121
127
|
className: (0, _classnames["default"])(classes.mathInput, className, focused && classes.focused)
|
|
122
|
-
}, _react["default"].createElement(mq.Input, {
|
|
128
|
+
}, /*#__PURE__*/_react["default"].createElement(mq.Input, {
|
|
123
129
|
className: classes.mqInput,
|
|
124
130
|
innerRef: function innerRef(r) {
|
|
125
131
|
return _this2.input = r;
|
|
@@ -128,9 +134,9 @@ function (_React$Component) {
|
|
|
128
134
|
onBlur: this.inputBlur,
|
|
129
135
|
latex: latex,
|
|
130
136
|
onChange: this.changeLatex
|
|
131
|
-
}), showKeypad && _react["default"].createElement("div", {
|
|
137
|
+
}), showKeypad && /*#__PURE__*/_react["default"].createElement("div", {
|
|
132
138
|
className: classes.pad
|
|
133
|
-
}, _react["default"].createElement(_keypad["default"], {
|
|
139
|
+
}, /*#__PURE__*/_react["default"].createElement(_keypad["default"], {
|
|
134
140
|
baseSet: _keys.baseSet,
|
|
135
141
|
additionalKeys: keyset,
|
|
136
142
|
onPress: this.keypadPress
|
package/lib/math-input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/math-input.jsx"],"names":["log","MathInput","props","key","input","latex","command","write","keystroke","setState","focused","l","onChange","state","classes","className","keyset","showKeypad","mathInput","mqInput","r","inputFocus","inputBlur","changeLatex","pad","baseSet","keypadPress","React","Component","PropTypes","object","isRequired","string","array","displayMode","oneOf","func","grey","styles","theme","formGroup","display","textAlign","width","borderRadius","border","marginTop","spacing","unit","marginBottom","transition","palette","primary","main","light","padding","outline","boxShadow","dark"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/math-input.jsx"],"names":["log","MathInput","props","key","input","latex","command","write","keystroke","setState","focused","l","onChange","state","classes","className","keyset","showKeypad","mathInput","mqInput","r","inputFocus","inputBlur","changeLatex","pad","baseSet","keypadPress","React","Component","PropTypes","object","isRequired","string","array","displayMode","oneOf","func","grey","styles","theme","formGroup","display","textAlign","width","borderRadius","border","marginTop","spacing","unit","marginBottom","transition","palette","primary","main","light","padding","outline","box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AAA,UAAU,EAAE,qBAHL;AAIPK,MAAAA,OAAO,EAAEhB,KAAK,CAACQ,OAAN,CAAcC,IAJhB;AAKP,sBAAgB;AACdQ,QAAAA,OAAO,EAAE,MADK;AAEdC,QAAAA,SAAS,EAAE,MAFG;AAGdZ,QAAAA,MAAM,sBAAeN,KAAK,CAACY,OAAN,CAAcC,OAAd,CAAsBM,IAArC;AAHQ;AALT;AApBc,GAAL;AAAA,CAApB;;eAgCe,wBAAWpB,MAAX,EAAmBrC,SAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport * as mq from './mq';\nimport { baseSet } from './keys';\nimport KeyPad from './keypad';\nimport debug from 'debug';\n\nconst log = debug('pie-lib:math-input');\n\nexport class MathInput extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n keyset: PropTypes.array,\n displayMode: PropTypes.oneOf(['block', 'block-on-focus']),\n latex: PropTypes.string,\n onChange: PropTypes.func\n };\n\n static defaultProps = {\n keyset: [],\n displayMode: 'block'\n };\n\n constructor(props) {\n super(props);\n this.state = {\n focused: false\n };\n }\n\n keypadPress = key => {\n log('[keypadPress] key:', key);\n\n if (!this.input) {\n return;\n }\n\n if (key.latex && !key.command) {\n this.input.write(key.latex);\n } else if (key.write) {\n this.input.write(key.write);\n } else if (key.command) {\n this.input.command(key.command);\n } else if (key.keystroke) {\n this.input.keystroke(key.keystroke);\n }\n };\n\n inputFocus = () => {\n this.setState({ focused: true });\n };\n\n inputBlur = () => {\n this.setState({ focused: false });\n };\n\n changeLatex = l => {\n const { onChange } = this.props;\n\n if (onChange && l !== this.props.latex) {\n log('[changeLatex]', l, this.props.latex);\n onChange(l);\n }\n };\n\n render() {\n const { classes, className, keyset, latex } = this.props;\n const { focused } = this.state;\n\n const showKeypad = true; // TODO: add support for different displayModes - displayMode === 'block' || focused;\n\n return (\n <div className={classNames(classes.mathInput, className, focused && classes.focused)}>\n <mq.Input\n className={classes.mqInput}\n innerRef={r => (this.input = r)}\n onFocus={this.inputFocus}\n onBlur={this.inputBlur}\n latex={latex}\n onChange={this.changeLatex}\n />\n {showKeypad && (\n <div className={classes.pad}>\n <KeyPad baseSet={baseSet} additionalKeys={keyset} onPress={this.keypadPress} />\n </div>\n )}\n </div>\n );\n }\n}\n\nconst grey = 'rgba(0, 0, 0, 0.23)';\nconst styles = theme => ({\n formGroup: {\n display: 'flex',\n textAlign: 'right',\n float: 'right'\n },\n pad: {\n width: '100%',\n display: 'flex'\n },\n mathInput: {\n borderRadius: '4px',\n border: `solid 1px ${grey}`,\n marginTop: theme.spacing.unit,\n marginBottom: theme.spacing.unit,\n transition: 'border 200ms linear'\n },\n focused: {\n border: `solid 1px ${theme.palette.primary.main}`\n },\n mqInput: {\n width: '100%',\n border: `solid 0px ${theme.palette.primary.light}`,\n transition: 'border 200ms linear',\n padding: theme.spacing.unit,\n '&.mq-focused': {\n outline: 'none',\n boxShadow: 'none',\n border: `solid 0px ${theme.palette.primary.dark}`\n }\n }\n});\nexport default withStyles(styles)(MathInput);\n"],"file":"math-input.js"}
|
package/lib/mq/input.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -21,23 +23,25 @@ var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
|
21
23
|
|
|
22
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
25
|
|
|
24
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
25
|
-
|
|
26
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
27
27
|
|
|
28
28
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
29
29
|
|
|
30
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
30
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
35
|
+
|
|
36
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
37
|
+
|
|
38
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
39
|
|
|
36
40
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
41
|
|
|
38
|
-
function
|
|
42
|
+
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; } }
|
|
39
43
|
|
|
40
|
-
function
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
45
|
|
|
42
46
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
47
|
|
|
@@ -56,14 +60,12 @@ var log = (0, _debug["default"])('math-input:mq:input');
|
|
|
56
60
|
* Wrapper for MathQuill MQ.MathField.
|
|
57
61
|
*/
|
|
58
62
|
|
|
59
|
-
var Input =
|
|
60
|
-
/*#__PURE__*/
|
|
61
|
-
function (_React$Component) {
|
|
63
|
+
var Input = /*#__PURE__*/function (_React$Component) {
|
|
62
64
|
_inherits(Input, _React$Component);
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
var _getPrototypeOf2;
|
|
66
|
+
var _super = _createSuper(Input);
|
|
66
67
|
|
|
68
|
+
function Input() {
|
|
67
69
|
var _this;
|
|
68
70
|
|
|
69
71
|
_classCallCheck(this, Input);
|
|
@@ -72,7 +74,7 @@ function (_React$Component) {
|
|
|
72
74
|
args[_key] = arguments[_key];
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
_this =
|
|
77
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
76
78
|
|
|
77
79
|
_defineProperty(_assertThisInitialized(_this), "onInputEdit", function () {
|
|
78
80
|
log('[onInputEdit] ...');
|
|
@@ -217,7 +219,7 @@ function (_React$Component) {
|
|
|
217
219
|
onBlur = _this$props.onBlur,
|
|
218
220
|
classes = _this$props.classes,
|
|
219
221
|
className = _this$props.className;
|
|
220
|
-
return _react["default"].createElement("span", {
|
|
222
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
221
223
|
className: (0, _classnames["default"])(classes.input, className),
|
|
222
224
|
onKeyPress: this.onKeyPress,
|
|
223
225
|
onClick: onClick,
|
package/lib/mq/input.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mq/input.jsx"],"names":["MQ","window","MathQuill","getInterface","registerEmbed","log","Input","onChange","props","mathField","latex","blur","focus","event","keys","Object","__controller","options","indexOf","refresh","charCode","write","onInputEdit","Error","MathField","input","handlers","edit","bind","updateLatex","v","Array","isArray","forEach","vv","cmd","keystroke","nextProps","onClick","onFocus","onBlur","classes","className","onKeyPress","r","React","Component","PropTypes","string","object","isRequired","func","styles"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/mq/input.jsx"],"names":["MQ","window","MathQuill","getInterface","registerEmbed","log","Input","onChange","props","mathField","latex","blur","focus","event","keys","Object","__controller","options","indexOf","refresh","charCode","write","onInputEdit","Error","MathField","input","handlers","edit","bind","updateLatex","v","Array","isArray","forEach","vv","cmd","keystroke","nextProps","onClick","onFocus","onBlur","classes","className","onKeyPress","r","React","Component","PropTypes","string","object","isRequired","func","styles"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AA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,sBAAUC,MALA;AAMjBT,EAAAA,OAAO,EAAEQ,sBAAUI,IANF;AAOjBX,EAAAA,MAAM,EAAEO,sBAAUI;AAPD,C;;AAyIrB,IAAMC,MAAM,GAAG,SAATA,MAAS;AAAA,SAAO,EAAP;AAAA,CAAf;;eAEe,wBAAWA,MAAX,EAAmB9C,KAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport debug from 'debug';\nimport classNames from 'classnames';\nimport { registerLineBreak } from './custom-elements';\nimport MathQuill from '@pie-framework/mathquill';\n\nlet MQ;\nif (typeof window !== 'undefined') {\n MQ = MathQuill.getInterface(2);\n\n if (MQ && MQ.registerEmbed) {\n registerLineBreak(MQ);\n }\n}\n\nconst log = debug('math-input:mq:input');\n\n/**\n * Wrapper for MathQuill MQ.MathField.\n */\nexport class Input extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object.isRequired,\n onClick: PropTypes.func,\n onChange: PropTypes.func,\n latex: PropTypes.string,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func\n };\n\n componentDidMount() {\n if (!MQ) {\n throw new Error('MQ is not defined - but component has mounted?');\n }\n\n this.mathField = MQ.MathField(this.input, {\n handlers: {\n edit: this.onInputEdit.bind(this)\n }\n });\n\n this.updateLatex();\n }\n\n componentDidUpdate() {\n this.updateLatex();\n }\n\n updateLatex() {\n if (!this.mathField) {\n return;\n }\n const { latex } = this.props;\n if (latex) {\n this.mathField.latex(latex);\n }\n }\n\n clear() {\n this.mathField.latex('');\n return '';\n }\n\n blur() {\n log('blur mathfield');\n this.mathField.blur();\n }\n\n focus() {\n log('focus mathfield...');\n this.mathField.focus();\n }\n\n command(v) {\n log('command: ', v);\n if (Array.isArray(v)) {\n v.forEach(vv => {\n this.mathField.cmd(vv);\n });\n } else {\n this.mathField.cmd(v);\n }\n this.mathField.focus();\n return this.mathField.latex();\n }\n\n keystroke(v) {\n this.mathField.keystroke(v);\n this.mathField.focus();\n return this.mathField.latex();\n }\n\n write(v) {\n log('write: ', v);\n this.mathField.write(v);\n this.mathField.focus();\n return this.mathField.latex();\n }\n\n onInputEdit = () => {\n log('[onInputEdit] ...');\n const { onChange } = this.props;\n if (!this.mathField) {\n return;\n }\n\n if (onChange) {\n onChange(this.mathField.latex());\n }\n };\n\n refresh = () => {\n this.blur();\n this.focus();\n };\n\n onKeyPress = event => {\n const keys = Object.keys(this.mathField.__controller.options);\n\n if (keys.indexOf('ignoreNextMousedown') < 0) {\n // It seems like the controller has the above handler as an option\n // when all the right events are set and everything works fine\n // this seems to work in all cases\n this.refresh();\n }\n\n if (event.charCode === 13) {\n // if enter's pressed, we're going for a custom embedded element that'll\n // have a block display (empty div) - for a hacked line break using ccs\n // all because mathquill doesn't support a line break\n this.write('\\\\embed{newLine}[]');\n this.onInputEdit();\n }\n };\n\n shouldComponentUpdate(nextProps) {\n log('next: ', nextProps.latex);\n log('current: ', this.mathField.latex());\n return nextProps.latex !== this.mathField.latex();\n }\n\n render() {\n const { onClick, onFocus, onBlur, classes, className } = this.props;\n\n return (\n <span\n className={classNames(classes.input, className)}\n onKeyPress={this.onKeyPress}\n onClick={onClick}\n onFocus={onFocus}\n onBlur={onBlur}\n ref={r => (this.input = r)}\n />\n );\n }\n}\n\nconst styles = () => ({});\n\nexport default withStyles(styles)(Input);\n"],"file":"input.js"}
|
package/lib/mq/static.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -17,23 +19,25 @@ var _index = require("../index");
|
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
21
|
|
|
20
|
-
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
21
|
-
|
|
22
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
23
|
|
|
24
24
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
25
|
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
+
|
|
32
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
+
|
|
34
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
35
|
|
|
32
36
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
37
|
|
|
34
|
-
function
|
|
38
|
+
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; } }
|
|
35
39
|
|
|
36
|
-
function
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
41
|
|
|
38
42
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
43
|
|
|
@@ -56,14 +60,12 @@ function stripSpaces() {
|
|
|
56
60
|
*/
|
|
57
61
|
|
|
58
62
|
|
|
59
|
-
var Static =
|
|
60
|
-
/*#__PURE__*/
|
|
61
|
-
function (_React$Component) {
|
|
63
|
+
var Static = /*#__PURE__*/function (_React$Component) {
|
|
62
64
|
_inherits(Static, _React$Component);
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
var _getPrototypeOf2;
|
|
66
|
+
var _super = _createSuper(Static);
|
|
66
67
|
|
|
68
|
+
function Static() {
|
|
67
69
|
var _this;
|
|
68
70
|
|
|
69
71
|
_classCallCheck(this, Static);
|
|
@@ -72,7 +74,7 @@ function (_React$Component) {
|
|
|
72
74
|
args[_key] = arguments[_key];
|
|
73
75
|
}
|
|
74
76
|
|
|
75
|
-
_this =
|
|
77
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
76
78
|
|
|
77
79
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
|
|
78
80
|
try {
|
|
@@ -193,7 +195,7 @@ function (_React$Component) {
|
|
|
193
195
|
var _this$props = this.props,
|
|
194
196
|
onBlur = _this$props.onBlur,
|
|
195
197
|
className = _this$props.className;
|
|
196
|
-
return _react["default"].createElement("span", {
|
|
198
|
+
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
197
199
|
className: className,
|
|
198
200
|
onFocus: this.onFocus,
|
|
199
201
|
onBlur: onBlur,
|
package/lib/mq/static.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mq/static.jsx"],"names":["MQ","window","MathQuill","getInterface","log","REGEX","WHITESPACE_REGEX","stripSpaces","string","replace","Static","e","rootBlock","target","parentElement","nextSibling","id","parseInt","getAttribute","innerField","mathField","innerFields","find","f","name","props","getFieldName","setInput","onSubFieldFocus","err","console","error","message","update","field","onSubFieldChange","latex","Error","StaticMath","input","handlers","edit","onInputEdit","bind","parseLatex","blur","focus","nextProps","parsedLatex","stripped","newFieldCount","match","length","out","trim","Object","keys","warn","onBlur","className","onFocus","r","React","Component","PropTypes","isRequired","func"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/mq/static.jsx"],"names":["MQ","window","MathQuill","getInterface","log","REGEX","WHITESPACE_REGEX","stripSpaces","string","replace","Static","e","rootBlock","target","parentElement","nextSibling","id","parseInt","getAttribute","innerField","mathField","innerFields","find","f","name","props","getFieldName","setInput","onSubFieldFocus","err","console","error","message","update","field","onSubFieldChange","latex","Error","StaticMath","input","handlers","edit","onInputEdit","bind","parseLatex","blur","focus","nextProps","parsedLatex","stripped","newFieldCount","match","length","out","trim","Object","keys","warn","onBlur","className","onFocus","r","React","Component","PropTypes","isRequired","func"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAIA,EAAJ;;AACA,IAAI,OAAOC,MAAP,KAAkB,WAAtB,EAAmC;AACjCD,EAAAA,EAAE,GAAGE,sBAAUC,YAAV,CAAuB,CAAvB,CAAL;AACD;;AAED,IAAMC,GAAG,GAAG,uBAAM,8BAAN,CAAZ;AACA,IAAMC,KAAK,GAAG,wCAAd;AACA,IAAMC,gBAAgB,GAAG,IAAzB;;AAEA,SAASC,WAAT,GAAkC;AAAA,MAAbC,MAAa,uEAAJ,EAAI;AAChC,SAAOA,MAAM,CAACC,OAAP,CAAeH,gBAAf,EAAiC,EAAjC,CAAP;AACD;AAED;AACA;AACA;;;IACqBI,M;;;;;;;;;;;;;;;;8DAqFT,UAAAC,CAAC,EAAI;AACb,UAAI;AACF,YAAIC,SAAS,GAAGD,CAAC,CAACE,MAAF,CAASC,aAAT,CAAuBC,WAAvC;AACA,YAAIC,EAAE,GAAGC,QAAQ,CAACL,SAAS,CAACM,YAAV,CAAuB,oBAAvB,CAAD,EAA+C,EAA/C,CAAjB;;AAEA,YAAI,CAACF,EAAL,EAAS;AACPJ,UAAAA,SAAS,GAAGA,SAAS,CAACE,aAAtB;AACAE,UAAAA,EAAE,GAAGC,QAAQ,CAACL,SAAS,CAACM,YAAV,CAAuB,oBAAvB,CAAD,EAA+C,EAA/C,CAAb;AACD;;AAED,YAAMC,UAAU,GAAG,MAAKC,SAAL,CAAeC,WAAf,CAA2BC,IAA3B,CAAgC,UAAAC,CAAC;AAAA,iBAAIA,CAAC,CAACP,EAAF,KAASA,EAAb;AAAA,SAAjC,CAAnB;;AAEA,YAAIG,UAAJ,EAAgB;AACd,cAAMK,IAAI,GAAG,MAAKC,KAAL,CAA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R;AAAA,UAAgBC,SAAhB,eAAgBA,SAAhB;AAEA,0BACE;AACE,QAAA,SAAS,EAAEA,SADb;AAEE,QAAA,OAAO,EAAE,KAAKC,OAFhB;AAGE,QAAA,MAAM,EAAEF,MAHV;AAIE,QAAA,GAAG,EAAE,aAAAG,CAAC;AAAA,iBAAK,MAAI,CAACtB,KAAL,GAAasB,CAAlB;AAAA;AAJR,QADF;AAQD;;;;EAzHiCC,kBAAMC,S;;;;gBAArBrD,M,eACA;AACjB0B,EAAAA,KAAK,EAAE4B,sBAAUxD,MAAV,CAAiByD,UADP;AAEjBL,EAAAA,OAAO,EAAEI,sBAAUE,IAFF;AAGjBR,EAAAA,MAAM,EAAEM,sBAAUE,IAHD;AAIjBP,EAAAA,SAAS,EAAEK,sBAAUxD,MAJJ;AAKjBkB,EAAAA,YAAY,EAAEsC,sBAAUE,IALP;AAMjB/B,EAAAA,gBAAgB,EAAE6B,sBAAUE,IANX;AAOjBtC,EAAAA,eAAe,EAAEoC,sBAAUE,IAPV;AAQjBvC,EAAAA,QAAQ,EAAEqC,sBAAUE;AARH,C","sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport MathQuill from '@pie-framework/mathquill';\nimport { updateSpans } from '../index';\n\nlet MQ;\nif (typeof window !== 'undefined') {\n MQ = MathQuill.getInterface(2);\n}\n\nconst log = debug('pie-lib:math-input:mq:static');\nconst REGEX = /\\\\MathQuillMathField\\[r\\d*\\]\\{(.*?)\\}/g;\nconst WHITESPACE_REGEX = / /g;\n\nfunction stripSpaces(string = '') {\n return string.replace(WHITESPACE_REGEX, '');\n}\n\n/**\n * Wrapper for MathQuill MQ.MathField.\n */\nexport default class Static extends React.Component {\n static propTypes = {\n latex: PropTypes.string.isRequired,\n onFocus: PropTypes.func,\n onBlur: PropTypes.func,\n className: PropTypes.string,\n getFieldName: PropTypes.func,\n onSubFieldChange: PropTypes.func,\n onSubFieldFocus: PropTypes.func,\n setInput: PropTypes.func\n };\n\n componentDidMount() {\n this.update();\n updateSpans();\n }\n\n componentDidUpdate() {\n this.update();\n updateSpans();\n }\n\n onInputEdit(field) {\n if (!this.mathField) {\n return;\n }\n const name = this.props.getFieldName(field, this.mathField.innerFields);\n if (this.props.onSubFieldChange) {\n this.props.onSubFieldChange(name, field.latex());\n }\n }\n\n update() {\n if (!MQ) {\n throw new Error('MQ is not defined - but component has mounted?');\n }\n // this.input.innerHTML = this.props.latex;\n if (!this.mathField) {\n this.mathField = MQ.StaticMath(this.input, {\n handlers: {\n edit: this.onInputEdit.bind(this)\n }\n });\n }\n\n try {\n this.mathField.parseLatex(this.props.latex);\n this.mathField.latex(this.props.latex);\n } catch (e) {\n // default latex if received has errors\n this.mathField.latex('\\\\MathQuillMathField[r1]{}');\n }\n }\n\n blur() {\n log('blur mathfield');\n this.mathField.blur();\n }\n\n focus() {\n log('focus mathfield...');\n this.mathField.focus();\n }\n\n shouldComponentUpdate(nextProps) {\n try {\n const parsedLatex = this.mathField.parseLatex(nextProps.latex);\n const stripped = stripSpaces(parsedLatex);\n const newFieldCount = (nextProps.latex.match(REGEX) || []).length;\n\n const out =\n stripped !== stripSpaces(this.mathField.latex().trim()) ||\n newFieldCount !== Object.keys(this.mathField.innerFields).length / 2;\n\n log('[shouldComponentUpdate] ', out);\n return out;\n } catch (e) {\n // eslint-disable-next-line no-console\n console.warn('Error parsing latex:', e.message, 'skip update');\n // eslint-disable-next-line no-console\n console.warn(e);\n return false;\n }\n }\n\n onFocus = e => {\n try {\n let rootBlock = e.target.parentElement.nextSibling;\n let id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);\n\n if (!id) {\n rootBlock = rootBlock.parentElement;\n id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);\n }\n\n const innerField = this.mathField.innerFields.find(f => f.id === id);\n\n if (innerField) {\n const name = this.props.getFieldName(innerField, this.mathField.innerFields);\n if (this.props.setInput) {\n this.props.setInput(innerField);\n }\n this.props.onSubFieldFocus(name, innerField);\n }\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error('error finding root block', err.message);\n }\n };\n\n render() {\n const { onBlur, className } = this.props;\n\n return (\n <span\n className={className}\n onFocus={this.onFocus}\n onBlur={onBlur}\n ref={r => (this.input = r)}\n />\n );\n }\n}\n"],"file":"static.js"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.6.
|
|
6
|
+
"version": "6.6.10",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"module": "src/index.jsx",
|
|
9
9
|
"dependencies": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"react-dom": "^16.9.0"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "531a7f4895323a9d524cfb96f7e26a5f1ab9f7c1"
|
|
26
26
|
}
|
|
@@ -18,6 +18,7 @@ export default class HorizontalKeypad extends React.Component {
|
|
|
18
18
|
static propTypes = {
|
|
19
19
|
className: PropTypes.string,
|
|
20
20
|
mode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
21
|
+
layoutForKeyPad: PropTypes.object,
|
|
21
22
|
onClick: PropTypes.func.isRequired,
|
|
22
23
|
onFocus: PropTypes.func,
|
|
23
24
|
noDecimal: PropTypes.bool,
|
|
@@ -37,7 +38,7 @@ export default class HorizontalKeypad extends React.Component {
|
|
|
37
38
|
};
|
|
38
39
|
|
|
39
40
|
render() {
|
|
40
|
-
const { mode, onFocus, noDecimal, className, additionalKeys } = this.props;
|
|
41
|
+
const { mode, onFocus, noDecimal, className, additionalKeys, layoutForKeyPad } = this.props;
|
|
41
42
|
const normalizedKeys = normalizeAdditionalKeys(additionalKeys);
|
|
42
43
|
|
|
43
44
|
return (
|
|
@@ -45,6 +46,7 @@ export default class HorizontalKeypad extends React.Component {
|
|
|
45
46
|
className={className}
|
|
46
47
|
onFocus={onFocus}
|
|
47
48
|
noDecimal={noDecimal}
|
|
49
|
+
layoutForKeyPad={layoutForKeyPad}
|
|
48
50
|
additionalKeys={extendKeySet(keysForGrade(mode), normalizedKeys)}
|
|
49
51
|
onPress={this.keypadPress}
|
|
50
52
|
mode={mode}
|
package/src/keypad/index.jsx
CHANGED
|
@@ -145,6 +145,20 @@ const LatexButton = withStyles(theme => ({
|
|
|
145
145
|
} else {
|
|
146
146
|
buttonClass = classNames(props.classes.latexButton, props.mqClassName);
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
const MQ = MathQuill.getInterface(2);
|
|
151
|
+
const span = document.createElement('span');
|
|
152
|
+
span.innerHTML = '';
|
|
153
|
+
const mathField = MQ.StaticMath(span);
|
|
154
|
+
|
|
155
|
+
mathField.parseLatex(props.latex);
|
|
156
|
+
mathField.latex(props.latex);
|
|
157
|
+
} catch (e) {
|
|
158
|
+
// received latex has errors - do not create button
|
|
159
|
+
return <></>;
|
|
160
|
+
}
|
|
161
|
+
|
|
148
162
|
return (
|
|
149
163
|
<Button className={classNames(props.classes.root, props.className)} onClick={props.onClick}>
|
|
150
164
|
<mq.Static className={buttonClass} latex={props.latex} />
|
|
@@ -152,12 +166,25 @@ const LatexButton = withStyles(theme => ({
|
|
|
152
166
|
);
|
|
153
167
|
});
|
|
154
168
|
|
|
169
|
+
const createCustomLayout = layoutObj => {
|
|
170
|
+
if (layoutObj) {
|
|
171
|
+
return {
|
|
172
|
+
gridTemplateColumns: `repeat(${layoutObj.columns}, minmax(min-content, 150px))`,
|
|
173
|
+
gridTemplateRows: `repeat(${layoutObj.rows}, minmax(40px, 60px))`,
|
|
174
|
+
gridAutoFlow: 'initial'
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return {};
|
|
179
|
+
};
|
|
180
|
+
|
|
155
181
|
export class KeyPad extends React.Component {
|
|
156
182
|
static propTypes = {
|
|
157
183
|
classes: PropTypes.object.isRequired,
|
|
158
184
|
className: PropTypes.string,
|
|
159
185
|
baseSet: PropTypes.array,
|
|
160
186
|
additionalKeys: PropTypes.array,
|
|
187
|
+
layoutForKeyPad: PropTypes.object,
|
|
161
188
|
onPress: PropTypes.func.isRequired,
|
|
162
189
|
onFocus: PropTypes.func,
|
|
163
190
|
noDecimal: PropTypes.bool,
|
|
@@ -193,14 +220,23 @@ export class KeyPad extends React.Component {
|
|
|
193
220
|
};
|
|
194
221
|
|
|
195
222
|
render() {
|
|
196
|
-
const {
|
|
223
|
+
const {
|
|
224
|
+
classes,
|
|
225
|
+
className,
|
|
226
|
+
baseSet,
|
|
227
|
+
additionalKeys,
|
|
228
|
+
layoutForKeyPad,
|
|
229
|
+
onFocus,
|
|
230
|
+
mode
|
|
231
|
+
} = this.props;
|
|
197
232
|
|
|
198
233
|
const noBaseSet = [
|
|
199
234
|
'non-negative-integers',
|
|
200
235
|
'integers',
|
|
201
236
|
'decimals',
|
|
202
237
|
'fractions',
|
|
203
|
-
'item-authoring'
|
|
238
|
+
'item-authoring',
|
|
239
|
+
'language'
|
|
204
240
|
];
|
|
205
241
|
|
|
206
242
|
const keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
@@ -211,10 +247,15 @@ export class KeyPad extends React.Component {
|
|
|
211
247
|
const shift = allKeys.length % 5 ? 1 : 0;
|
|
212
248
|
const style = {
|
|
213
249
|
gridTemplateColumns: `repeat(${Math.floor(allKeys.length / 5) +
|
|
214
|
-
shift}, minmax(min-content, 150px))
|
|
250
|
+
shift}, minmax(min-content, 150px))`,
|
|
251
|
+
...createCustomLayout(layoutForKeyPad)
|
|
215
252
|
};
|
|
216
253
|
return (
|
|
217
|
-
<div
|
|
254
|
+
<div
|
|
255
|
+
className={classNames(classes.keys, className, classes[mode])}
|
|
256
|
+
style={style}
|
|
257
|
+
onFocus={onFocus}
|
|
258
|
+
>
|
|
218
259
|
{allKeys.map((k, index) => {
|
|
219
260
|
const onClick = this.buttonClick.bind(this, k);
|
|
220
261
|
|
|
@@ -227,11 +268,13 @@ export class KeyPad extends React.Component {
|
|
|
227
268
|
className: classNames(
|
|
228
269
|
classes.labelButton,
|
|
229
270
|
!keysWithoutBaseSet && classes[k.category],
|
|
271
|
+
classes[k.extraClass],
|
|
230
272
|
k.label === ',' && classes.comma,
|
|
231
273
|
k.label === '.' && classes.dot
|
|
232
274
|
),
|
|
233
275
|
disabled: this.keyIsNotAllowed(k),
|
|
234
|
-
key: `${k.label || k.latex || k.command}-${index}
|
|
276
|
+
key: `${k.label || k.latex || k.command}-${index}`,
|
|
277
|
+
...(k.actions || {})
|
|
235
278
|
};
|
|
236
279
|
|
|
237
280
|
if (k.latex) {
|
|
@@ -267,6 +310,9 @@ const styles = theme => ({
|
|
|
267
310
|
gridColumnGap: '0px',
|
|
268
311
|
gridAutoFlow: 'column'
|
|
269
312
|
},
|
|
313
|
+
character: {
|
|
314
|
+
textTransform: 'initial !important'
|
|
315
|
+
},
|
|
270
316
|
holder: {
|
|
271
317
|
position: 'relative',
|
|
272
318
|
width: '100%',
|
package/src/keys/grades.js
CHANGED
|
@@ -275,7 +275,7 @@ export const gradeSets = [
|
|
|
275
275
|
],
|
|
276
276
|
[
|
|
277
277
|
basicOperators.multiply,
|
|
278
|
-
|
|
278
|
+
operators.circleDot,
|
|
279
279
|
{ name: '', latex: '', write: '' },
|
|
280
280
|
subSup.subscript,
|
|
281
281
|
exponent.xToPowerOfN,
|
|
@@ -289,7 +289,7 @@ export const gradeSets = [
|
|
|
289
289
|
misc.plusMinus,
|
|
290
290
|
constants.pi,
|
|
291
291
|
vars.theta,
|
|
292
|
-
|
|
292
|
+
geometry.degree,
|
|
293
293
|
geometry.angle,
|
|
294
294
|
geometry.leftArrow,
|
|
295
295
|
geometry.rightArrow,
|
|
@@ -374,6 +374,6 @@ export const normalizeAdditionalKeys = additionalKeys => {
|
|
|
374
374
|
latex === key.otherNotation
|
|
375
375
|
);
|
|
376
376
|
|
|
377
|
-
return predefinedKey || additionalkey;
|
|
377
|
+
return !latex ? additionalkey : predefinedKey || additionalkey;
|
|
378
378
|
});
|
|
379
379
|
};
|