@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.
Files changed (54) hide show
  1. package/dist/ckeditor/ckConfigurator.js +10 -1
  2. package/dist/maths/calculator/basicCalculator.js +4 -4
  3. package/dist/maths/calculator/calculatorComponent.js +22 -25
  4. package/dist/maths/calculator/core/board.js +12329 -720
  5. package/dist/maths/calculator/core/labels.js +7924 -138
  6. package/dist/maths/calculator/core/plugin.js +4 -5
  7. package/dist/maths/calculator/css/calculator.css +18 -5
  8. package/dist/maths/calculator/css/calculator.css.map +1 -1
  9. package/dist/maths/calculator/defaultCalculator.js +10 -6
  10. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +23 -25
  11. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +7979 -194
  12. package/dist/maths/calculator/scientificCalculator.js +7 -12
  13. package/package.json +5 -7
  14. package/src/ckeditor/ckConfigurator.js +11 -4
  15. package/src/maths/calculator/basicCalculator.js +1 -4
  16. package/src/maths/calculator/calculatorComponent.js +49 -60
  17. package/src/maths/calculator/core/board.js +372 -493
  18. package/src/maths/calculator/core/labels.js +46 -48
  19. package/src/maths/calculator/core/plugin.js +3 -5
  20. package/src/maths/calculator/core/tpl/terms.tpl +7 -1
  21. package/src/maths/calculator/css/calculator.css +18 -5
  22. package/src/maths/calculator/css/calculator.css.map +1 -1
  23. package/src/maths/calculator/defaultCalculator.js +7 -9
  24. package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +3 -3
  25. package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +17 -20
  26. package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +102 -108
  27. package/src/maths/calculator/scientificCalculator.js +2 -10
  28. package/src/maths/calculator/scss/calculator.scss +14 -1
  29. package/src/maths/calculator/tpl/basicKeyboard.tpl +3 -3
  30. package/src/maths/calculator/tpl/scientificKeyboard.tpl +4 -4
  31. package/dist/maths/calculator/core/areaBroker.js +0 -43
  32. package/dist/maths/calculator/core/expression.js +0 -463
  33. package/dist/maths/calculator/core/terms.js +0 -456
  34. package/dist/maths/calculator/core/tokenizer.js +0 -229
  35. package/dist/maths/calculator/core/tokens.js +0 -167
  36. package/dist/maths/calculator/plugins/core/degrad.js +0 -71
  37. package/dist/maths/calculator/plugins/core/history.js +0 -149
  38. package/dist/maths/calculator/plugins/core/remind.js +0 -76
  39. package/dist/maths/calculator/plugins/core/stepNavigation.js +0 -148
  40. package/dist/maths/calculator/plugins/modifiers/pow10.js +0 -136
  41. package/dist/maths/calculator/plugins/modifiers/sign.js +0 -314
  42. package/dist/maths/calculator/pluginsLoader.js +0 -47
  43. package/src/maths/calculator/core/areaBroker.js +0 -38
  44. package/src/maths/calculator/core/expression.js +0 -430
  45. package/src/maths/calculator/core/terms.js +0 -459
  46. package/src/maths/calculator/core/tokenizer.js +0 -245
  47. package/src/maths/calculator/core/tokens.js +0 -178
  48. package/src/maths/calculator/plugins/core/degrad.js +0 -90
  49. package/src/maths/calculator/plugins/core/history.js +0 -166
  50. package/src/maths/calculator/plugins/core/remind.js +0 -96
  51. package/src/maths/calculator/plugins/core/stepNavigation.js +0 -175
  52. package/src/maths/calculator/plugins/modifiers/pow10.js +0 -143
  53. package/src/maths/calculator/plugins/modifiers/sign.js +0 -339
  54. package/src/maths/calculator/pluginsLoader.js +0 -46
@@ -1,10 +1,8 @@
1
- define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/calculator/plugins/modifiers/sign', 'ui/maths/calculator/plugins/modifiers/pow10', 'handlebars', 'lib/handlebars/helpers'], function (_, __, defaultCalculatorFactory, pluginSign, pluginPow10, Handlebars, Helpers0) { 'use strict';
1
+ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'handlebars', 'lib/handlebars/helpers'], function (_, __, defaultCalculatorFactory, Handlebars, Helpers0) { 'use strict';
2
2
 
3
3
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
4
4
  __ = __ && Object.prototype.hasOwnProperty.call(__, 'default') ? __['default'] : __;
5
5
  defaultCalculatorFactory = defaultCalculatorFactory && Object.prototype.hasOwnProperty.call(defaultCalculatorFactory, 'default') ? defaultCalculatorFactory['default'] : defaultCalculatorFactory;
6
- pluginSign = pluginSign && Object.prototype.hasOwnProperty.call(pluginSign, 'default') ? pluginSign['default'] : pluginSign;
7
- pluginPow10 = pluginPow10 && Object.prototype.hasOwnProperty.call(pluginPow10, 'default') ? pluginPow10['default'] : pluginPow10;
8
6
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
9
7
  Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;
10
8
 
@@ -35,11 +33,11 @@ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/cal
35
33
  buffer += "</span></button>\n <button class=\"key command\" data-command=\"historyDown\"><span>";
36
34
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.HISTORYDOWN)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
37
35
  if(stack1 || stack1 === 0) { buffer += stack1; }
