@oat-sa/tao-core-ui 1.57.0 → 1.58.2

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 (171) hide show
  1. package/dist/actionbar.js +386 -395
  2. package/dist/adder.js +21 -19
  3. package/dist/animable/absorbable/absorbable.js +204 -213
  4. package/dist/animable/absorbable/css/absorb.css +1 -0
  5. package/dist/animable/absorbable/css/absorb.css.map +1 -1
  6. package/dist/animable/pulsable/pulsable.js +168 -177
  7. package/dist/autocomplete/css/autocomplete.css +1 -0
  8. package/dist/autocomplete/css/autocomplete.css.map +1 -1
  9. package/dist/autocomplete.js +68 -66
  10. package/dist/badge/badge.js +188 -197
  11. package/dist/badge/css/badge.css +1 -0
  12. package/dist/badge/css/badge.css.map +1 -1
  13. package/dist/breadcrumbs.js +275 -284
  14. package/dist/btngrouper.js +5 -5
  15. package/dist/bulkActionPopup.js +490 -495
  16. package/dist/button.js +283 -291
  17. package/dist/cascadingComboBox.js +249 -258
  18. package/dist/ckeditor/ckConfigurator.js +42 -20
  19. package/dist/ckeditor/dtdHandler.js +11 -9
  20. package/dist/class/selector.js +441 -450
  21. package/dist/component/resizable.js +1 -1
  22. package/dist/component/windowed.js +285 -294
  23. package/dist/component.js +419 -428
  24. package/dist/contextualPopup.js +417 -426
  25. package/dist/dashboard.js +300 -309
  26. package/dist/datalist.js +753 -762
  27. package/dist/datatable/filterStrategy/multiple.js +1 -1
  28. package/dist/datatable/filterStrategy/single.js +1 -1
  29. package/dist/datatable.js +1527 -1550
  30. package/dist/dateRange/dateRange.js +393 -402
  31. package/dist/datetime/picker.js +665 -672
  32. package/dist/deleter.js +368 -377
  33. package/dist/destination/selector.js +286 -295
  34. package/dist/dialog/alert.js +3 -3
  35. package/dist/dialog/confirm.js +1 -1
  36. package/dist/dialog/confirmDelete.js +216 -225
  37. package/dist/dialog.js +650 -654
  38. package/dist/disabler.js +8 -8
  39. package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
  40. package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
  41. package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
  42. package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
  43. package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
  44. package/dist/documentViewer/providers/pdfViewer.js +184 -193
  45. package/dist/documentViewer.js +292 -301
  46. package/dist/dropdown.js +383 -392
  47. package/dist/durationer.js +5 -5
  48. package/dist/dynamicComponent.js +597 -598
  49. package/dist/feedback.js +356 -362
  50. package/dist/figure/FigureStateActive.js +117 -108
  51. package/dist/filesender.js +2 -2
  52. package/dist/filter.js +230 -239
  53. package/dist/form/dropdownForm.js +355 -357
  54. package/dist/form/form.js +919 -690
  55. package/dist/form/simpleForm.js +1 -1
  56. package/dist/form/validator/renderer.js +233 -235
  57. package/dist/form/validator/validator.js +257 -189
  58. package/dist/form/widget/definitions.js +1 -1
  59. package/dist/form/widget/providers/checkBox.js +254 -259
  60. package/dist/form/widget/providers/comboBox.js +187 -192
  61. package/dist/form/widget/providers/default.js +8 -9
  62. package/dist/form/widget/providers/hidden.js +170 -179
  63. package/dist/form/widget/providers/hiddenBox.js +262 -267
  64. package/dist/form/widget/providers/radioBox.js +216 -225
  65. package/dist/form/widget/providers/textArea.js +187 -196
  66. package/dist/form/widget/providers/textBox.js +2 -3
  67. package/dist/form/widget/widget.js +473 -475
  68. package/dist/formValidator/formValidator.js +1 -1
  69. package/dist/formValidator/highlighters/message.js +1 -1
  70. package/dist/generis/form/form.js +314 -323
  71. package/dist/generis/validator/validator.js +209 -218
  72. package/dist/generis/widget/checkBox/checkBox.js +218 -227
  73. package/dist/generis/widget/comboBox/comboBox.js +179 -188
  74. package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
  75. package/dist/generis/widget/textBox/textBox.js +169 -178
  76. package/dist/generis/widget/widget.js +246 -255
  77. package/dist/groupedComboBox.js +222 -231
  78. package/dist/groupvalidator.js +2 -2
  79. package/dist/highlighter.js +967 -958
  80. package/dist/image/ImgStateActive/helper.js +7 -5
  81. package/dist/image/ImgStateActive/initHelper.js +49 -43
  82. package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
  83. package/dist/image/ImgStateActive/mediaSizer.js +14 -12
  84. package/dist/image/ImgStateActive.js +72 -70
  85. package/dist/incrementer.js +6 -6
  86. package/dist/inplacer.js +6 -6
  87. package/dist/itemButtonList/css/item-button-list.css +1 -0
  88. package/dist/itemButtonList/css/item-button-list.css.map +1 -1
  89. package/dist/itemButtonList.js +439 -435
  90. package/dist/keyNavigation/navigableDomElement.js +51 -38
  91. package/dist/keyNavigation/navigator.js +85 -70
  92. package/dist/listbox.js +460 -469
  93. package/dist/liststyler.js +8 -8
  94. package/dist/loadingButton/loadingButton.js +209 -218
  95. package/dist/lock.js +476 -485
  96. package/dist/login/login.js +475 -484
  97. package/dist/maths/calculator/basicCalculator.js +235 -244
  98. package/dist/maths/calculator/calculatorComponent.js +3 -3
  99. package/dist/maths/calculator/core/board.js +772 -781
  100. package/dist/maths/calculator/core/expression.js +476 -485
  101. package/dist/maths/calculator/core/labels.js +228 -237
  102. package/dist/maths/calculator/core/tokenizer.js +1 -1
  103. package/dist/maths/calculator/core/tokens.js +163 -170
  104. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
  105. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
  106. package/dist/maths/calculator/scientificCalculator.js +327 -336
  107. package/dist/mediaEditor/mediaEditorComponent.js +238 -245
  108. package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
  109. package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
  110. package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
  111. package/dist/mediaplayer/players/html5.js +666 -675
  112. package/dist/mediaplayer/players/youtube.js +419 -424
  113. package/dist/mediaplayer/support.js +11 -10
  114. package/dist/mediaplayer/utils/reminder.js +14 -13
  115. package/dist/mediaplayer/utils/timeObserver.js +10 -11
  116. package/dist/mediaplayer/youtubeManager.js +164 -145
  117. package/dist/mediaplayer.js +1565 -1520
  118. package/dist/mediasizer.js +669 -678
  119. package/dist/modal.js +10 -17
  120. package/dist/pageSizeSelector.js +219 -228
  121. package/dist/pagination/providers/pages.js +280 -289
  122. package/dist/pagination/providers/simple.js +192 -201
  123. package/dist/previewer.js +30 -30
  124. package/dist/progressbar.js +4 -4
  125. package/dist/report.js +347 -356
  126. package/dist/resource/filters.js +271 -280
  127. package/dist/resource/list.js +1264 -1273
  128. package/dist/resource/selector.js +865 -874
  129. package/dist/resource/tree.js +1483 -1492
  130. package/dist/resourcemgr/fileBrowser.js +564 -569
  131. package/dist/resourcemgr/filePreview.js +16 -16
  132. package/dist/resourcemgr/fileSelector.js +515 -524
  133. package/dist/resourcemgr/util/updatePermissions.js +2 -2
  134. package/dist/resourcemgr.js +306 -315
  135. package/dist/searchModal/advancedSearch.js +796 -767
  136. package/dist/searchModal.js +597 -549
  137. package/dist/switch/switch.js +298 -307
  138. package/dist/tabs.js +598 -575
  139. package/dist/taskQueue/status.js +312 -321
  140. package/dist/taskQueue/table.js +375 -384
  141. package/dist/taskQueue/taskQueueModel.js +488 -472
  142. package/dist/taskQueueButton/taskable.js +264 -273
  143. package/dist/taskQueueButton/treeButton.js +189 -198
  144. package/dist/themeLoader.js +24 -23
  145. package/dist/themes.js +1 -1
  146. package/dist/toggler.js +3 -3
  147. package/dist/tooltip.js +295 -304
  148. package/dist/transformer.js +2 -2
  149. package/dist/tristateCheckboxGroup.js +311 -320
  150. package/dist/uploader.js +687 -696
  151. package/dist/validator/Report.js +1 -1
  152. package/dist/validator/Validator.js +3 -3
  153. package/dist/validator/validators.js +9 -9
  154. package/dist/validator.js +240 -230
  155. package/dist/waitForMedia.js +1 -1
  156. package/package.json +3 -3
  157. package/scss/ckeditor/skins/tao/scss/inc/_menu.scss +51 -27
  158. package/scss/ckeditor/skins/tao/scss/inc/_panel.scss +16 -5
  159. package/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -2
  160. package/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +15 -3
  161. package/src/animable/absorbable/css/absorb.css +1 -0
  162. package/src/animable/absorbable/css/absorb.css.map +1 -1
  163. package/src/autocomplete/css/autocomplete.css +1 -0
  164. package/src/autocomplete/css/autocomplete.css.map +1 -1
  165. package/src/badge/css/badge.css +1 -0
  166. package/src/badge/css/badge.css.map +1 -1
  167. package/src/ckeditor/ckConfigurator.js +24 -1
  168. package/src/itemButtonList/css/item-button-list.css +1 -0
  169. package/src/itemButtonList/css/item-button-list.css.map +1 -1
  170. package/scss/.DS_Store +0 -0
  171. package/src/.DS_Store +0 -0
