@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
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'module', 'services/features'], function ($, _, dtdHandler, ckeditor, module, featuresService) { 'use strict';
|
|
1
|
+
define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'context', 'module', 'services/features'], function ($, _, dtdHandler, ckeditor, context, module, featuresService) { 'use strict';
|
|
2
2
|
|
|
3
3
|
$ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
|
|
4
4
|
_ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
|
|
5
5
|
dtdHandler = dtdHandler && Object.prototype.hasOwnProperty.call(dtdHandler, 'default') ? dtdHandler['default'] : dtdHandler;
|
|
6
|
+
context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
|
|
6
7
|
module = module && Object.prototype.hasOwnProperty.call(module, 'default') ? module['default'] : module;
|
|
7
8
|
featuresService = featuresService && Object.prototype.hasOwnProperty.call(featuresService, 'default') ? featuresService['default'] : featuresService;
|
|
8
9
|
|
|
@@ -413,6 +414,14 @@ define(['jquery', 'lodash', 'ui/ckeditor/dtdHandler', 'ckeditor', 'module', 'ser
|
|
|
413
414
|
// add the toolbar
|
|
414
415
|
if (typeof toolbars[toolbarType] !== 'undefined') {
|
|
415
416
|
ckConfig.toolbar = toolbars[toolbarType];
|
|
417
|
+
|
|
418
|
+
//enable sourcedialog plugin upon featureflag (false by default)
|
|
419
|
+
if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_SOURCEDIALOG) {
|
|
420
|
+
ckConfig.toolbar.push({
|
|
421
|
+
name: 'sourcedialog',
|
|
422
|
+
items: ['Sourcedialog']
|
|
423
|
+
});
|
|
424
|
+
}
|
|
416
425
|
}
|
|
417
426
|
|
|
418
427
|
// ensures positionedPlugins has the right format
|
|
@@ -20,11 +20,11 @@ define(['lodash', 'ui/maths/calculator/defaultCalculator', 'handlebars', 'lib/ha
|
|
|
20
20
|
buffer += "</span></button>\n <button class=\"key command\" data-command=\"historyDown\"><span>";
|
|
21
21
|
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.HISTORYDOWN)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
22
22
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
23
|
-
buffer += "</span></button>\n <button class=\"key command\" data-command=\"
|
|
23
|
+
buffer += "</span></button>\n <button class=\"key command\" data-command=\"deleteLeft\"><span>";
|
|
24
24
|
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.BACKSPACE)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
25
25
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
26
26
|
buffer += "</span></button>\n <button class=\"key command\" data-command=\"clear\"><span>";
|
|
27
|
-
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.
|
|
27
|
+
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.RESET)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
28
28
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
29
29
|
buffer += "</span></button>\n </div>\n <div class=\"row\">\n <button class=\"key operator\" data-command=\"term\" data-param=\"LPAR\"><span>";
|
|
30
30
|
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.LPAR)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
@@ -86,7 +86,7 @@ define(['lodash', 'ui/maths/calculator/defaultCalculator', 'handlebars', 'lib/ha
|
|
|
86
86
|
buffer += "</span></button>\n <button class=\"key operator\" data-command=\"term\" data-param=\"ADD\"><span>";
|
|
87
87
|
stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.ADD)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
|
88
88
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
|
89
|
-
buffer += "</span></button>\n </div>\n</div
|
|
89
|
+
buffer += "</span></button>\n </div>\n</div>\n";
|
|
90
90
|
return buffer;
|
|
91
91
|
});
|
|
92
92
|
function keyboardTpl(data, options, asString) {
|
|
@@ -131,7 +131,7 @@ define(['lodash', 'ui/maths/calculator/defaultCalculator', 'handlebars', 'lib/ha
|
|
|
131
131
|
* along with this program; if not, write to the Free Software
|
|
132
132
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
133
133
|
*
|
|
134
|
-
* Copyright (c) 2018 Open Assessment Technologies SA ;
|
|
134
|
+
* Copyright (c) 2018-2023 Open Assessment Technologies SA ;
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
137
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define(['
|
|
1
|
+
define(['context', 'ui/dynamicComponent', 'ui/maths/calculator/core/board', 'core/pluginLoader', 'css!ui/maths/calculator/css/calculator.css'], function (context, dynamicComponent, calculatorBoardFactory, pluginLoaderFactory, calculator_css) { 'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
|
|
4
4
|
dynamicComponent = dynamicComponent && Object.prototype.hasOwnProperty.call(dynamicComponent, 'default') ? dynamicComponent['default'] : dynamicComponent;
|
|
5
5
|
calculatorBoardFactory = calculatorBoardFactory && Object.prototype.hasOwnProperty.call(calculatorBoardFactory, 'default') ? calculatorBoardFactory['default'] : calculatorBoardFactory;
|
|
6
|
-
|
|
6
|
+
pluginLoaderFactory = pluginLoaderFactory && Object.prototype.hasOwnProperty.call(pluginLoaderFactory, 'default') ? pluginLoaderFactory['default'] : pluginLoaderFactory;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* This program is free software; you can redistribute it and/or
|
|
@@ -20,14 +20,14 @@ define(['lodash', 'ui/dynamicComponent', 'ui/maths/calculator/core/board', 'ui/m
|
|
|
20
20
|
* along with this program; if not, write to the Free Software
|
|
21
21
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
22
22
|
*
|
|
23
|
-
* Copyright (c) 2018-
|
|
23
|
+
* Copyright (c) 2018-2023 Open Assessment Technologies SA ;
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Default config values
|
|
28
28
|
* @type {Object}
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
const defaultConfig = {
|
|
31
31
|
preserveAspectRatio: false,
|
|
32
32
|
width: 240,
|
|
33
33
|
height: 360,
|
|
@@ -45,37 +45,36 @@ define(['lodash', 'ui/dynamicComponent', 'ui/maths/calculator/core/board', 'ui/m
|
|
|
45
45
|
* @returns {dynamicComponent}
|
|
46
46
|
*/
|
|
47
47
|
function calculatorComponentFactory(config) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
let calculator;
|
|
49
|
+
const api = {
|
|
50
50
|
/**
|
|
51
51
|
* Gets the nested calculator
|
|
52
52
|
* @returns {calculator}
|
|
53
53
|
*/
|
|
54
|
-
getCalculator
|
|
54
|
+
getCalculator() {
|
|
55
55
|
return calculator;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
calculatorComponent = dynamicComponent(api, defaultConfig).on('rendercontent', function ($content) {
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
self.getCalculator().getElement().css('fontSize', initialFontSize * Math.min(self.getElement().width() / initialWidth, self.getElement().height() / initialHeight));
|
|
58
|
+
const calculatorComponent = dynamicComponent(api, defaultConfig).on('rendercontent', function onRenderContent($content) {
|
|
59
|
+
const initialWidth = this.getElement().width();
|
|
60
|
+
const initialHeight = this.getElement().height();
|
|
61
|
+
return pluginLoaderFactory(this.getConfig().loadedPlugins).addList(this.getConfig().dynamicPlugins).load(context.bundle).then(loadedPlugins => {
|
|
62
|
+
return new Promise(resolve => {
|
|
63
|
+
calculator = calculatorBoardFactory($content, loadedPlugins, this.getConfig().calculator).on('ready', () => {
|
|
64
|
+
var initialFontSize = parseInt(this.getCalculator().getElement().css('fontSize'), 10) || 10;
|
|
65
|
+
this.on('resize', () => {
|
|
66
|
+
if (this.getElement()) {
|
|
67
|
+
this.getCalculator().getElement().css('fontSize', initialFontSize * Math.min(this.getElement().width() / initialWidth, this.getElement().height() / initialHeight));
|
|
69
68
|
}
|
|
70
69
|
}).setContentSize(calculator.getElement().outerWidth(), calculator.getElement().outerHeight()).setState('ready').trigger('ready');
|
|
71
70
|
resolve();
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
73
|
});
|
|
75
|
-
}).on('destroy',
|
|
76
|
-
return new Promise(
|
|
74
|
+
}).on('destroy', () => {
|
|
75
|
+
return new Promise(resolve => {
|
|
77
76
|
if (calculator) {
|
|
78
|
-
calculator.after('destroy',
|
|
77
|
+
calculator.after('destroy', () => {
|
|
79
78
|
calculator = null;
|
|
80
79
|
resolve();
|
|
81
80
|
}).destroy();
|
|
@@ -84,9 +83,7 @@ define(['lodash', 'ui/dynamicComponent', 'ui/maths/calculator/core/board', 'ui/m
|
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
85
|
});
|
|
87
|
-
|
|
88
|
-
calculatorComponent.init(config);
|
|
89
|
-
});
|
|
86
|
+
setTimeout(() => calculatorComponent.init(config), 0);
|
|
90
87
|
return calculatorComponent;
|
|
91
88
|
}
|
|
92
89
|
|