@oat-sa/tao-core-ui 3.0.1 → 3.1.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.
@@ -1,5 +1,6 @@
1
- define(['exports', 'lodash'], function (exports, _) { 'use strict';
1
+ define(['exports', 'context', 'lodash'], function (exports, context, _) { 'use strict';
2
2
 
3
+ context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
3
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
4
5
 
5
6
  /**
@@ -17,7 +18,7 @@ define(['exports', 'lodash'], function (exports, _) { 'use strict';
17
18
  * along with this program; if not, write to the Free Software
18
19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20
  *
20
- * Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA;
21
+ * Copyright (c) 2021-2023 (original work) Open Assessment Technologies SA;
21
22
  */
22
23
  const FLOAT_LEFT_CLASS = 'wrap-left';
23
24
  const FLOAT_RIGHT_CLASS = 'wrap-right';
@@ -70,7 +71,7 @@ define(['exports', 'lodash'], function (exports, _) { 'use strict';
70
71
  } else {
71
72
  widget.element.removeAttr('class');
72
73
  }
73
- if (prevClassName !== className) {
74
+ if (!context.featureFlags['FEATURE_FLAG_DISABLE_FIGURE_WIDGET'] && prevClassName !== className) {
74
75
  // Re-build Figure widget to toggle between inline/block
75
76
  const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial);
76
77
  // avoid changes on Figure in a prompt
@@ -1,10 +1,11 @@
1
- define(['jquery', 'lodash', 'ui/component', 'handlebars', 'lib/handlebars/helpers', 'css!ui/mediaEditor/plugins/mediaAlignment/style.css'], function ($$1, _, component, Handlebars, Helpers0, style_css) { 'use strict';
1
+ define(['jquery', 'lodash', 'ui/component', 'handlebars', 'lib/handlebars/helpers', 'css!ui/mediaEditor/plugins/mediaAlignment/style.css', 'context'], function ($$1, _, component, Handlebars, Helpers0, style_css, context) { 'use strict';
2
2
 
3
3
  $$1 = $$1 && Object.prototype.hasOwnProperty.call($$1, 'default') ? $$1['default'] : $$1;
4
4
  _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
5
  component = component && Object.prototype.hasOwnProperty.call(component, 'default') ? component['default'] : component;
6
6
  Handlebars = Handlebars && Object.prototype.hasOwnProperty.call(Handlebars, 'default') ? Handlebars['default'] : Handlebars;
7
7
  Helpers0 = Helpers0 && Object.prototype.hasOwnProperty.call(Helpers0, 'default') ? Helpers0['default'] : Helpers0;
8
+ context = context && Object.prototype.hasOwnProperty.call(context, 'default') ? context['default'] : context;
8
9
 
9
10
  if (!Helpers0.__initialized) {
10
11
  Helpers0(Handlebars);
@@ -47,7 +48,7 @@ define(['jquery', 'lodash', 'ui/component', 'handlebars', 'lib/handlebars/helper
47
48
  * along with this program; if not, write to the Free Software
48
49
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
49
50
  *
50
- * Copyright (c) 2021-2022 (original work) Open Assessment Technologies SA;
51
+ * Copyright (c) 2021-2023 (original work) Open Assessment Technologies SA;
51
52
  */
52
53
  const FLOAT_LEFT_CLASS = 'wrap-left';
53
54
  const FLOAT_RIGHT_CLASS = 'wrap-right';
@@ -141,22 +141,28 @@ define(['jquery', 'lodash', 'i18n', 'ui/report', 'ui/feedback', 'layout/loading-
141
141
  * @param {Object} report - the standard report object
142
142
  * @param {String} title - the report title
143
143
  * @param {String} result - raw result data from the task creation action
144
+ * @param {boolean} displayContinueButton - display Continue button if true
144
145
  */
145
146
  displayReport: function displayReport(report, title, result) {
147
+ let displayContinueButton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
146
148
  var self = this,
147
149
  $reportContainer;
150
+ let actions = [];
151
+ if (displayContinueButton) {
152
+ actions = [{
153
+ id: 'continue',
154
+ icon: 'right',
155
+ title: 'continue',
156
+ label: __('Continue')
157
+ }];
158
+ }
148
159
  if (this.config.taskReportContainer instanceof $$1) {
149
160
  $reportContainer = $$1(reportTpl({
150
161
  title: title
151
162
  }));
152
163
  this.config.taskReportContainer.html($reportContainer);
153
164
  return reportFactory({
154
- actions: [{
155
- id: 'continue',
156
- icon: 'right',
157
- title: 'continue',
158
- label: __('Continue')
159
- }]
165
+ actions
160
166
  }, report).on('action-continue', function () {
161
167
  self.trigger('continue', result);
162
168
  }).render($reportContainer.find('.report'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -54,7 +54,7 @@
54
54
  "@oat-sa/tao-calculator": "^0.6.2",
55
55
  "@oat-sa/tao-core-libs": "^1.0.0",
56
56
  "@oat-sa/tao-core-sdk": "^3.0.0",
57
- "@oat-sa/tao-core-shared-libs": "^1.4.1",
57
+ "@oat-sa/tao-core-shared-libs": "^1.6.1",
58
58
  "@oat-sa/tao-qunit-testrunner": "^2.0.0",
59
59
  "async": "^0.2.10",
60
60
  "autoprefixer": "^10.4.14",
@@ -13,8 +13,9 @@
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) 2021-2022 (original work) Open Assessment Technologies SA;
16
+ * Copyright (c) 2021-2023 (original work) Open Assessment Technologies SA;
17
17
  */
18
+ import context from 'context';
18
19
  import _ from 'lodash';
19
20
 
20
21
  export const FLOAT_LEFT_CLASS = 'wrap-left';
@@ -74,7 +75,7 @@ export const positionFloat = function positionFloat(widget, position) {
74
75
  widget.element.removeAttr('class');
75
76
  }
76
77
 
77
- if (prevClassName !== className) {
78
+ if (!context.featureFlags['FEATURE_FLAG_DISABLE_FIGURE_WIDGET'] && prevClassName !== className) {
78
79
  // Re-build Figure widget to toggle between inline/block
79
80
  const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial);
80
81
  // avoid changes on Figure in a prompt
@@ -146,11 +146,22 @@ var taskableComponent = {
146
146
  * @param {Object} report - the standard report object
147
147
  * @param {String} title - the report title
148
148
  * @param {String} result - raw result data from the task creation action
149
+ * @param {boolean} displayContinueButton - display Continue button if true
149
150
  */
150
- displayReport: function displayReport(report, title, result) {
151
+ displayReport: function displayReport(report, title, result, displayContinueButton = true) {
151
152
  var self = this,
152
153
  $reportContainer;
153
154
 
155
+ let actions = [];
156
+ if (displayContinueButton) {
157
+ actions = [{
158
+ id: 'continue',
159
+ icon: 'right',
160
+ title: 'continue',
161
+ label: __('Continue')
162
+ }];
163
+ }
164
+
154
165
  if (this.config.taskReportContainer instanceof $) {
155
166
  $reportContainer = $(
156
167
  reportTpl({
@@ -162,14 +173,7 @@ var taskableComponent = {
162
173
 
163
174
  return reportFactory(
164
175
  {
165
- actions: [
166
- {
167
- id: 'continue',
168
- icon: 'right',
169
- title: 'continue',
170
- label: __('Continue')
171
- }
172
- ]
176
+ actions
173
177
  },
174
178
  report
175
179
  )