@oat-sa/tao-core-ui 1.67.0 → 1.69.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/dist/ckeditor/ckConfigurator.js +10 -1
- package/dist/maths/calculator/basicCalculator.js +4 -4
- package/dist/maths/calculator/calculatorComponent.js +22 -25
- package/dist/maths/calculator/core/board.js +12329 -720
- package/dist/maths/calculator/core/labels.js +7924 -138
- package/dist/maths/calculator/core/plugin.js +4 -5
- package/dist/maths/calculator/css/calculator.css +18 -5
- package/dist/maths/calculator/css/calculator.css.map +1 -1
- package/dist/maths/calculator/defaultCalculator.js +10 -6
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +23 -25
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +7979 -194
- package/dist/maths/calculator/scientificCalculator.js +7 -12
- package/package.json +5 -7
- package/src/ckeditor/ckConfigurator.js +11 -4
- package/src/maths/calculator/basicCalculator.js +1 -4
- package/src/maths/calculator/calculatorComponent.js +49 -60
- package/src/maths/calculator/core/board.js +372 -493
- package/src/maths/calculator/core/labels.js +46 -48
- package/src/maths/calculator/core/plugin.js +3 -5
- package/src/maths/calculator/core/tpl/terms.tpl +7 -1
- package/src/maths/calculator/css/calculator.css +18 -5
- package/src/maths/calculator/css/calculator.css.map +1 -1
- package/src/maths/calculator/defaultCalculator.js +7 -9
- package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +3 -3
- package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +17 -20
- package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +102 -108
- package/src/maths/calculator/scientificCalculator.js +2 -10
- package/src/maths/calculator/scss/calculator.scss +14 -1
- package/src/maths/calculator/tpl/basicKeyboard.tpl +3 -3
- package/src/maths/calculator/tpl/scientificKeyboard.tpl +4 -4
- package/dist/maths/calculator/core/areaBroker.js +0 -43
- package/dist/maths/calculator/core/expression.js +0 -463
- package/dist/maths/calculator/core/terms.js +0 -456
- package/dist/maths/calculator/core/tokenizer.js +0 -229
- package/dist/maths/calculator/core/tokens.js +0 -167
- package/dist/maths/calculator/plugins/core/degrad.js +0 -71
- package/dist/maths/calculator/plugins/core/history.js +0 -149
- package/dist/maths/calculator/plugins/core/remind.js +0 -76
- package/dist/maths/calculator/plugins/core/stepNavigation.js +0 -148
- package/dist/maths/calculator/plugins/modifiers/pow10.js +0 -136
- package/dist/maths/calculator/plugins/modifiers/sign.js +0 -314
- package/dist/maths/calculator/pluginsLoader.js +0 -47
- package/src/maths/calculator/core/areaBroker.js +0 -38
- package/src/maths/calculator/core/expression.js +0 -430
- package/src/maths/calculator/core/terms.js +0 -459
- package/src/maths/calculator/core/tokenizer.js +0 -245
- package/src/maths/calculator/core/tokens.js +0 -178
- package/src/maths/calculator/plugins/core/degrad.js +0 -90
- package/src/maths/calculator/plugins/core/history.js +0 -166
- package/src/maths/calculator/plugins/core/remind.js +0 -96
- package/src/maths/calculator/plugins/core/stepNavigation.js +0 -175
- package/src/maths/calculator/plugins/modifiers/pow10.js +0 -143
- package/src/maths/calculator/plugins/modifiers/sign.js +0 -339
- package/src/maths/calculator/pluginsLoader.js +0 -46
|
@@ -13,35 +13,29 @@
|
|
|
13
13
|
* along with this program; if not, write to the Free Software
|
|
14
14
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
15
|
*
|
|
16
|
-
* Copyright (c) 2018 Open Assessment Technologies SA ;
|
|
16
|
+
* Copyright (c) 2018-2023 Open Assessment Technologies SA ;
|
|
17
17
|
*/
|
|
18
18
|
/**
|
|
19
19
|
* Plugin that manages a simple screen for the calculator, with configurable layout.
|
|
20
|
-
* @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
|
|
21
20
|
*/
|
|
22
21
|
import $ from 'jquery';
|
|
23
|
-
import _ from 'lodash';
|
|
24
22
|
import nsHelper from 'util/namespace';
|
|
25
23
|
import scrollHelper from 'ui/scroller';
|
|
26
|
-
import
|
|
27
|
-
import expressionHelper from 'ui/maths/calculator/core/expression';
|
|
24
|
+
import { terms, tokensHelper } from '@oat-sa/tao-calculator/dist';
|
|
28
25
|
import pluginFactory from 'ui/maths/calculator/core/plugin';
|
|
29
26
|
import historyTpl from 'ui/maths/calculator/plugins/screen/simpleScreen/history';
|
|
30
27
|
import defaultScreenTpl from 'ui/maths/calculator/plugins/screen/simpleScreen/defaultTemplate';
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @type {String}
|
|
37
|
-
*/
|
|
38
|
-
var defaultExpression = '0';
|
|
29
|
+
const pluginName = 'simpleScreen';
|
|
30
|
+
const lastResultVariable = terms.VAR_ANS.value;
|
|
31
|
+
const errorValue = terms.ERROR.value;
|
|
32
|
+
const defaultExpression = '0';
|
|
39
33
|
|
|
40
34
|
/**
|
|
41
35
|
* Default plugin config
|
|
42
|
-
* @type {
|
|
36
|
+
* @type {object}
|
|
43
37
|
*/
|
|
44
|
-
|
|
38
|
+
const defaultConfig = {
|
|
45
39
|
// the layout of the screen
|
|
46
40
|
layout: defaultScreenTpl,
|
|
47
41
|
|
|
@@ -49,6 +43,26 @@ var defaultConfig = {
|
|
|
49
43
|
decimalDigits: 5
|
|
50
44
|
};
|
|
51
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Auto scroll to the last child of a container
|
|
48
|
+
* @param {jQuery} $container
|
|
49
|
+
* @param {string} [sel]
|
|
50
|
+
*/
|
|
51
|
+
function autoScroll($container, sel) {
|
|
52
|
+
scrollHelper.scrollTo($container.find(':last-child ' + (sel || '')), $container);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Renders HTML into a container and make sure the last child is visible.
|
|
57
|
+
* @param {jQuery} $container
|
|
58
|
+
* @param {string} html
|
|
59
|
+
* @param {string} [sel]
|
|
60
|
+
*/
|
|
61
|
+
function renderHtml($container, html, sel) {
|
|
62
|
+
$container.html(html);
|
|
63
|
+
autoScroll($container, sel);
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
export default pluginFactory(
|
|
53
67
|
{
|
|
54
68
|
name: pluginName,
|
|
@@ -56,134 +70,114 @@ export default pluginFactory(
|
|
|
56
70
|
/**
|
|
57
71
|
* Called when the plugin should be initialized.
|
|
58
72
|
*/
|
|
59
|
-
init
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Reset the current expression
|
|
64
|
-
*/
|
|
65
|
-
function reset() {
|
|
66
|
-
calculator.replace(calculator.getConfig().expression || defaultExpression);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
reset();
|
|
70
|
-
|
|
71
|
-
calculator
|
|
72
|
-
.after(nsHelper.namespaceAll('expressionchange', pluginName), function (expression) {
|
|
73
|
-
// ensure the displayed expression is at least a 0 (never be an empty string)
|
|
74
|
-
if (!expression.trim()) {
|
|
75
|
-
_.defer(reset);
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
.after(nsHelper.namespaceAll('evaluate', pluginName), function () {
|
|
79
|
-
// when the expression is computed, replace it with the result as a variable
|
|
80
|
-
calculator.replace(registeredTerms.ANS.value);
|
|
81
|
-
})
|
|
82
|
-
.on(nsHelper.namespaceAll('clear', pluginName), reset);
|
|
73
|
+
init() {
|
|
74
|
+
// required by the plugin factory to validate this plugin
|
|
83
75
|
},
|
|
84
76
|
|
|
85
77
|
/**
|
|
86
78
|
* Called when the plugin should be rendered.
|
|
87
79
|
*/
|
|
88
|
-
render
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
var tokenizer = calculator.getTokenizer();
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Auto scroll to the last child of a container
|
|
97
|
-
* @param {jQuery} $container
|
|
98
|
-
* @param {String} [sel]
|
|
99
|
-
*/
|
|
100
|
-
function autoScroll($container, sel) {
|
|
101
|
-
scrollHelper.scrollTo($container.find(':last-child ' + (sel || '')), $container);
|
|
102
|
-
}
|
|
80
|
+
render() {
|
|
81
|
+
const calculator = this.getCalculator();
|
|
82
|
+
const engine = calculator.getCalculator();
|
|
83
|
+
const areaBroker = calculator.getAreaBroker();
|
|
84
|
+
const pluginConfig = this.getConfig();
|
|
103
85
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* @param {String|Object|token[]} expression
|
|
107
|
-
* @returns {String}
|
|
108
|
-
*/
|
|
109
|
-
function renderExpression(expression) {
|
|
110
|
-
var variables = expressionHelper.roundLastResultVariable(
|
|
111
|
-
calculator.getVariables(),
|
|
112
|
-
pluginConfig.decimalDigits
|
|
113
|
-
);
|
|
114
|
-
return expressionHelper.render(expression, variables, tokenizer);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Updates the expression area
|
|
119
|
-
* @param {String|Object|token[]} tokens
|
|
120
|
-
*/
|
|
121
|
-
function showExpression(tokens) {
|
|
122
|
-
self.controls.$expression.html(renderExpression(tokens));
|
|
123
|
-
autoScroll(self.controls.$expression);
|
|
86
|
+
if ('function' !== typeof pluginConfig.layout) {
|
|
87
|
+
throw new TypeError('The screen plugin requires a template to render!');
|
|
124
88
|
}
|
|
125
89
|
|
|
126
|
-
if (!
|
|
127
|
-
|
|
90
|
+
if (!calculator.getExpression().trim()) {
|
|
91
|
+
calculator.replace(defaultExpression);
|
|
128
92
|
}
|
|
129
93
|
|
|
130
94
|
this.$layout = $(
|
|
131
95
|
pluginConfig.layout(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
pluginConfig
|
|
137
|
-
)
|
|
96
|
+
Object.assign({}, pluginConfig, {
|
|
97
|
+
expression: calculator.renderExpression()
|
|
98
|
+
})
|
|
138
99
|
)
|
|
139
100
|
);
|
|
101
|
+
areaBroker.getScreenArea().append(this.$layout);
|
|
140
102
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
103
|
+
const $history = this.$layout.find('.history');
|
|
104
|
+
const $expression = this.$layout.find('.expression');
|
|
105
|
+
const showExpression = tokens => renderHtml($expression, calculator.renderExpression(tokens));
|
|
106
|
+
let active = false;
|
|
145
107
|
|
|
146
108
|
calculator
|
|
147
|
-
.on(nsHelper.namespaceAll('
|
|
148
|
-
self.controls.$history.empty();
|
|
149
|
-
})
|
|
150
|
-
.on(nsHelper.namespaceAll('expressionchange', pluginName), function () {
|
|
151
|
-
calculator.setState('error', false);
|
|
109
|
+
.on(nsHelper.namespaceAll('expressionchange', pluginName), () => {
|
|
152
110
|
showExpression(calculator.getTokens());
|
|
153
111
|
})
|
|
154
|
-
.on(nsHelper.namespaceAll('
|
|
155
|
-
|
|
112
|
+
.on(nsHelper.namespaceAll('result', pluginName), result => {
|
|
113
|
+
const { error } = engine;
|
|
114
|
+
calculator.setState('error', error);
|
|
115
|
+
active = false;
|
|
116
|
+
|
|
117
|
+
renderHtml(
|
|
118
|
+
$history,
|
|
156
119
|
historyTpl({
|
|
157
|
-
expression:
|
|
158
|
-
result: renderExpression(result)
|
|
159
|
-
})
|
|
120
|
+
expression: calculator.renderExpression(),
|
|
121
|
+
result: calculator.renderExpression(result)
|
|
122
|
+
}),
|
|
123
|
+
'.history-result'
|
|
160
124
|
);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (expressionHelper.containsError(result.value)) {
|
|
125
|
+
calculator.replace(lastResultVariable);
|
|
126
|
+
|
|
127
|
+
if (error) {
|
|
165
128
|
showExpression(result);
|
|
166
129
|
}
|
|
167
130
|
})
|
|
168
|
-
.on(nsHelper.namespaceAll('
|
|
131
|
+
.on(nsHelper.namespaceAll('command', pluginName), (name, parameter) => {
|
|
132
|
+
if (active || calculator.is('error')) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (engine.isInstantMode()) {
|
|
137
|
+
if (name === 'execute') {
|
|
138
|
+
calculator.replace(lastResultVariable);
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// The expression is inactive.
|
|
144
|
+
// The result was just calculated, any command invoked now would start a new expression.
|
|
145
|
+
let expr = '';
|
|
146
|
+
|
|
147
|
+
if (name === 'term') {
|
|
148
|
+
// If the invoked command introduces an operator, we want to apply it on the last result.
|
|
149
|
+
const [token] = parameter.split(/\s+/);
|
|
150
|
+
if (tokensHelper.isOperator(terms[token])) {
|
|
151
|
+
expr = lastResultVariable;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
calculator.replace(expr);
|
|
156
|
+
})
|
|
157
|
+
.on(nsHelper.namespaceAll('clear', pluginName), () => {
|
|
158
|
+
$history.empty();
|
|
159
|
+
calculator.replace(defaultExpression);
|
|
160
|
+
})
|
|
161
|
+
.on(nsHelper.namespaceAll('command clear', pluginName), () => {
|
|
162
|
+
calculator.setState('error', false);
|
|
163
|
+
active = true;
|
|
164
|
+
})
|
|
165
|
+
.on(nsHelper.namespaceAll('syntaxerror', pluginName), () => {
|
|
166
|
+
showExpression(calculator.getExpression() + errorValue);
|
|
169
167
|
calculator.setState('error', true);
|
|
170
|
-
|
|
168
|
+
active = false;
|
|
171
169
|
});
|
|
172
|
-
|
|
173
|
-
areaBroker.getScreenArea().append(this.$layout);
|
|
174
170
|
},
|
|
175
171
|
|
|
176
172
|
/**
|
|
177
173
|
* Called when the plugin is destroyed. Mostly when the host is destroyed itself.
|
|
178
174
|
*/
|
|
179
|
-
destroy
|
|
180
|
-
var calculator = this.getCalculator();
|
|
175
|
+
destroy() {
|
|
181
176
|
if (this.$layout) {
|
|
182
|
-
this.$layout.off(
|
|
177
|
+
this.$layout.off(`.${pluginName}`).remove();
|
|
183
178
|
this.$layout = null;
|
|
184
179
|
}
|
|
185
|
-
this.
|
|
186
|
-
calculator.off('.' + pluginName);
|
|
180
|
+
this.getCalculator().off(`.${pluginName}`);
|
|
187
181
|
}
|
|
188
182
|
},
|
|
189
183
|
defaultConfig
|
|
@@ -13,16 +13,11 @@
|
|
|
13
13
|
* along with this program; if not, write to the Free Software
|
|
14
14
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
15
|
*
|
|
16
|
-
* Copyright (c) 2018 Open Assessment Technologies SA ;
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
|
|
16
|
+
* Copyright (c) 2018-2023 Open Assessment Technologies SA ;
|
|
20
17
|
*/
|
|
21
18
|
import _ from 'lodash';
|
|
22
19
|
import __ from 'i18n';
|
|
23
20
|
import defaultCalculatorFactory from 'ui/maths/calculator/defaultCalculator';
|
|
24
|
-
import pluginSign from 'ui/maths/calculator/plugins/modifiers/sign';
|
|
25
|
-
import pluginPow10 from 'ui/maths/calculator/plugins/modifiers/pow10';
|
|
26
21
|
import keyboardTpl from 'ui/maths/calculator/tpl/scientificKeyboard';
|
|
27
22
|
import screenTpl from 'ui/maths/calculator/tpl/scientificScreen';
|
|
28
23
|
|
|
@@ -30,7 +25,7 @@ import screenTpl from 'ui/maths/calculator/tpl/scientificScreen';
|
|
|
30
25
|
* Default config values
|
|
31
26
|
* @type {Object}
|
|
32
27
|
*/
|
|
33
|
-
|
|
28
|
+
const defaultConfig = {
|
|
34
29
|
title: __('Scientific Calculator'),
|
|
35
30
|
width: 450,
|
|
36
31
|
height: 400,
|
|
@@ -53,9 +48,6 @@ export default function scientificCalculator(config) {
|
|
|
53
48
|
return defaultCalculatorFactory(
|
|
54
49
|
_.merge(
|
|
55
50
|
{
|
|
56
|
-
loadedPlugins: {
|
|
57
|
-
modifiers: [pluginSign, pluginPow10]
|
|
58
|
-
},
|
|
59
51
|
calculator: {
|
|
60
52
|
plugins: {
|
|
61
53
|
templateKeyboard: {
|
|
@@ -67,6 +67,19 @@
|
|
|
67
67
|
bottom: -0.5em;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
[data-type='exponent'] {
|
|
71
|
+
vertical-align: super;
|
|
72
|
+
font-size: 0.75em;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
[data-type='variable'] {
|
|
76
|
+
font-weight: bold;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-type='function']:not([data-value*='rt']) {
|
|
80
|
+
padding-right: 0.3em;
|
|
81
|
+
}
|
|
82
|
+
|
|
70
83
|
.screen,
|
|
71
84
|
.input {
|
|
72
85
|
position: relative;
|
|
@@ -341,7 +354,7 @@
|
|
|
341
354
|
font-weight: bold;
|
|
342
355
|
color: $calculatorScreenSpecialTxt;
|
|
343
356
|
}
|
|
344
|
-
&.term-variable[data-token='
|
|
357
|
+
&.term-variable[data-token='VAR_ANS'] {
|
|
345
358
|
background: $calculatorScreenSpecialBg;
|
|
346
359
|
padding: 0;
|
|
347
360
|
margin: 0 #{$calculatorTermSpace * 2};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<div class="row">
|
|
3
3
|
<button class="key command" data-command="historyUp"><span>{{{labels.HISTORYUP}}}</span></button>
|
|
4
4
|
<button class="key command" data-command="historyDown"><span>{{{labels.HISTORYDOWN}}}</span></button>
|
|
5
|
-
<button class="key command" data-command="
|
|
6
|
-
<button class="key command" data-command="clear"><span>{{{labels.
|
|
5
|
+
<button class="key command" data-command="deleteLeft"><span>{{{labels.BACKSPACE}}}</span></button>
|
|
6
|
+
<button class="key command" data-command="clear"><span>{{{labels.RESET}}}</span></button>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="row">
|
|
9
9
|
<button class="key operator" data-command="term" data-param="LPAR"><span>{{{labels.LPAR}}}</span></button>
|
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
<button class="key execute" data-command="execute"><span>{{{labels.EXECUTE}}}</span></button>
|
|
36
36
|
<button class="key operator" data-command="term" data-param="ADD"><span>{{{labels.ADD}}}</span></button>
|
|
37
37
|
</div>
|
|
38
|
-
</div>
|
|
38
|
+
</div>
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<span class="spacer">{{{labels.SPACER}}}</span>
|
|
7
7
|
<button class="key command" data-command="historyUp"><span>{{{labels.HISTORYUP}}}</span></button>
|
|
8
8
|
<button class="key command" data-command="historyDown"><span>{{{labels.HISTORYDOWN}}}</span></button>
|
|
9
|
-
<button class="key command" data-command="
|
|
10
|
-
<button class="key command" data-command="clear"><span>{{{labels.
|
|
9
|
+
<button class="key command" data-command="deleteLeft"><span>{{{labels.BACKSPACE}}}</span></button>
|
|
10
|
+
<button class="key command" data-command="clear"><span>{{{labels.RESET}}}</span></button>
|
|
11
11
|
</div>
|
|
12
12
|
<div class="row">
|
|
13
13
|
<button class="key operator" data-command="term" data-param="SIN"><span>{{{labels.SIN}}}</span></button>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<button class="key operator" data-command="term" data-param="SQRT"><span>{{{labels.SQRT}}}</span></button>
|
|
44
44
|
<button class="key operator" data-command="term" data-param="CBRT"><span>{{{labels.CBRT}}}</span></button>
|
|
45
45
|
<button class="key operator" data-command="term" data-param="@NTHRT"><span>{{{labels.NTHRT}}}</span></button>
|
|
46
|
-
<button class="key operator" data-command="
|
|
46
|
+
<button class="key operator" data-command="term" data-param="TEN POW"><span>{{{labels.POW10}}}</span></button>
|
|
47
47
|
<button class="key operand" data-command="term" data-param="NUM1"><span>{{{labels.NUM1}}}</span></button>
|
|
48
48
|
<button class="key operand" data-command="term" data-param="NUM2"><span>{{{labels.NUM2}}}</span></button>
|
|
49
49
|
<button class="key operand" data-command="term" data-param="NUM3"><span>{{{labels.NUM3}}}</span></button>
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
<button class="key operand" data-command="term" data-param="DOT"><span>{{{labels.DOT}}}</span></button>
|
|
60
60
|
<button class="key execute" data-command="execute"><span>{{{labels.EXECUTE}}}</span></button>
|
|
61
61
|
</div>
|
|
62
|
-
</div>
|
|
62
|
+
</div>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
define(['lodash', 'ui/areaBroker'], function (_, areaBroker$1) { 'use strict';
|
|
2
|
-
|
|
3
|
-
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
4
|
-
areaBroker$1 = areaBroker$1 && Object.prototype.hasOwnProperty.call(areaBroker$1, 'default') ? areaBroker$1['default'] : areaBroker$1;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* This program is free software; you can redistribute it and/or
|
|
8
|
-
* modify it under the terms of the GNU General Public License
|
|
9
|
-
* as published by the Free Software Foundation; under version 2
|
|
10
|
-
* of the License (non-upgradable).
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU General Public License
|
|
18
|
-
* along with this program; if not, write to the Free Software
|
|
19
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) 2018 (original work) Open Assessment Technologies SA ;
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Creates an area broker with the required areas for the calculator panel.
|
|
26
|
-
*
|
|
27
|
-
* @see ui/areaBroker
|
|
28
|
-
*
|
|
29
|
-
* @param {jQuery|HTMLElement|String} $container - the main container
|
|
30
|
-
* @param {Object} mapping - keys are the area names, values are jQueryElement
|
|
31
|
-
* @returns {broker} the broker
|
|
32
|
-
* @throws {TypeError} without a valid container
|
|
33
|
-
*/
|
|
34
|
-
var areaBroker = _.partial(areaBroker$1, ['screen',
|
|
35
|
-
// where the expressions and their result are rendered
|
|
36
|
-
'input',
|
|
37
|
-
// where the expressions are input
|
|
38
|
-
'keyboard' // the keyboard area that should provide a way to interact with the calculator
|
|
39
|
-
]);
|
|
40
|
-
|
|
41
|
-
return areaBroker;
|
|
42
|
-
|
|
43
|
-
});
|