@@ -1,6 +1,6 @@
1
1
  define(function () { 'use strict';
2
2
 
3
- var Report = function (type, data) {
3
+ var Report = function Report(type, data) {
4
4
  this.type = type;
5
5
  this.data = data;
6
6
  };
@@ -5,7 +5,7 @@ define(['lodash', 'async', 'ui/validator/Report', 'ui/validator/validators'], fu
5
5
  Report = Report && Object.prototype.hasOwnProperty.call(Report, 'default') ? Report['default'] : Report;
6
6
  validators = validators && Object.prototype.hasOwnProperty.call(validators, 'default') ? validators['default'] : validators;
7
7
 
8
- var _buildRule = function (rule) {
8
+ var _buildRule = function _buildRule(rule) {
9
9
  var ret = null;
10
10
  var _rules = validators.validators;
11
11
 
@@ -26,12 +26,12 @@ define(['lodash', 'async', 'ui/validator/Report', 'ui/validator/validators'], fu
26
26
  lazy: false
27
27
  };
28
28
 
29
- var _applyRules = function (value, rule, callback, options) {
29
+ var _applyRules = function _applyRules(value, rule, callback, options) {
30
30
  options = _.merge(_.cloneDeep(rule.options), options);
31
31
  rule.validate(value, callback, options);
32
32
  };
33
33
 
34
- var Validator = function (rules, options) {
34
+ var Validator = function Validator(rules, options) {
35
35
  this.options = _.merge(_.cloneDeep(_defaultOptions), options);
36
36
  this.rules = [];
37
37
  this.addRules(rules);
@@ -69,7 +69,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
69
69
  name: 'numeric',
70
70
  message: __('The value of this field must be numeric'),
71
71
  options: {},
72
- validate: function (value, callback) {
72
+ validate: function validate(value, callback) {
73
73
  var parsedValue = parseFloat(value),
74
74
  r = parsedValue.toString() === value.toString() && _.isNumber(parsedValue) && !_.isNaN(parsedValue);
75
75
 
@@ -82,7 +82,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
82
82
  name: 'notEmpty',
83
83
  message: __('this is required'),
84
84
  options: {},
85
- validate: function (value, callback) {
85
+ validate: function validate(value, callback) {
86
86
  var r;
87
87
 
88
88
  if (_.isNumber(value)) {
@@ -112,7 +112,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
112
112
  min: 0,
113
113
  max: 0
114
114
  },
115
- validate: function (value, callback, options) {
115
+ validate: function validate(value, callback, options) {
116
116
  var r = false;
117
117
 
118
118
  if (value.length >= options.min) {
@@ -141,9 +141,9 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
141
141
  return;
142
142
  }
143
143
 
144
- const parser = new UrlParser(value);
145
- const protocol = parser.get('protocol');
146
- const isHttp = protocol === 'http:' || protocol === 'https:';
144
+ var parser = new UrlParser(value);
145
+ var protocol = parser.get('protocol');
146
+ var isHttp = protocol === 'http:' || protocol === 'https:';
147
147
 
148
148
  if (!(urlUtil.isAbsolute(value) && isHttp) && !urlUtil.isBase64(value)) {
149
149
  //request HEAD only for bandwidth saving
@@ -152,10 +152,10 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
152
152
  //FIXME change this to use an URL without transfomations. the validator should be called with the right URL,
153
153
  //here it works only for the getFile service...
154
154
  url: options.baseUrl + encodeURIComponent(value),
155
- success: function () {
155
+ success: function success() {
156
156
  callback(true);
157
157
  },
158
- error: function (jqXHR, textStatus, errorThrown) {
158
+ error: function error(jqXHR, textStatus, errorThrown) {
159
159
  callback(false);
160
160
  }
161
161
  });
@@ -169,7 +169,7 @@ define(['jquery', 'lodash', 'i18n', 'util/url', 'util/urlParser'], function ($,
169
169
  name: 'validRegex',
170
170
  message: __('invalid regular expression'),
171
171
  options: {},
172
- validate: function (value, callback) {
172
+ validate: function validate(value, callback) {
173
173
  if (typeof callback === 'function') {
174
174
  var valid = false;
175
175
 
package/dist/validator.js CHANGED
@@ -1,272 +1,282 @@
1
1
  define(['jquery', 'lodash', 'ui/validator/Report', 'ui/validator/Validator'], function ($, _, Report, Validator) { 'use strict';
2
2
 
3
- $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
4
- _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
- Report = Report && Object.prototype.hasOwnProperty.call(Report, 'default') ? Report['default'] : Report;
6
- Validator = Validator && Object.prototype.hasOwnProperty.call(Validator, 'default') ? Validator['default'] : Validator;
7
-
8
- /**
9
- * Validate the set of matched elements (inputs).
10
- *
11
- * @example $('input').validator() - validate with default options;
12
- * @example $('input').validator(options) - validate with custom validation options;
13
- * @example $('input').validator('validate', {allowEmpty:true}, callback) - validate with custom validation options and callback function;
14
- * @exports validator/jquery.validator
15
- * @param {Object|String} options - the validator options or method name to call
16
- * @param {boolean} [options.allowEmpty = false] - whether the input can be empty
17
- * @param {object} [options.validator]
18
- * @param {boolean} [options.validator.lazy]
19
- * @param {string|Array} [options.events] - event that triggers the validation
20
- * @param {object} arg1 - the validator options
21
- * @fires validated.group
22
- * @returns {jQueryElement} for chaining
23
- */
24
-
25
- $.fn.validator = function (options, arg1, arg2) {
26
- var opts = {},
27
- method = '',
28
- args = [],
29
- ret;
30
-
31
- if (typeof options === 'object') {
32
- opts = $.extend({}, $.fn.validator.defaults, options);
33
- } else if (options === undefined) {
34
- opts = $.extend({}, $.fn.validator.defaults); //use default
35
- } else if (typeof options === 'string') {
36
- if (typeof methods[options] === 'function') {
37
- method = options;
38
- args = Array.prototype.slice.call(arguments, 1);
39
- }
3
+ $ = $ && Object.prototype.hasOwnProperty.call($, 'default') ? $['default'] : $;
4
+ _ = _ && Object.prototype.hasOwnProperty.call(_, 'default') ? _['default'] : _;
5
+ Report = Report && Object.prototype.hasOwnProperty.call(Report, 'default') ? Report['default'] : Report;
6
+ Validator = Validator && Object.prototype.hasOwnProperty.call(Validator, 'default') ? Validator['default'] : Validator;
7
+
8
+ function _typeof(obj) {
9
+ "@babel/helpers - typeof";
10
+
11
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
12
+ return typeof obj;
13
+ } : function (obj) {
14
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
15
+ }, _typeof(obj);
16
+ }
17
+
18
+ /**
19
+ * Validate the set of matched elements (inputs).
20
+ *
21
+ * @example $('input').validator() - validate with default options;
22
+ * @example $('input').validator(options) - validate with custom validation options;
23
+ * @example $('input').validator('validate', {allowEmpty:true}, callback) - validate with custom validation options and callback function;
24
+ * @exports validator/jquery.validator
25
+ * @param {Object|String} options - the validator options or method name to call
26
+ * @param {boolean} [options.allowEmpty = false] - whether the input can be empty
27
+ * @param {object} [options.validator]
28
+ * @param {boolean} [options.validator.lazy]
29
+ * @param {string|Array} [options.events] - event that triggers the validation
30
+ * @param {object} arg1 - the validator options
31
+ * @fires validated.group
32
+ * @returns {jQueryElement} for chaining
33
+ */
34
+
35
+ $.fn.validator = function (options, arg1, arg2) {
36
+ var opts = {},
37
+ method = '',
38
+ args = [],
39
+ ret;
40
+
41
+ if (_typeof(options) === 'object') {
42
+ opts = $.extend({}, $.fn.validator.defaults, options);
43
+ } else if (options === undefined) {
44
+ opts = $.extend({}, $.fn.validator.defaults); //use default
45
+ } else if (typeof options === 'string') {
46
+ if (typeof methods[options] === 'function') {
47
+ method = options;
48
+ args = Array.prototype.slice.call(arguments, 1);
40
49
  }
50
+ }
41
51
 
42
- this.each(function () {
43
- var $this = $(this);
52
+ this.each(function () {
53
+ var $this = $(this);
44
54
 
45
- if (!isCreated($this)) {
46
- create($this, opts);
47
- }
55
+ if (!isCreated($this)) {
56
+ create($this, opts);
57
+ }
48
58
 
49
- if (method) {
50
- if (isCreated($this)) {
51
- ret = methods[method].apply($(this), args);
52
- } else {
53
- $.error('call of method of validator when it is not initialized');
54
- }
59
+ if (method) {
60
+ if (isCreated($this)) {
61
+ ret = methods[method].apply($(this), args);
62
+ } else {
63
+ $.error('call of method of validator when it is not initialized');
55
64
  }
56
- });
57
- return ret === undefined ? this : ret;
58
- };
59
-
60
- $.fn.validator.defaults = {
61
- allowEmpty: false,
62
- validator: {
63
- lazy: false
64
65
  }
65
- };
66
-
67
- function isCreated($elt) {
68
- return typeof $elt.data('validator-config') === 'object';
66
+ });
67
+ return ret === undefined ? this : ret;
68
+ };
69
+
70
+ $.fn.validator.defaults = {
71
+ allowEmpty: false,
72
+ validator: {
73
+ lazy: false
69
74
  }
75
+ };
70
76
 
71
- var methods = {
72
- destroy: function () {
73
- destroy($(this));
74
- },
75
- validate: function (arg1, arg2) {
76
- var callback,
77
- options = {}; //prepare args:
77
+ function isCreated($elt) {
78
+ return _typeof($elt.data('validator-config')) === 'object';
79
+ }
78
80
 
79
- if (_.isFunction(arg1)) {
80
- callback = arg1;
81
- } else if (_.isObject(arg1)) {
82
- _.merge(options, arg1); //treat it like the options array:
81
+ var methods = {
82
+ destroy: function destroy() {
83
+ _destroy($(this));
84
+ },
85
+ validate: function validate(arg1, arg2) {
86
+ var callback,
87
+ options = {}; //prepare args:
83
88
 
89
+ if (_.isFunction(arg1)) {
90
+ callback = arg1;
91
+ } else if (_.isObject(arg1)) {
92
+ _.merge(options, arg1); //treat it like the options array:
84
93
 
85
- if (_.isFunction(arg2)) {
86
- callback = arg2;
87
- }
88
- } //event the callback is optional, since we may set an event listener instead
89
94
 
95
+ if (_.isFunction(arg2)) {
96
+ callback = arg2;
97
+ }
98
+ } //event the callback is optional, since we may set an event listener instead
90
99
 
91
- validate($(this), callback, options);
92
- },
93
- getValidator: function () {
94
- return $(this).data('validator-instance');
95
- }
96
- };
97
- /**
98
- * rule must have been set in the following string format:
99
- * $validatorName1; $validatorName2(optionName1=optionValue1, optionName2=optionValue2)
100
- *
101
- * example:
102
- * $notEmpty; $pattern(pattern=[A-Z][a-z]{3,}, modifier=i);
103
- *
104
- * @param {type} $elt
105
- * @returns {object}
106
- */
107
-
108
- var buildRules = function ($elt) {
109
- var rulesStr = $elt.data('validate'),
110
- rules = rulesStr ? tokenize(rulesStr) : {};
111
- return rules;
112
- };
113
100
 
114
- var tokenize = function (inputStr) {
115
- var ret = []; //return object
101
+ _validate($(this), callback, options);
102
+ },
103
+ getValidator: function getValidator() {
104
+ return $(this).data('validator-instance');
105
+ }
106
+ };
107
+ /**
108
+ * rule must have been set in the following string format:
109
+ * $validatorName1; $validatorName2(optionName1=optionValue1, optionName2=optionValue2)
110
+ *
111
+ * example:
112
+ * $notEmpty; $pattern(pattern=[A-Z][a-z]{3,}, modifier=i);
113
+ *
114
+ * @param {type} $elt
115
+ * @returns {object}
116
+ */
117
+
118
+ var buildRules = function buildRules($elt) {
119
+ var rulesStr = $elt.data('validate'),
120
+ rules = rulesStr ? tokenize(rulesStr) : {};
121
+ return rules;
122
+ };
123
+
124
+ var tokenize = function tokenize(inputStr) {
125
+ var ret = []; //return object
126
+
127
+ var tokens = inputStr.split(/;/); //get name (and options) for every rules strings:
128
+
129
+ _.each(tokens, function (token) {
130
+ token = $.trim(token);
131
+ var key,
132
+ options = {},
133
+ rightStr = token.replace(/\$(\w*)/, function ($0, k) {
134
+ key = k;
135
+ return '';
136
+ });
116
137
 
117
- var tokens = inputStr.split(/;/); //get name (and options) for every rules strings:
138
+ if (key) {
139
+ //remove brackets
140
+ var optionsStr = rightStr.replace(/^\((.*)\)$/, '$1'); //get string options
118
141
 
119
- _.each(tokens, function (token) {
120
- token = $.trim(token);
121
- var key,
122
- options = {},
123
- rightStr = token.replace(/\$(\w*)/, function ($0, k) {
124
- key = k;
142
+ optionsStr = optionsStr.replace(/(\w+)=((\"(\\.|[^\"])*\")|(\'(\\.|[^\'])*\')),?/g, function ($0, optionName, optionValue) {
143
+ //replace quotes
144
+ optionValue = optionValue.replace(/^["'](.*)["']$/g, '$1');
145
+ options[optionName] = optionValue;
125
146
  return '';
126
147
  });
148
+ optionsStr.replace(/(\w*)=([^\s]*)(,)?/g, function ($0, optionName, optionValue) {
149
+ if (optionValue.charAt(optionValue.length - 1) === ',') {
150
+ optionValue = optionValue.substring(0, optionValue.length - 1);
151
+ }
127
152
 
128
- if (key) {
129
- //remove brackets
130
- var optionsStr = rightStr.replace(/^\((.*)\)$/, '$1'); //get string options
131
-
132
- optionsStr = optionsStr.replace(/(\w+)=((\"(\\.|[^\"])*\")|(\'(\\.|[^\'])*\')),?/g, function ($0, optionName, optionValue) {
133
- //replace quotes
134
- optionValue = optionValue.replace(/^["'](.*)["']$/g, '$1');
135
- options[optionName] = optionValue;
136
- return '';
137
- });
138
- optionsStr.replace(/(\w*)=([^\s]*)(,)?/g, function ($0, optionName, optionValue) {
139
- if (optionValue.charAt(optionValue.length - 1) === ',') {
140
- optionValue = optionValue.substring(0, optionValue.length - 1);
141
- }
142
-
143
- options[optionName] = optionValue;
144
- });
145
- ret.push({
146
- name: key,
147
- options: options
148
- });
149
- }
150
- });
151
-
152
- return ret;
153
- };
154
-
155
- var buildOptions = function ($elt) {
156
- var optionsStr = $elt.data('validate-option'),
157
- optionsArray = optionsStr ? tokenize(optionsStr) : {},
158
- availableCoreValidatorOptions = _.keys(Validator.getDefaultOptions()),
159
- options = _.clone($.fn.validator.defaults); //separate core.validator options from jquery.validator options
153
+ options[optionName] = optionValue;
154
+ });
155
+ ret.push({
156
+ name: key,
157
+ options: options
158
+ });
159
+ }
160
+ });
160
161
 
162
+ return ret;
163
+ };
161
164
 
162
- _.each(optionsArray, function (optionArray) {
163
- if (_.indexOf(availableCoreValidatorOptions, optionArray.name) >= 0) {
164
- options.validator[optionArray.name] = optionArray.options;
165
- } else {
166
- options[optionArray.name] = optionArray.options;
167
- }
168
- });
165
+ var buildOptions = function buildOptions($elt) {
166
+ var optionsStr = $elt.data('validate-option'),
167
+ optionsArray = optionsStr ? tokenize(optionsStr) : {},
168
+ availableCoreValidatorOptions = _.keys(Validator.getDefaultOptions()),
169
+ options = _.clone($.fn.validator.defaults); //separate core.validator options from jquery.validator options
169
170
 
170
- return options;
171
- };
172
171
 
173
- var create = function ($elt, options) {
174
- if (isCreated($elt)) {
175
- return;
172
+ _.each(optionsArray, function (optionArray) {
173
+ if (_.indexOf(availableCoreValidatorOptions, optionArray.name) >= 0) {
174
+ options.validator[optionArray.name] = optionArray.options;
175
+ } else {
176
+ options[optionArray.name] = optionArray.options;
176
177
  }
178
+ });
177
179
 
178
- var rules = buildRules($elt);
180
+ return options;
181
+ };
179
182
 
180
- if (options.rules) {
181
- rules = _.merge(rules, options.rules);
182
- delete options.rules;
183
- }
183
+ var create = function create($elt, options) {
184
+ if (isCreated($elt)) {
185
+ return;
186
+ }
184
187
 
185
- options = _.merge(options, buildOptions($elt) || {});
186
- $elt.data('validator-config', _.clone(options));
187
- createValidator($elt, rules, options);
188
- };
188
+ var rules = buildRules($elt);
189
189
 
190
- var destroy = function ($elts) {
191
- $elts.removeData('validator-instance validator-config');
192
- $elts.off('.validator');
193
- };
190
+ if (options.rules) {
191
+ rules = _.merge(rules, options.rules);
192
+ delete options.rules;
193
+ }
194
194
 
195
- var createValidator = function ($elt, rules, options) {
196
- $elt.data('validator-instance', new Validator(rules, options.validator || {}));
195
+ options = _.merge(options, buildOptions($elt) || {});
196
+ $elt.data('validator-config', _.clone(options));
197
+ createValidator($elt, rules, options);
198
+ };
197
199
 
198
- if (options.event) {
199
- bindEvents($elt, options);
200
- }
201
- };
200
+ var _destroy = function _destroy($elts) {
201
+ $elts.removeData('validator-instance validator-config');
202
+ $elts.off('.validator');
203
+ };
202
204
 
203
- var bindEvents = function ($elt, options) {
204
- var events = _.isArray(options.event) ? options.event : [options.event];
205
+ var createValidator = function createValidator($elt, rules, options) {
206
+ $elt.data('validator-instance', new Validator(rules, options.validator || {}));
205
207
 
206
- if (events.length > 0 && _.isFunction(options.validated)) {
207
- _.forEach(events, function (event) {
208
- if (_.isString(event)) {
209
- event = {
210
- type: event
211
- };
212
- }
208
+ if (options.event) {
209
+ bindEvents($elt, options);
210
+ }
211
+ };
213
212
 
214
- switch (event.type) {
215
- case 'keyup':
216
- case 'keydown':
217
- $elt.on(event.type, function () {
218
- var v = $elt.val();
219
-
220
- if (event.length) {
221
- if (v && v.length > event.length) {
222
- validate($elt, options.validated, {});
223
- }
224
- } else {
225
- validate($elt, options.validated, {});
226
- }
227
- });
228
- break;
229
-
230
- case 'change':
231
- case 'blur':
232
- $elt.on(event.type, function () {
233
- validate($elt, options.validated, {});
234
- });
235
- break;
236
-
237
- default:
238
- $.error('unknown event type to be bound to validation : ' + event.type);
239
- }
240
- });
241
- }
242
- };
213
+ var bindEvents = function bindEvents($elt, options) {
214
+ var events = _.isArray(options.event) ? options.event : [options.event];
243
215
 
244
- var validate = function ($elt, callback, options) {
245
- var value = $elt.val(),
246
- defaults = $elt.data('validator-config'),
247
- execCallback = function (results) {
248
- var valid; //always trigger an event "validated" with associated results:
249
-
250
- $elt.trigger('validated', {
251
- elt: $elt[0],
252
- results: results
253
- }); //call the callback function is given:
254
-
255
- if (_.isFunction(callback)) {
256
- valid = _.where(results, {
257
- type: 'failure'
258
- }).length === 0;
259
- callback.call($elt[0], valid, results);
216
+ if (events.length > 0 && _.isFunction(options.validated)) {
217
+ _.forEach(events, function (event) {
218
+ if (_.isString(event)) {
219
+ event = {
220
+ type: event
221
+ };
260
222
  }
261
- };
262
223
 
263
- if (defaults.allowEmpty && value === '') {
264
- execCallback([new Report('success', {
265
- validator: 'allowEmpty'
266
- })]);
267
- } else {
268
- $elt.data('validator-instance').validate(value, options || {}, execCallback);
224
+ switch (event.type) {
225
+ case 'keyup':
226
+ case 'keydown':
227
+ $elt.on(event.type, function () {
228
+ var v = $elt.val();
229
+
230
+ if (event.length) {
231
+ if (v && v.length > event.length) {
232
+ _validate($elt, options.validated, {});
233
+ }
234
+ } else {
235
+ _validate($elt, options.validated, {});
236
+ }
237
+ });
238
+ break;
239
+
240
+ case 'change':
241
+ case 'blur':
242
+ $elt.on(event.type, function () {
243
+ _validate($elt, options.validated, {});
244
+ });
245
+ break;
246
+
247
+ default:
248
+ $.error('unknown event type to be bound to validation : ' + event.type);
249
+ }
250
+ });
251
+ }
252
+ };
253
+
254
+ var _validate = function _validate($elt, callback, options) {
255
+ var value = $elt.val(),
256
+ defaults = $elt.data('validator-config'),
257
+ execCallback = function execCallback(results) {
258
+ var valid; //always trigger an event "validated" with associated results:
259
+
260
+ $elt.trigger('validated', {
261
+ elt: $elt[0],
262
+ results: results
263
+ }); //call the callback function is given:
264
+
265
+ if (_.isFunction(callback)) {
266
+ valid = _.where(results, {
267
+ type: 'failure'
268
+ }).length === 0;
269
+ callback.call($elt[0], valid, results);
269
270
  }
270
271
  };
271
272
 
273
+ if (defaults.allowEmpty && value === '') {
274
+ execCallback([new Report('success', {
275
+ validator: 'allowEmpty'
276
+ })]);
277
+ } else {
278
+ $elt.data('validator-instance').validate(value, options || {}, execCallback);
279
+ }
280
+ };
281
+
272
282
  });
@@ -56,7 +56,7 @@ define(['jquery'], function ($) { 'use strict';
56
56
  /**
57
57
  * The function to be executed whenever an image is considered loaded
58
58
  */
59
- imageLoaded = function () {
59
+ imageLoaded = function imageLoaded() {
60
60
  $(this).trigger('loaded' + _ns).off('load' + _ns).off('error' + _ns);
61
61
  loaded++;
62
62
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oat-sa/tao-core-ui",
3
- "version": "1.57.0",
3
+ "version": "1.58.2",
4
4
  "displayName": "TAO Core UI",
5
5
  "description": "UI libraries of TAO",
6
6
  "scripts": {
@@ -44,14 +44,14 @@
44
44
  "devDependencies": {
45
45
  "@babel/core": "^7.15.5",
46
46
  "@babel/preset-env": "^7.15.6",
47
- "@oat-sa/browserslist-config-tao": "^1.0.1",
47
+ "@oat-sa/browserslist-config-tao": "^0.3.1",
48
48
  "@oat-sa/eslint-config-tao": "^1.1.1",
49
49
  "@oat-sa/expr-eval": "^1.3.0",
50
50
  "@oat-sa/prettier-config": "^0.1.1",
51
51
  "@oat-sa/rollup-plugin-wildcard-external": "^0.1.0",
52
52
  "@oat-sa/tao-core-libs": "^0.4.4",
53
53
  "@oat-sa/tao-core-sdk": "^1.20.0",
54
- "@oat-sa/tao-core-shared-libs": "^1.0.5",
54
+ "@oat-sa/tao-core-shared-libs": "^1.4.0",
55
55
  "@oat-sa/tao-qunit-testrunner": "^1.0.3",
56
56
  "async": "^0.2.10",
57
57
  "autoprefixer": "^9.5.1",