@oat-sa/tao-core-ui 1.67.0 → 1.68.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.
Files changed (56) hide show
  1. package/dist/maths/calculator/basicCalculator.js +4 -4
  2. package/dist/maths/calculator/calculatorComponent.js +22 -25
  3. package/dist/maths/calculator/core/board.js +12329 -720
  4. package/dist/maths/calculator/core/labels.js +7924 -138
  5. package/dist/maths/calculator/core/plugin.js +4 -5
  6. package/dist/maths/calculator/css/calculator.css +18 -5
  7. package/dist/maths/calculator/css/calculator.css.map +1 -1
  8. package/dist/maths/calculator/defaultCalculator.js +10 -6
  9. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +23 -25
  10. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +7979 -194
  11. package/dist/maths/calculator/scientificCalculator.js +7 -12
  12. package/package.json +5 -7
  13. package/src/.DS_Store +0 -0
  14. package/src/maths/.DS_Store +0 -0
  15. package/src/maths/calculator/.DS_Store +0 -0
  16. package/src/maths/calculator/basicCalculator.js +1 -4
  17. package/src/maths/calculator/calculatorComponent.js +49 -60
  18. package/src/maths/calculator/core/board.js +372 -493
  19. package/src/maths/calculator/core/labels.js +46 -48
  20. package/src/maths/calculator/core/plugin.js +3 -5
  21. package/src/maths/calculator/core/tpl/terms.tpl +7 -1
  22. package/src/maths/calculator/css/calculator.css +18 -5
  23. package/src/maths/calculator/css/calculator.css.map +1 -1
  24. package/src/maths/calculator/defaultCalculator.js +7 -9
  25. package/src/maths/calculator/plugins/.DS_Store +0 -0
  26. package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +3 -3
  27. package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +17 -20
  28. package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +102 -108
  29. package/src/maths/calculator/scientificCalculator.js +2 -10
  30. package/src/maths/calculator/scss/calculator.scss +14 -1
  31. package/src/maths/calculator/tpl/basicKeyboard.tpl +3 -3
  32. package/src/maths/calculator/tpl/scientificKeyboard.tpl +4 -4
  33. package/dist/maths/calculator/core/areaBroker.js +0 -43
  34. package/dist/maths/calculator/core/expression.js +0 -463
  35. package/dist/maths/calculator/core/terms.js +0 -456
  36. package/dist/maths/calculator/core/tokenizer.js +0 -229
  37. package/dist/maths/calculator/core/tokens.js +0 -167
  38. package/dist/maths/calculator/plugins/core/degrad.js +0 -71
  39. package/dist/maths/calculator/plugins/core/history.js +0 -149
  40. package/dist/maths/calculator/plugins/core/remind.js +0 -76
  41. package/dist/maths/calculator/plugins/core/stepNavigation.js +0 -148
  42. package/dist/maths/calculator/plugins/modifiers/pow10.js +0 -136
  43. package/dist/maths/calculator/plugins/modifiers/sign.js +0 -314
  44. package/dist/maths/calculator/pluginsLoader.js +0 -47
  45. package/src/maths/calculator/core/areaBroker.js +0 -38
  46. package/src/maths/calculator/core/expression.js +0 -430
  47. package/src/maths/calculator/core/terms.js +0 -459
  48. package/src/maths/calculator/core/tokenizer.js +0 -245
  49. package/src/maths/calculator/core/tokens.js +0 -178
  50. package/src/maths/calculator/plugins/core/degrad.js +0 -90
  51. package/src/maths/calculator/plugins/core/history.js +0 -166
  52. package/src/maths/calculator/plugins/core/remind.js +0 -96
  53. package/src/maths/calculator/plugins/core/stepNavigation.js +0 -175
  54. package/src/maths/calculator/plugins/modifiers/pow10.js +0 -143
  55. package/src/maths/calculator/plugins/modifiers/sign.js +0 -339
  56. package/src/maths/calculator/pluginsLoader.js +0 -46
@@ -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=\"stepDeleteLeft\"><span>";
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.CLEARALL)),typeof stack1 === functionType ? stack1.apply(depth0) : 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(['lodash', 'ui/dynamicComponent', 'ui/maths/calculator/core/board', 'ui/maths/calculator/pluginsLoader', 'css!ui/maths/calculator/css/calculator.css'], function (_, dynamicComponent, calculatorBoardFactory, pluginsLoader, calculator_css) { 'use strict';
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
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
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
- pluginsLoader = pluginsLoader && Object.prototype.hasOwnProperty.call(pluginsLoader, 'default') ? pluginsLoader['default'] : pluginsLoader;
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-2019 Open Assessment Technologies SA ;
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
- var defaultConfig = {
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
- var calculator, calculatorComponent;
49
- var api = {
48
+ let calculator;
49
+ const api = {
50
50
  /**
51
51
  * Gets the nested calculator
52
52
  * @returns {calculator}
53
53
  */
54
- getCalculator: function getCalculator() {
54
+ getCalculator() {
55
55
  return calculator;
56
56
  }
57
57
  };
58
- calculatorComponent = dynamicComponent(api, defaultConfig).on('rendercontent', function ($content) {
59
- const self = this;
60
- const initialWidth = self.getElement().width();
61
- const initialHeight = self.getElement().height();
62
- return pluginsLoader(this.getConfig().loadedPlugins, this.getConfig().dynamicPlugins).then(function (loadedPlugins) {
63
- return new Promise(function (resolve) {
64
- calculator = calculatorBoardFactory($content, loadedPlugins, self.getConfig().calculator).on('ready', function () {
65
- var initialFontSize = parseInt(self.getCalculator().getElement().css('fontSize'), 10) || 10;
66
- self.on('resize', function () {
67
- if (self.getElement()) {
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', function () {
76
- return new Promise(function (resolve) {
74
+ }).on('destroy', () => {
75
+ return new Promise(resolve => {
77
76
  if (calculator) {
78
- calculator.after('destroy', function () {
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
- _.defer(function () {
88
- calculatorComponent.init(config);
89
- });
86
+ setTimeout(() => calculatorComponent.init(config), 0);
90
87
  return calculatorComponent;
91
88
  }
92
89