38
- buffer += "</span></button>\n <button class=\"key command\" data-command=\"stepDeleteLeft\"><span>";
36
+ buffer += "</span></button>\n <button class=\"key command\" data-command=\"deleteLeft\"><span>";
39
37
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.BACKSPACE)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
40
38
  if(stack1 || stack1 === 0) { buffer += stack1; }
41
39
  buffer += "</span></button>\n <button class=\"key command\" data-command=\"clear\"><span>";
42
- stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.CLEARALL)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
40
+ stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.RESET)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
43
41
  if(stack1 || stack1 === 0) { buffer += stack1; }
44
42
  buffer += "</span></button>\n </div>\n <div class=\"row\">\n <button class=\"key operator\" data-command=\"term\" data-param=\"SIN\"><span>";
45
43
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.SIN)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
@@ -122,7 +120,7 @@ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/cal
122
120
  buffer += "</span></button>\n <button class=\"key operator\" data-command=\"term\" data-param=\"@NTHRT\"><span>";
123
121
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.NTHRT)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
124
122
  if(stack1 || stack1 === 0) { buffer += stack1; }
125
- buffer += "</span></button>\n <button class=\"key operator\" data-command=\"pow10\"><span>";
123
+ buffer += "</span></button>\n <button class=\"key operator\" data-command=\"term\" data-param=\"TEN POW\"><span>";
126
124
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.POW10)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
127
125
  if(stack1 || stack1 === 0) { buffer += stack1; }
128
126
  buffer += "</span></button>\n <button class=\"key operand\" data-command=\"term\" data-param=\"NUM1\"><span>";
@@ -161,7 +159,7 @@ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/cal
161
159
  buffer += "</span></button>\n <button class=\"key execute\" data-command=\"execute\"><span>";
162
160
  stack1 = ((stack1 = ((stack1 = (depth0 && depth0.labels)),stack1 == null || stack1 === false ? stack1 : stack1.EXECUTE)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
163
161
  if(stack1 || stack1 === 0) { buffer += stack1; }
164
- buffer += "</span></button>\n </div>\n</div>";
162
+ buffer += "</span></button>\n </div>\n</div>\n";
165
163
  return buffer;
166
164
  });
