@oat-sa/tao-core-ui 3.7.0 → 3.8.1

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/datatable.js CHANGED
@@ -426,6 +426,8 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
426
426
 
427
427
  var buffer = "", stack1;
428
428
  buffer += "\n <button class=\"btn-info small "
429
+ + escapeExpression(((stack1 = (depth2 && depth2.cls)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
430
+ + " "
429
431
  + escapeExpression(((stack1 = (depth2 && depth2.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
430
432
  + "\"\n ";
431
433
  stack1 = helpers['if'].call(depth0, (depth2 && depth2.title), {hash:{},inverse:self.noop,fn:self.programWithDepth(71, program71, data, depth2),data:data});
@@ -549,6 +551,8 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
549
551
 
550
552
  var buffer = "", stack1;
551
553
  buffer += "\n <button class=\"btn-info small "
554
+ + escapeExpression(((stack1 = (depth2 && depth2.cls)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
555
+ + " "
552
556
  + escapeExpression(((stack1 = (depth2 && depth2.id)),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
553
557
  + "\"\n ";
554
558
  stack1 = helpers['if'].call(depth0, (depth2 && depth2.title), {hash:{},inverse:self.noop,fn:self.programWithDepth(71, program71, data, depth2),data:data});
@@ -686,6 +690,10 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
686
690
  }
687
691
 
688
692
  buffer += "<button class=\"btn-info small ";
693
+ if (helper = helpers.cls) { stack1 = helper.call(depth0, {hash:{},data:data}); }
694
+ else { helper = (depth0 && depth0.cls); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
695
+ buffer += escapeExpression(stack1)
696
+ + " ";
689
697
  if (helper = helpers.id) { stack1 = helper.call(depth0, {hash:{},data:data}); }
690
698
  else { helper = (depth0 && depth0.id); stack1 = typeof helper === functionType ? helper.call(depth0, {hash:{},data:data}) : helper; }
691
699
  buffer += escapeExpression(stack1)
@@ -1486,12 +1494,14 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
1486
1494
  const disabled = getPropertyValue('disabled', action, nextData);
1487
1495
  const icon = getPropertyValue('icon', action, nextData);
1488
1496
  const label = getPropertyValue('label', action, nextData);
1497
+ const cls = getPropertyValue('cls', action, nextData);
1489
1498
  const $actionButton = $$1(buttonTpl({
1490
1499
  id,
1491
1500
  icon,
1492
1501
  label,
1493
1502
  title,
1494
- disabled
1503
+ disabled,
1504
+ cls
1495
1505
  }));
1496
1506
  if (!hidden) {
1497
1507
  $actionCell.append('\n').append($actionButton);
@@ -514,6 +514,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
514
514
  const figurelem = this.widget.element;
515
515
  const $texarea = this.widget.$form.find('textarea#figcaption');
516
516
  texareaHTMLElem = $texarea[0];
517
+ texareaHTMLElem.style.minHeight = '2em';
517
518
  function outputsize() {
518
519
  figurelem.data('heigthCaptionInput', $texarea.height());
519
520
  }
@@ -78,13 +78,16 @@ define(['exports', 'context', 'lodash'], function (exports, context, _) { 'use s
78
78
  if (!context.featureFlags['FEATURE_FLAG_DISABLE_FIGURE_WIDGET'] && prevClassName !== className) {
79
79
  // Re-build Figure widget to toggle between inline/block
80
80
  const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial);
81
- // avoid changes on Figure in a prompt
82
- if (parent.contentModel && parent.contentModel === 'inlineStatic') {
81
+ // If Figure is not in A-block (Prompt, TextReader PCI)
82
+ if (parent.contentModel === 'inlineStatic' || widget.$container.closest('.qti-customInteraction').length) {
83
83
  _.defer(() => {
84
84
  widget.element.data('widget').refresh();
85
85
  });
86
86
  return;
87
87
  }
88
+ // If Figure is in A-block, text is inside '<p>'. When'<figure>' is added inside, this '<p>' tag gets split and a linebreak appears.
89
+ // here we change state to sleep-active so that the user will see that reflected in UI immediately.
90
+ // otherwise, he will see this linebreak only if he focuses text in this A-block again, or reopens the item.
88
91
  widget.element.data('widget').changeState('sleep');
89
92
  _.defer(() => {
90
93
  if (parent && parent.data('widget')) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "3.7.0",
3
+ "version": "3.8.1",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -19,8 +19,7 @@
19
19
  "build:scss": "node ./build/scss.js",
20
20
  "lint:src": "eslint -c .eslintrc.js src",
21
21
  "lint:test": "eslint -c test/.eslintrc.js test",
22
- "lint:report": "eslint -c .eslintrc.js --output-file eslint_report.json --format json src | true",
23
- "prepare": "npm run build:all"
22
+ "lint:report": "eslint -c .eslintrc.js --output-file eslint_report.json --format json src | true"
24
23
  },
25
24
  "keywords": [
26
25
  "tao",
File without changes
@@ -1,4 +1,4 @@
1
- <button class="btn-info small {{id}}"
1
+ <button class="btn-info small {{cls}} {{id}}"
2
2
  {{#if title}} title="{{title}}"{{/if}}
3
3
  {{#if disabled}} disabled="disabled"{{/if}}>
4
4
  {{#if icon}}<span class="icon-{{icon}}"></span>{{/if}}
@@ -97,7 +97,7 @@
97
97
  {{#if id}}
98
98
  {{#with ../../../../this}}
99
99
  {{#unless ../hidden}}
100
- <button class="btn-info small {{../../id}}"
100
+ <button class="btn-info small {{../../cls}} {{../../id}}"
101
101
  {{#if ../../title}} title="{{../../../title}}"{{/if}}
102
102
  {{#if ../../disabled}} disabled="disabled"{{/if}}>
103
103
  {{#if ../../icon}}<span class="icon-{{../../../icon}}"></span>{{/if}}
@@ -128,7 +128,7 @@
128
128
  {{#if id}}
129
129
  {{#with ../../../this}}
130
130
  {{#unless ../hidden}}
131
- <button class="btn-info small {{../../id}}"
131
+ <button class="btn-info small {{../../cls}} {{../../id}}"
132
132
  {{#if ../../title}} title="{{../../../title}}"{{/if}}
133
133
  {{#if ../../disabled}} disabled="disabled"{{/if}}>
134
134
  {{#if ../../icon}}<span class="icon-{{../../../icon}}"></span>{{/if}}
package/src/datatable.js CHANGED
@@ -887,7 +887,8 @@ const dataTable = {
887
887
  const disabled = getPropertyValue('disabled', action, nextData);
888
888
  const icon = getPropertyValue('icon', action, nextData);
889
889
  const label = getPropertyValue('label', action, nextData);
890
- const $actionButton = $(buttonTpl({ id, icon, label, title, disabled }));
890
+ const cls = getPropertyValue('cls', action, nextData);
891
+ const $actionButton = $(buttonTpl({ id, icon, label, title, disabled, cls }));
891
892
 
892
893
  if (!hidden) {
893
894
  $actionCell.append('\n').append($actionButton);
File without changes
package/src/feedback.js CHANGED
File without changes
@@ -169,6 +169,7 @@ export default function ({ stateFactory, ActiveState, formTpl, formElement, inli
169
169
  const figurelem = this.widget.element;
170
170
  const $texarea = this.widget.$form.find('textarea#figcaption');
171
171
  texareaHTMLElem = $texarea[0];
172
+ texareaHTMLElem.style.minHeight = '2em';
172
173
  function outputsize() {
173
174
  figurelem.data('heigthCaptionInput', $texarea.height());
174
175
  }
@@ -82,13 +82,16 @@ export const positionFloat = function positionFloat(widget, position) {
82
82
  if (!context.featureFlags['FEATURE_FLAG_DISABLE_FIGURE_WIDGET'] && prevClassName !== className) {
83
83
  // Re-build Figure widget to toggle between inline/block
84
84
  const parent = searchRecurse(widget.element.bdy.rootElement.bdy, widget.serial);
85
- // avoid changes on Figure in a prompt
86
- if (parent.contentModel && parent.contentModel === 'inlineStatic') {
85
+ // If Figure is not in A-block (Prompt, TextReader PCI)
86
+ if (parent.contentModel === 'inlineStatic' || widget.$container.closest('.qti-customInteraction').length) {
87
87
  _.defer(() => {
88
88
  widget.element.data('widget').refresh();
89
89
  });
90
90
  return;
91
91
  }
92
+ // If Figure is in A-block, text is inside '<p>'. When'<figure>' is added inside, this '<p>' tag gets split and a linebreak appears.
93
+ // here we change state to sleep-active so that the user will see that reflected in UI immediately.
94
+ // otherwise, he will see this linebreak only if he focuses text in this A-block again, or reopens the item.
92
95
  widget.element.data('widget').changeState('sleep');
93
96
  _.defer(() => {
94
97
  if (parent && parent.data('widget')) {
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes