@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.
- package/dist/actionbar.js +386 -395
- package/dist/adder.js +21 -19
- package/dist/animable/absorbable/absorbable.js +204 -213
- package/dist/animable/absorbable/css/absorb.css +1 -0
- package/dist/animable/absorbable/css/absorb.css.map +1 -1
- package/dist/animable/pulsable/pulsable.js +168 -177
- package/dist/autocomplete/css/autocomplete.css +1 -0
- package/dist/autocomplete/css/autocomplete.css.map +1 -1
- package/dist/autocomplete.js +68 -66
- package/dist/badge/badge.js +188 -197
- package/dist/badge/css/badge.css +1 -0
- package/dist/badge/css/badge.css.map +1 -1
- package/dist/breadcrumbs.js +275 -284
- package/dist/btngrouper.js +5 -5
- package/dist/bulkActionPopup.js +490 -495
- package/dist/button.js +283 -291
- package/dist/cascadingComboBox.js +249 -258
- package/dist/ckeditor/ckConfigurator.js +42 -20
- package/dist/ckeditor/dtdHandler.js +11 -9
- package/dist/class/selector.js +441 -450
- package/dist/component/resizable.js +1 -1
- package/dist/component/windowed.js +285 -294
- package/dist/component.js +419 -428
- package/dist/contextualPopup.js +417 -426
- package/dist/dashboard.js +300 -309
- package/dist/datalist.js +753 -762
- package/dist/datatable/filterStrategy/multiple.js +1 -1
- package/dist/datatable/filterStrategy/single.js +1 -1
- package/dist/datatable.js +1527 -1550
- package/dist/dateRange/dateRange.js +393 -402
- package/dist/datetime/picker.js +665 -672
- package/dist/deleter.js +368 -377
- package/dist/destination/selector.js +286 -295
- package/dist/dialog/alert.js +3 -3
- package/dist/dialog/confirm.js +1 -1
- package/dist/dialog/confirmDelete.js +216 -225
- package/dist/dialog.js +650 -654
- package/dist/disabler.js +8 -8
- package/dist/documentViewer/providers/pdfViewer/fallback/viewer.js +166 -175
- package/dist/documentViewer/providers/pdfViewer/pdfjs/findBar.js +518 -527
- package/dist/documentViewer/providers/pdfViewer/pdfjs/pageView.js +380 -389
- package/dist/documentViewer/providers/pdfViewer/pdfjs/searchEngine.js +539 -548
- package/dist/documentViewer/providers/pdfViewer/pdfjs/viewer.js +369 -378
- package/dist/documentViewer/providers/pdfViewer.js +184 -193
- package/dist/documentViewer.js +292 -301
- package/dist/dropdown.js +383 -392
- package/dist/durationer.js +5 -5
- package/dist/dynamicComponent.js +597 -598
- package/dist/feedback.js +356 -362
- package/dist/figure/FigureStateActive.js +117 -108
- package/dist/filesender.js +2 -2
- package/dist/filter.js +230 -239
- package/dist/form/dropdownForm.js +355 -357
- package/dist/form/form.js +919 -690
- package/dist/form/simpleForm.js +1 -1
- package/dist/form/validator/renderer.js +233 -235
- package/dist/form/validator/validator.js +257 -189
- package/dist/form/widget/definitions.js +1 -1
- package/dist/form/widget/providers/checkBox.js +254 -259
- package/dist/form/widget/providers/comboBox.js +187 -192
- package/dist/form/widget/providers/default.js +8 -9
- package/dist/form/widget/providers/hidden.js +170 -179
- package/dist/form/widget/providers/hiddenBox.js +262 -267
- package/dist/form/widget/providers/radioBox.js +216 -225
- package/dist/form/widget/providers/textArea.js +187 -196
- package/dist/form/widget/providers/textBox.js +2 -3
- package/dist/form/widget/widget.js +473 -475
- package/dist/formValidator/formValidator.js +1 -1
- package/dist/formValidator/highlighters/message.js +1 -1
- package/dist/generis/form/form.js +314 -323
- package/dist/generis/validator/validator.js +209 -218
- package/dist/generis/widget/checkBox/checkBox.js +218 -227
- package/dist/generis/widget/comboBox/comboBox.js +179 -188
- package/dist/generis/widget/hiddenBox/hiddenBox.js +220 -229
- package/dist/generis/widget/textBox/textBox.js +169 -178
- package/dist/generis/widget/widget.js +246 -255
- package/dist/groupedComboBox.js +222 -231
- package/dist/groupvalidator.js +2 -2
- package/dist/highlighter.js +967 -958
- package/dist/image/ImgStateActive/helper.js +7 -5
- package/dist/image/ImgStateActive/initHelper.js +49 -43
- package/dist/image/ImgStateActive/initMediaEditor.js +24 -20
- package/dist/image/ImgStateActive/mediaSizer.js +14 -12
- package/dist/image/ImgStateActive.js +72 -70
- package/dist/incrementer.js +6 -6
- package/dist/inplacer.js +6 -6
- package/dist/itemButtonList/css/item-button-list.css +1 -0
- package/dist/itemButtonList/css/item-button-list.css.map +1 -1
- package/dist/itemButtonList.js +439 -435
- package/dist/keyNavigation/navigableDomElement.js +51 -38
- package/dist/keyNavigation/navigator.js +85 -70
- package/dist/listbox.js +460 -469
- package/dist/liststyler.js +8 -8
- package/dist/loadingButton/loadingButton.js +209 -218
- package/dist/lock.js +476 -485
- package/dist/login/login.js +475 -484
- package/dist/maths/calculator/basicCalculator.js +235 -244
- package/dist/maths/calculator/calculatorComponent.js +3 -3
- package/dist/maths/calculator/core/board.js +772 -781
- package/dist/maths/calculator/core/expression.js +476 -485
- package/dist/maths/calculator/core/labels.js +228 -237
- package/dist/maths/calculator/core/tokenizer.js +1 -1
- package/dist/maths/calculator/core/tokens.js +163 -170
- package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +244 -253
- package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +279 -288
- package/dist/maths/calculator/scientificCalculator.js +327 -336
- package/dist/mediaEditor/mediaEditorComponent.js +238 -245
- package/dist/mediaEditor/plugins/mediaAlignment/helper.js +7 -7
- package/dist/mediaEditor/plugins/mediaAlignment/mediaAlignmentComponent.js +229 -235
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +580 -589
- package/dist/mediaplayer/players/html5.js +666 -675
- package/dist/mediaplayer/players/youtube.js +419 -424
- package/dist/mediaplayer/support.js +11 -10
- package/dist/mediaplayer/utils/reminder.js +14 -13
- package/dist/mediaplayer/utils/timeObserver.js +10 -11
- package/dist/mediaplayer/youtubeManager.js +164 -145
- package/dist/mediaplayer.js +1565 -1520
- package/dist/mediasizer.js +669 -678
- package/dist/modal.js +10 -17
- package/dist/pageSizeSelector.js +219 -228
- package/dist/pagination/providers/pages.js +280 -289
- package/dist/pagination/providers/simple.js +192 -201
- package/dist/previewer.js +30 -30
- package/dist/progressbar.js +4 -4
- package/dist/report.js +347 -356
- package/dist/resource/filters.js +271 -280
- package/dist/resource/list.js +1264 -1273
- package/dist/resource/selector.js +865 -874
- package/dist/resource/tree.js +1483 -1492
- package/dist/resourcemgr/fileBrowser.js +564 -569
- package/dist/resourcemgr/filePreview.js +16 -16
- package/dist/resourcemgr/fileSelector.js +515 -524
- package/dist/resourcemgr/util/updatePermissions.js +2 -2
- package/dist/resourcemgr.js +306 -315
- package/dist/searchModal/advancedSearch.js +796 -767
- package/dist/searchModal.js +597 -549
- package/dist/switch/switch.js +298 -307
- package/dist/tabs.js +598 -575
- package/dist/taskQueue/status.js +312 -321
- package/dist/taskQueue/table.js +375 -384
- package/dist/taskQueue/taskQueueModel.js +488 -472
- package/dist/taskQueueButton/taskable.js +264 -273
- package/dist/taskQueueButton/treeButton.js +189 -198
- package/dist/themeLoader.js +24 -23
- package/dist/themes.js +1 -1
- package/dist/toggler.js +3 -3
- package/dist/tooltip.js +295 -304
- package/dist/transformer.js +2 -2
- package/dist/tristateCheckboxGroup.js +311 -320
- package/dist/uploader.js +687 -696
- package/dist/validator/Report.js +1 -1
- package/dist/validator/Validator.js +3 -3
- package/dist/validator/validators.js +9 -9
- package/dist/validator.js +240 -230
- package/dist/waitForMedia.js +1 -1
- package/package.json +3 -3
- package/scss/ckeditor/skins/tao/scss/inc/_menu.scss +51 -27
- package/scss/ckeditor/skins/tao/scss/inc/_panel.scss +16 -5
- package/scss/ckeditor/skins/tao/scss/inc/_richcombo.scss +0 -2
- package/scss/ckeditor/skins/tao/scss/inc/_toolbar.scss +15 -3
- package/src/animable/absorbable/css/absorb.css +1 -0
- package/src/animable/absorbable/css/absorb.css.map +1 -1
- package/src/autocomplete/css/autocomplete.css +1 -0
- package/src/autocomplete/css/autocomplete.css.map +1 -1
- package/src/badge/css/badge.css +1 -0
- package/src/badge/css/badge.css.map +1 -1
- package/src/ckeditor/ckConfigurator.js +24 -1
- package/src/itemButtonList/css/item-button-list.css +1 -0
- package/src/itemButtonList/css/item-button-list.css.map +1 -1
- package/scss/.DS_Store +0 -0
- package/src/.DS_Store +0 -0
package/dist/validator/Report.js
CHANGED
|
@@ -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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
43
|
-
|
|
52
|
+
this.each(function () {
|
|
53
|
+
var $this = $(this);
|
|
44
54
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
if (!isCreated($this)) {
|
|
56
|
+
create($this, opts);
|
|
57
|
+
}
|
|
48
58
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
68
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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
|
-
|
|
138
|
+
if (key) {
|
|
139
|
+
//remove brackets
|
|
140
|
+
var optionsStr = rightStr.replace(/^\((.*)\)$/, '$1'); //get string options
|
|
118
141
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
174
|
-
if (
|
|
175
|
-
|
|
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
|
-
|
|
180
|
+
return options;
|
|
181
|
+
};
|
|
179
182
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
183
|
+
var create = function create($elt, options) {
|
|
184
|
+
if (isCreated($elt)) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
184
187
|
|
|
185
|
-
|
|
186
|
-
$elt.data('validator-config', _.clone(options));
|
|
187
|
-
createValidator($elt, rules, options);
|
|
188
|
-
};
|
|
188
|
+
var rules = buildRules($elt);
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
190
|
+
if (options.rules) {
|
|
191
|
+
rules = _.merge(rules, options.rules);
|
|
192
|
+
delete options.rules;
|
|
193
|
+
}
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
options = _.merge(options, buildOptions($elt) || {});
|
|
196
|
+
$elt.data('validator-config', _.clone(options));
|
|
197
|
+
createValidator($elt, rules, options);
|
|
198
|
+
};
|
|
197
199
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
var _destroy = function _destroy($elts) {
|
|
201
|
+
$elts.removeData('validator-instance validator-config');
|
|
202
|
+
$elts.off('.validator');
|
|
203
|
+
};
|
|
202
204
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
var createValidator = function createValidator($elt, rules, options) {
|
|
206
|
+
$elt.data('validator-instance', new Validator(rules, options.validator || {}));
|
|
205
207
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
type: event
|
|
211
|
-
};
|
|
212
|
-
}
|
|
208
|
+
if (options.event) {
|
|
209
|
+
bindEvents($elt, options);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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
|
});
|
package/dist/waitForMedia.js
CHANGED
|
@@ -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.
|
|
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": "^
|
|
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
|
|
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",
|