167
165
  function keyboardTpl(data, options, asString) {
@@ -210,14 +208,14 @@ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/cal
210
208
  * along with this program; if not, write to the Free Software
211
209
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
212
210
  *
213
- * Copyright (c) 2018 Open Assessment Technologies SA ;
211
+ * Copyright (c) 2018-2023 Open Assessment Technologies SA ;
214
212
  */
215
213
 
216
214
  /**
217
215
  * Default config values
218
216
  * @type {Object}
219
217
  */
220
- var defaultConfig = {
218
+ const defaultConfig = {
221
219
  title: __('Scientific Calculator'),
222
220
  width: 450,
223
221
  height: 400,
@@ -238,9 +236,6 @@ define(['lodash', 'i18n', 'ui/maths/calculator/defaultCalculator', 'ui/maths/cal
238
236
  // to the instance. This wil avoid global polluting by successive instances, as nested objects and arrays might
239
237
  // be simply copied.
240
238
  return defaultCalculatorFactory(_.merge({
241
- loadedPlugins: {
242
- modifiers: [pluginSign, pluginPow10]
243
- },
244
239
  calculator: {
245
240
  plugins: {
246
241
  templateKeyboard: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "1.67.0",
3
+ "version": "1.69.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -47,18 +47,17 @@
47
47
  "@babel/eslint-parser": "^7.19.1",
48
48
  "@babel/preset-env": "^7.19.4",
49
49
  "@oat-sa/browserslist-config-tao": "^1.0.1",
50
- "@oat-sa/eslint-config-tao": "^1.2.0",
51
- "@oat-sa/expr-eval": "^1.3.1",
50
+ "@oat-sa/eslint-config-tao": "^2.0.0",
52
51
  "@oat-sa/prettier-config": "^0.1.1",
53
52
  "@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
54
- "@oat-sa/tao-core-libs": "^0.5.1",
55
- "@oat-sa/tao-core-sdk": "^1.21.1",
53
+ "@oat-sa/tao-calculator": "^0.6.1",
54
+ "@oat-sa/tao-core-libs": "^0.5.2",
55
+ "@oat-sa/tao-core-sdk": "^2.0.0",
56
56
  "@oat-sa/tao-core-shared-libs": "^1.4.1",
57
57
  "@oat-sa/tao-qunit-testrunner": "^1.0.3",
58
58
  "async": "^0.2.10",
59
59
  "autoprefixer": "^9.5.1",
60
60
  "cross-env": "^7.0.2",
61
- "decimal.js": "10.1.1",
62
61
  "devbridge-autocomplete": "^1.2.20",
63
62
  "dompurify": "^2.4.0",
64
63
  "eslint": "^8.25.0",
@@ -75,7 +74,6 @@
75
74
  "lodash": "2.4.1",
76
75
  "moment": "^2.29.4",
77
76
  "moment-timezone": "^0.5.37",
78
- "moo": "^0.5.2",
79
77
  "npm-run-all": "^4.1.5",
80
78
  "nyc": "^15.0.1",
81
79
  "open-cli": "^7.1.0",
@@ -19,6 +19,7 @@ import $ from 'jquery';
19
19
  import _ from 'lodash';
20
20
  import dtdHandler from 'ui/ckeditor/dtdHandler';
21
21
  import 'ckeditor';
22
+ import context from 'context';
22
23
  import module from 'module';
23
24
  import featuresService from 'services/features';
24
25
 
@@ -56,7 +57,8 @@ const ckConfigurator = (function () {
56
57
  {
57
58
  name: 'links',
58
59
  items: ['Link']
59
- },{
60
+ },
61
+ {
60
62
  name: 'language',
61
63
  items: ['Language']
62
64
  }
@@ -454,7 +456,7 @@ const ckConfigurator = (function () {
454
456
  disableNativeTableHandles: true
455
457
  };
456
458
 
457
- if(moduleConfig && moduleConfig.specialChars) {
459
+ if (moduleConfig && moduleConfig.specialChars) {
458
460
  ckConfigDefault.specialChars = moduleConfig.specialChars;
459
461
  }
460
462
 
@@ -642,11 +644,11 @@ const ckConfigurator = (function () {
642
644
  }
643
645
  if (options.furiganaPlugin && featuresService.isVisible(furiganaPluginVisibilityKey, false)) {
644
646
  if (!options.toolbar || options.toolbar.find(el => el.items.includes('Superscript'))) {
645
- positionedPlugins.TaoFurigana = {insertAfter: 'Superscript'};
647
+ positionedPlugins.TaoFurigana = { insertAfter: 'Superscript' };
646
648
  } else {
647
649
  const lastGroup = options.toolbar[options.toolbar.length - 1];
648
650
  const firstPlugin = lastGroup.items[0];
649
- positionedPlugins.TaoFurigana = {insertBefore: firstPlugin};
651
+ positionedPlugins.TaoFurigana = { insertBefore: firstPlugin };
650
652
  }
651
653
  }
652
654
  }
@@ -666,6 +668,11 @@ const ckConfigurator = (function () {
666
668
  // add the toolbar
667
669
  if (typeof toolbars[toolbarType] !== 'undefined') {
668
670
  ckConfig.toolbar = toolbars[toolbarType];
671
+
672
+ //enable sourcedialog plugin upon featureflag (false by default)
673
+ if (context.featureFlags && context.featureFlags.FEATURE_FLAG_CKEDITOR_SOURCEDIALOG) {
674
+ ckConfig.toolbar.push({ name: 'sourcedialog', items: ['Sourcedialog'] });
675
+ }
669
676
  }
670
677
 
671
678
  // ensures positionedPlugins has the right format
@@ -13,10 +13,7 @@
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 defaultCalculatorFactory from 'ui/maths/calculator/defaultCalculator';
@@ -13,22 +13,19 @@
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-2019 Open Assessment Technologies SA ;
16
+ * Copyright (c) 2018-2023 Open Assessment Technologies SA ;
17
17
  */
18
- /**
19
- * @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
20
- */
21
- import _ from 'lodash';
18
+ import context from 'context';
22
19
  import dynamicComponent from 'ui/dynamicComponent';
23
20
  import calculatorBoardFactory from 'ui/maths/calculator/core/board';
24
- import pluginsLoader from 'ui/maths/calculator/pluginsLoader';
21
+ import pluginLoaderFactory from 'core/pluginLoader';
25
22
  import 'ui/maths/calculator/css/calculator.css';
26
23
 
27
24
  /**
28
25
  * Default config values
29
26
  * @type {Object}
30
27
  */
31
- var defaultConfig = {
28
+ const defaultConfig = {
32
29
  preserveAspectRatio: false,
33
30
  width: 240,
34
31
  height: 360,
@@ -46,70 +43,64 @@ var defaultConfig = {
46
43
  * @returns {dynamicComponent}
47
44
  */
48
45
  export default function calculatorComponentFactory(config) {
49
- var calculator, calculatorComponent;
46
+ let calculator;
50
47
 
51
- var api = {
48
+ const api = {
52
49
  /**
53
50
  * Gets the nested calculator
54
51
  * @returns {calculator}
55
52
  */
56
- getCalculator: function getCalculator() {
53
+ getCalculator() {
57
54
  return calculator;
58
55
  }
59
56
  };
60
57
 
61
- calculatorComponent = dynamicComponent(api, defaultConfig)
62
- .on('rendercontent', function($content) {
63
- const self = this;
64
- const initialWidth = self.getElement().width();
65
- const initialHeight = self.getElement().height();
58
+ const calculatorComponent = dynamicComponent(api, defaultConfig)
59
+ .on('rendercontent', function onRenderContent($content) {
60
+ const initialWidth = this.getElement().width();
61
+ const initialHeight = this.getElement().height();
66
62
 
67
- return pluginsLoader(this.getConfig().loadedPlugins, this.getConfig().dynamicPlugins).then(function(
68
- loadedPlugins
69
- ) {
70
- return new Promise(function(resolve) {
71
- calculator = calculatorBoardFactory($content, loadedPlugins, self.getConfig().calculator).on(
72
- 'ready',
73
- function() {
74
- var initialFontSize =
75
- parseInt(
76
- self
77
- .getCalculator()
78
- .getElement()
79
- .css('fontSize'),
80
- 10
81
- ) || 10;
82
- self.on('resize', function() {
83
- if (self.getElement()) {
84
- self.getCalculator()
85
- .getElement()
86
- .css(
87
- 'fontSize',
88
- initialFontSize *
89
- Math.min(
90
- self.getElement().width() / initialWidth,
91
- self.getElement().height() / initialHeight
92
- )
93
- );
94
- }
95
- })
96
- .setContentSize(
97
- calculator.getElement().outerWidth(),
98
- calculator.getElement().outerHeight()
99
- )
100
- .setState('ready')
101
- .trigger('ready');
102
- resolve();
103
- }
104
- );
63
+ return pluginLoaderFactory(this.getConfig().loadedPlugins)
64
+ .addList(this.getConfig().dynamicPlugins)
65
+ .load(context.bundle)
66
+ .then(loadedPlugins => {
67
+ return new Promise(resolve => {
68
+ calculator = calculatorBoardFactory($content, loadedPlugins, this.getConfig().calculator).on(
69
+ 'ready',
70
+ () => {
71
+ var initialFontSize =
72
+ parseInt(this.getCalculator().getElement().css('fontSize'), 10) || 10;
73
+ this.on('resize', () => {
74
+ if (this.getElement()) {
75
+ this.getCalculator()
76
+ .getElement()
77
+ .css(
78
+ 'fontSize',
79
+ initialFontSize *
80
+ Math.min(
81
+ this.getElement().width() / initialWidth,
82
+ this.getElement().height() / initialHeight
83
+ )
84
+ );
85
+ }
86
+ })
87
+ .setContentSize(
88
+ calculator.getElement().outerWidth(),
89
+ calculator.getElement().outerHeight()
90
+ )
91
+ .setState('ready')
92
+ .trigger('ready');
93
+ resolve();
94
+ }
95
+ );
96
+ });
105
97
  });
106
- });
107
98
  })
108
- .on('destroy', function() {
109
- return new Promise(function(resolve) {
99
+ .on('destroy', () => {
100
+ return new Promise(resolve => {
110
101
  if (calculator) {
111
102
  calculator
112
- .after('destroy', function() {
103
+ .after('destroy', () => {
113
104
  calculator = null;
114
105
  resolve();
115
106
  })
@@ -120,9 +111,7 @@ export default function calculatorComponentFactory(config) {
120
111
  });
121
112
  });
122
113
 
123
- _.defer(function() {
124
- calculatorComponent.init(config);
125
- });
114
+ setTimeout(() => calculatorComponent.init(config), 0);
126
115
 
127
116
  return calculatorComponent;
128
117
  }