@oat-sa/tao-core-ui 2.2.0 → 3.0.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/adder.js +1 -1
- package/dist/areaBroker.js +2 -2
- package/dist/btngrouper.js +1 -1
- package/dist/ckeditor/dtdHandler.js +3 -3
- package/dist/component.js +1 -1
- package/dist/datatable.js +4 -4
- package/dist/datetime/picker.js +2 -2
- package/dist/destination/selector.js +1 -1
- package/dist/dialog.js +1 -1
- package/dist/feedback.js +5 -3
- package/dist/figure/FigureStateActive.js +1 -1
- package/dist/formValidator/formValidator.js +1 -1
- package/dist/generis/widget/loader.js +1 -1
- package/dist/groupvalidator.js +2 -2
- package/dist/image/ImgStateActive/initHelper.js +1 -1
- package/dist/image/ImgStateActive/initMediaEditor.js +1 -1
- package/dist/image/ImgStateActive/mediaSizer.js +1 -1
- package/dist/image/ImgStateActive.js +1 -1
- package/dist/inplacer.js +1 -1
- package/dist/lock.js +3 -3
- package/dist/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +1 -1
- package/dist/mediaplayer.js +1 -1
- package/dist/mediasizer.js +1 -1
- package/dist/pageStatus.js +3 -3
- package/dist/resource/filters.js +1 -1
- package/dist/resource/selectable.js +1 -1
- package/dist/resource/tree.js +1 -3
- package/dist/resourcemgr/fileSelector.js +2 -2
- package/dist/themeLoader.js +2 -2
- package/dist/tooltip.js +2 -2
- package/dist/transformer.js +1 -1
- package/dist/validator.js +1 -1
- package/package.json +5 -5
- package/src/adder.js +1 -1
- package/src/areaBroker.js +2 -2
- package/src/btngrouper.js +1 -1
- package/src/ckeditor/dtdHandler.js +3 -3
- package/src/component.js +1 -1
- package/src/datatable.js +5 -5
- package/src/datetime/picker.js +2 -2
- package/src/destination/selector.js +1 -1
- package/src/dialog.js +1 -1
- package/src/feedback.js +5 -3
- package/src/formValidator/formValidator.js +1 -1
- package/src/generis/widget/loader.js +1 -1
- package/src/groupvalidator.js +2 -2
- package/src/image/ImgStateActive/mediaSizer.js +1 -1
- package/src/inplacer.js +1 -1
- package/src/lock.js +3 -3
- package/src/mediaEditor/plugins/mediaDimension/mediaDimensionComponent.js +1 -1
- package/src/mediaplayer.js +1 -1
- package/src/mediasizer.js +1 -1
- package/src/pageStatus.js +3 -3
- package/src/resource/filters.js +1 -1
- package/src/resource/selectable.js +1 -1
- package/src/resource/tree.js +1 -3
- package/src/resourcemgr/fileSelector.js +2 -2
- package/src/themeLoader.js +2 -2
- package/src/tooltip.js +2 -2
- package/src/transformer.js +1 -1
- package/src/validator.js +1 -1
package/dist/adder.js
CHANGED
|
@@ -118,7 +118,7 @@ define(['jquery', 'lodash', 'handlebars', 'core/pluginifier', 'core/dataattrhand
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
//check supported positions
|
|
121
|
-
if (!_.
|
|
121
|
+
if (!_.includes(positions, options.position)) {
|
|
122
122
|
return $.error('Unsupported position option');
|
|
123
123
|
}
|
|
124
124
|
return this.each(function () {
|
package/dist/areaBroker.js
CHANGED
|
@@ -62,8 +62,8 @@ define(['jquery', 'lodash'], function ($, _) { 'use strict';
|
|
|
62
62
|
throw new TypeError('A mapping has the form of a plain object');
|
|
63
63
|
}
|
|
64
64
|
keys = _.keys(areasMapping);
|
|
65
|
-
required = _.
|
|
66
|
-
return _.
|
|
65
|
+
required = _.every(requiredAreas, function (val) {
|
|
66
|
+
return _.includes(keys, val);
|
|
67
67
|
});
|
|
68
68
|
if (!required) {
|
|
69
69
|
throw new TypeError('You have to define a mapping for at least : ' + requiredAreas.join(', '));
|
package/dist/btngrouper.js
CHANGED
|
@@ -48,7 +48,7 @@ define(['jquery', 'lodash', 'core/pluginifier', 'core/dataattrhandler'], functio
|
|
|
48
48
|
init: function (options) {
|
|
49
49
|
//get options using default
|
|
50
50
|
options = _.defaults(options || {}, defaults);
|
|
51
|
-
if (!_.
|
|
51
|
+
if (!_.includes(availableActions, options.action)) {
|
|
52
52
|
return $.error('Action ' + options.action + ' not supported');
|
|
53
53
|
}
|
|
54
54
|
return this.each(function () {
|
|
@@ -36,7 +36,7 @@ define(['lodash'], function (_) { 'use strict';
|
|
|
36
36
|
if (mode.toLowerCase() === 'xhtml') {
|
|
37
37
|
mode = 'html';
|
|
38
38
|
}
|
|
39
|
-
if (!_.
|
|
39
|
+
if (!_.includes(['html', 'qti'], mode)) {
|
|
40
40
|
throw new Error('Unknown mode ' + mode);
|
|
41
41
|
}
|
|
42
42
|
dtdMode = mode;
|
|
@@ -95,7 +95,7 @@ define(['lodash'], function (_) { 'use strict';
|
|
|
95
95
|
* @returns {*}
|
|
96
96
|
*/
|
|
97
97
|
var isChildOf = function (child, of) {
|
|
98
|
-
return _.
|
|
98
|
+
return _.includes(getChildrenOf(of), _normalizeElement(child));
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
/**
|
|
@@ -106,7 +106,7 @@ define(['lodash'], function (_) { 'use strict';
|
|
|
106
106
|
* @returns {*}
|
|
107
107
|
*/
|
|
108
108
|
var isParentOf = function (parent, of) {
|
|
109
|
-
return _.
|
|
109
|
+
return _.includes(getParentsOf(of), _normalizeElement(parent));
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
/**
|
package/dist/component.js
CHANGED
|
@@ -105,7 +105,7 @@ define(['jquery', 'lodash', 'core/eventifier', 'handlebars', 'lib/handlebars/hel
|
|
|
105
105
|
* @fires component#init
|
|
106
106
|
*/
|
|
107
107
|
init: function init(config) {
|
|
108
|
-
this.config = _(config || {}).
|
|
108
|
+
this.config = _(config || {}).omitBy(function (value) {
|
|
109
109
|
return value === null || typeof value === 'undefined';
|
|
110
110
|
}).defaults(defaults || {}).value();
|
|
111
111
|
componentState = {};
|
package/dist/datatable.js
CHANGED
|
@@ -1089,7 +1089,7 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
|
|
|
1089
1089
|
|
|
1090
1090
|
// process data by model rules
|
|
1091
1091
|
if (_.some(model, 'transform')) {
|
|
1092
|
-
const transforms = _.
|
|
1092
|
+
const transforms = _.filter(model, 'transform');
|
|
1093
1093
|
_.forEach(dataset.data, (row, index) => {
|
|
1094
1094
|
_.forEach(transforms, field => {
|
|
1095
1095
|
if (_.isFunction(field.transform)) {
|
|
@@ -1151,7 +1151,7 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
|
|
|
1151
1151
|
const $btn = $$1(this);
|
|
1152
1152
|
if (!$btn.hasClass('disabled')) {
|
|
1153
1153
|
const identifier = $btn.closest('[data-item-identifier]').data('item-identifier');
|
|
1154
|
-
action.apply($btn, [identifier, _.
|
|
1154
|
+
action.apply($btn, [identifier, _.head(_.filter(dataset.data, {
|
|
1155
1155
|
id: identifier
|
|
1156
1156
|
}))]);
|
|
1157
1157
|
}
|
|
@@ -1164,7 +1164,7 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
|
|
|
1164
1164
|
|
|
1165
1165
|
// Attach listeners to model.type = action
|
|
1166
1166
|
if (_.some(options.model, 'type')) {
|
|
1167
|
-
const types = _.
|
|
1167
|
+
const types = _.filter(options.model, 'type');
|
|
1168
1168
|
_.forEach(types, field => {
|
|
1169
1169
|
if (field.type === 'actions' && field.actions) {
|
|
1170
1170
|
attachActionListeners(field.actions);
|
|
@@ -1244,7 +1244,7 @@ define(['jquery', 'lodash', 'i18n', 'core/pluginifier', 'handlebars', 'lib/handl
|
|
|
1244
1244
|
const currentRow = $$1(this).parent();
|
|
1245
1245
|
$rows.removeClass('selected');
|
|
1246
1246
|
currentRow.toggleClass('selected');
|
|
1247
|
-
$elt.trigger('selected.' + ns, _.
|
|
1247
|
+
$elt.trigger('selected.' + ns, _.filter(dataset.data, {
|
|
1248
1248
|
id: currentRow.data('item-identifier')
|
|
1249
1249
|
}));
|
|
1250
1250
|
});
|
package/dist/datetime/picker.js
CHANGED
|
@@ -416,7 +416,7 @@ define(['lodash', 'i18n', 'moment', 'ui/component', 'lib/flatpickr/flatpickr', '
|
|
|
416
416
|
*/
|
|
417
417
|
updateConstraints: function updateConstraints(constraint, constraintValue) {
|
|
418
418
|
if (this.is('ready')) {
|
|
419
|
-
if (_.
|
|
419
|
+
if (_.includes(supportedConstraints, constraint)) {
|
|
420
420
|
this.picker.set(constraint, constraintValue);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
@@ -542,7 +542,7 @@ define(['lodash', 'i18n', 'moment', 'ui/component', 'lib/flatpickr/flatpickr', '
|
|
|
542
542
|
this.pickerConfig.locale = locale;
|
|
543
543
|
}
|
|
544
544
|
_.forEach(this.config.constraints, function (constraintValue, constraint) {
|
|
545
|
-
if (_.
|
|
545
|
+
if (_.includes(supportedConstraints, constraint) && constraintValue) {
|
|
546
546
|
self.pickerConfig[constraint] = constraintValue;
|
|
547
547
|
}
|
|
548
548
|
});
|
|
@@ -184,7 +184,7 @@ define(['jquery', 'lodash', 'i18n', 'ui/component', 'ui/dialog/confirm', 'ui/res
|
|
|
184
184
|
var uris;
|
|
185
185
|
//validate the selection
|
|
186
186
|
if (_.isPlainObject(select)) {
|
|
187
|
-
uris = _.
|
|
187
|
+
uris = _.map(select, 'uri');
|
|
188
188
|
if (uris.length) {
|
|
189
189
|
return uris[0];
|
|
190
190
|
}
|
package/dist/dialog.js
CHANGED
|
@@ -247,7 +247,7 @@ define(['jquery', 'lodash', 'i18n', 'handlebars', 'lib/handlebars/helpers', 'ui/
|
|
|
247
247
|
init(options) {
|
|
248
248
|
// split options to events
|
|
249
249
|
const events = {};
|
|
250
|
-
const initOptions = _.
|
|
250
|
+
const initOptions = _.omitBy(options || {}, (value, key) => {
|
|
251
251
|
if (key.length > 2 && 'on' === key.substr(0, 2)) {
|
|
252
252
|
events[key.substr(2)] = value;
|
|
253
253
|
return true;
|
package/dist/feedback.js
CHANGED
|
@@ -135,7 +135,7 @@ define(['jquery', 'lodash', 'core/format', 'ui/component', 'util/wrapLongWords',
|
|
|
135
135
|
*/
|
|
136
136
|
message: function message(level, msg, params, options) {
|
|
137
137
|
var displayedMessage = msg;
|
|
138
|
-
if (!level || !_.
|
|
138
|
+
if (!level || !_.includes(levels, level)) {
|
|
139
139
|
level = 'info';
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -221,7 +221,9 @@ define(['jquery', 'lodash', 'core/format', 'ui/component', 'util/wrapLongWords',
|
|
|
221
221
|
*/
|
|
222
222
|
open: function open() {
|
|
223
223
|
//close others
|
|
224
|
-
_(currents).reject(this).
|
|
224
|
+
_(currents).reject(this).forEach(function (fb) {
|
|
225
|
+
fb.close();
|
|
226
|
+
});
|
|
225
227
|
|
|
226
228
|
//and display
|
|
227
229
|
return this.display();
|
|
@@ -280,7 +282,7 @@ define(['jquery', 'lodash', 'core/format', 'ui/component', 'util/wrapLongWords',
|
|
|
280
282
|
}).on('destroy', function () {
|
|
281
283
|
//for backward compat
|
|
282
284
|
$container.trigger('close.feedback');
|
|
283
|
-
_.
|
|
285
|
+
_.pull(currents, this);
|
|
284
286
|
}).init(config);
|
|
285
287
|
};
|
|
286
288
|
|
|
@@ -70,7 +70,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
70
70
|
$img.removeAttr('height');
|
|
71
71
|
$mediaSpan[0].removeAttribute('style');
|
|
72
72
|
}
|
|
73
|
-
_(['width', 'height']).
|
|
73
|
+
_(['width', 'height']).forEach(function (sizeAttr) {
|
|
74
74
|
let val;
|
|
75
75
|
if (media[sizeAttr] === '' || typeof media[sizeAttr] === 'undefined' || media[sizeAttr] === null) {
|
|
76
76
|
img.removeAttr(sizeAttr);
|
|
@@ -131,7 +131,7 @@ define(['jquery', 'lodash', 'ui/formValidator/highlighters/highlighter', 'ui/val
|
|
|
131
131
|
var firstErrorData;
|
|
132
132
|
state.valid = state.valid && valid;
|
|
133
133
|
if (!valid) {
|
|
134
|
-
firstErrorData = _.
|
|
134
|
+
firstErrorData = _.map(_.filter(report, {
|
|
135
135
|
type: 'failure'
|
|
136
136
|
}), 'data')[0];
|
|
137
137
|
highlightField($field, false, firstErrorData.message);
|
|
@@ -39,7 +39,7 @@ define(['lodash', 'ui/generis/widget/checkBox/checkBox', 'ui/generis/widget/comb
|
|
|
39
39
|
*/
|
|
40
40
|
function loader (uri) {
|
|
41
41
|
var factory;
|
|
42
|
-
if (!uri || !_.
|
|
42
|
+
if (!uri || !_.includes(Object.keys(_widgetFactories), uri)) {
|
|
43
43
|
factory = _widgetFactories[_default];
|
|
44
44
|
} else {
|
|
45
45
|
factory = _widgetFactories[uri];
|
package/dist/groupvalidator.js
CHANGED
|
@@ -41,7 +41,7 @@ define(['jquery', 'lodash', 'ui/validator'], function ($, _, validator) { 'use s
|
|
|
41
41
|
* @event validated.group
|
|
42
42
|
* @param {boolean} isValid - wheter the group is valid
|
|
43
43
|
*/
|
|
44
|
-
$container.trigger('validated.group', [_(states).values().
|
|
44
|
+
$container.trigger('validated.group', [_(states).values().includes(false) === false, this]);
|
|
45
45
|
};
|
|
46
46
|
var $toValidate = $('[data-validate]', $container).validator({
|
|
47
47
|
event: options.events,
|
|
@@ -63,7 +63,7 @@ define(['jquery', 'lodash', 'ui/validator'], function ($, _, validator) { 'use s
|
|
|
63
63
|
//removes previous error messages
|
|
64
64
|
$elt.siblings('.' + options.errorMessageClass).remove();
|
|
65
65
|
if (valid === false) {
|
|
66
|
-
rule = _.
|
|
66
|
+
rule = _.filter(results, {
|
|
67
67
|
type: 'failure'
|
|
68
68
|
})[0];
|
|
69
69
|
$elt.addClass(options.errorClass);
|
|
@@ -68,7 +68,7 @@ define(['exports', 'jquery', 'lodash', 'i18n', 'core/mimetype', 'ui/mediaEditor/
|
|
|
68
68
|
$img.removeAttr('height');
|
|
69
69
|
$mediaSpan[0].removeAttribute('style');
|
|
70
70
|
}
|
|
71
|
-
_(['width', 'height']).
|
|
71
|
+
_(['width', 'height']).forEach(function (sizeAttr) {
|
|
72
72
|
let val;
|
|
73
73
|
if (media[sizeAttr] === '' || typeof media[sizeAttr] === 'undefined' || media[sizeAttr] === null) {
|
|
74
74
|
img.removeAttr(sizeAttr);
|
|
@@ -66,7 +66,7 @@ define(['jquery', 'core/mimetype', 'ui/mediaEditor/plugins/mediaAlignment/helper
|
|
|
66
66
|
$img.removeAttr('height');
|
|
67
67
|
$mediaSpan[0].removeAttribute('style');
|
|
68
68
|
}
|
|
69
|
-
_(['width', 'height']).
|
|
69
|
+
_(['width', 'height']).forEach(function (sizeAttr) {
|
|
70
70
|
let val;
|
|
71
71
|
if (media[sizeAttr] === '' || typeof media[sizeAttr] === 'undefined' || media[sizeAttr] === null) {
|
|
72
72
|
img.removeAttr(sizeAttr);
|
|
@@ -63,7 +63,7 @@ define(['exports', 'jquery', 'lodash'], function (exports, jquery, _) { 'use str
|
|
|
63
63
|
$img.removeAttr('height');
|
|
64
64
|
$mediaSpan[0].removeAttribute('style');
|
|
65
65
|
}
|
|
66
|
-
_(['width', 'height']).
|
|
66
|
+
_(['width', 'height']).forEach(function (sizeAttr) {
|
|
67
67
|
let val;
|
|
68
68
|
if (media[sizeAttr] === '' || typeof media[sizeAttr] === 'undefined' || media[sizeAttr] === null) {
|
|
69
69
|
img.removeAttr(sizeAttr);
|
|
@@ -68,7 +68,7 @@ define(['jquery', 'nouislider', 'ui/resourcemgr', 'ui/tooltip', 'lodash', 'i18n'
|
|
|
68
68
|
$img.removeAttr('height');
|
|
69
69
|
$mediaSpan[0].removeAttribute('style');
|
|
70
70
|
}
|
|
71
|
-
_(['width', 'height']).
|
|
71
|
+
_(['width', 'height']).forEach(function (sizeAttr) {
|
|
72
72
|
let val;
|
|
73
73
|
if (media[sizeAttr] === '' || typeof media[sizeAttr] === 'undefined' || media[sizeAttr] === null) {
|
|
74
74
|
img.removeAttr(sizeAttr);
|
package/dist/inplacer.js
CHANGED
|
@@ -163,7 +163,7 @@ define(['jquery', 'lodash', 'core/pluginifier', 'core/dataattrhandler'], functio
|
|
|
163
163
|
var width = options.width || $elt.width() + 'px';
|
|
164
164
|
var $editor;
|
|
165
165
|
emptyText($elt);
|
|
166
|
-
if (_.
|
|
166
|
+
if (_.includes(options.mapping.textarea, $elt.prop('tagName').toLowerCase())) {
|
|
167
167
|
const height = options.height || $elt.height() + 'px';
|
|
168
168
|
$editor = $elt.append('<textarea>' + text + '</textarea>').children(':input').width(width).height(height);
|
|
169
169
|
} else {
|
package/dist/lock.js
CHANGED
|
@@ -137,7 +137,7 @@ define(['jquery', 'lodash', 'i18n', 'handlebars', 'lib/handlebars/helpers', 'hel
|
|
|
137
137
|
* @returns {lockApi}
|
|
138
138
|
*/
|
|
139
139
|
message: function message(category, msg, options) {
|
|
140
|
-
if (!category || !_.
|
|
140
|
+
if (!category || !_.includes(_.keys(categories), category)) {
|
|
141
141
|
category = 'hasLock';
|
|
142
142
|
}
|
|
143
143
|
this.setState(states.created);
|
|
@@ -361,7 +361,7 @@ define(['jquery', 'lodash', 'i18n', 'handlebars', 'lib/handlebars/helpers', 'hel
|
|
|
361
361
|
if (_.isString(verify)) {
|
|
362
362
|
verify = [verify];
|
|
363
363
|
}
|
|
364
|
-
return _.
|
|
364
|
+
return _.includes(verify, this._state);
|
|
365
365
|
},
|
|
366
366
|
/**
|
|
367
367
|
* Change the current state
|
|
@@ -369,7 +369,7 @@ define(['jquery', 'lodash', 'i18n', 'handlebars', 'lib/handlebars/helpers', 'hel
|
|
|
369
369
|
* @throws {Error} if we try to set an invalid state
|
|
370
370
|
*/
|
|
371
371
|
setState: function setState(state) {
|
|
372
|
-
if (!_.
|
|
372
|
+
if (!_.includes(states, state)) {
|
|
373
373
|
throw new Error('Unkown state ' + state);
|
|
374
374
|
}
|
|
375
375
|
this._state = state;
|
|
@@ -398,7 +398,7 @@ define(['jquery', 'lodash', 'ui/component', 'handlebars', 'lib/handlebars/helper
|
|
|
398
398
|
}
|
|
399
399
|
return chars;
|
|
400
400
|
}(),
|
|
401
|
-
allowed = _.
|
|
401
|
+
allowed = _.includes(specChars, c) || c >= 48 && c <= 57 || c >= 96 && c <= 105;
|
|
402
402
|
if (!allowed) {
|
|
403
403
|
e.preventDefault();
|
|
404
404
|
}
|
package/dist/mediaplayer.js
CHANGED
|
@@ -282,7 +282,7 @@ define(['jquery', 'lodash', 'async', 'util/urlParser', 'core/eventifier', 'core/
|
|
|
282
282
|
*/
|
|
283
283
|
init(mediaPlayerConfig) {
|
|
284
284
|
// load the config set, discard null values in order to allow defaults to be set
|
|
285
|
-
this.config = _.
|
|
285
|
+
this.config = _.omitBy(mediaPlayerConfig || {}, value => typeof value === 'undefined' || value === null);
|
|
286
286
|
_.defaults(this.config, defaults.options);
|
|
287
287
|
if (!this.config.mimeType && 'string' === typeof this.config.type && this.config.type.indexOf('/') > 0) {
|
|
288
288
|
this.config.mimeType = this.config.type;
|
package/dist/mediasizer.js
CHANGED
|
@@ -476,7 +476,7 @@ define(['jquery', 'lodash', 'core/pluginifier', 'handlebars', 'lib/handlebars/he
|
|
|
476
476
|
}
|
|
477
477
|
return chars;
|
|
478
478
|
}();
|
|
479
|
-
return _.
|
|
479
|
+
return _.includes(specChars, c) || c >= 48 && c <= 57 || c >= 96 && c <= 105;
|
|
480
480
|
});
|
|
481
481
|
_fields[unit][dim].on('keyup blur sliderchange', function (e) {
|
|
482
482
|
var $field = $$1(this),
|
package/dist/pageStatus.js
CHANGED
|
@@ -69,7 +69,7 @@ define(['lodash', 'core/eventifier'], function (_, eventifier) { 'use strict';
|
|
|
69
69
|
* @fires pageStatus#statuschange when the page status changed
|
|
70
70
|
*/
|
|
71
71
|
pageStatus = eventifier({});
|
|
72
|
-
if (_.
|
|
72
|
+
if (_.includes(options.track, 'load')) {
|
|
73
73
|
//the load event won't be triggered on the current window,
|
|
74
74
|
//the window is already loaded
|
|
75
75
|
win.addEventListener('load', function () {
|
|
@@ -81,7 +81,7 @@ define(['lodash', 'core/eventifier'], function (_, eventifier) { 'use strict';
|
|
|
81
81
|
pageStatus.trigger('statuschange', 'unload');
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
if (_.
|
|
84
|
+
if (_.includes(options.track, 'visibility')) {
|
|
85
85
|
//minimize, switch tab, move the window in background (mobile), etc.
|
|
86
86
|
win.addEventListener(visibilityChangeEvent, function (e) {
|
|
87
87
|
_.defer(function () {
|
|
@@ -93,7 +93,7 @@ define(['lodash', 'core/eventifier'], function (_, eventifier) { 'use strict';
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
if (_.
|
|
96
|
+
if (_.includes(options.track, 'focus')) {
|
|
97
97
|
//losing the window focus, the event can be triggered multiple time
|
|
98
98
|
win.addEventListener('blur', _.debounce(function (e) {
|
|
99
99
|
if (e.target === win) {
|
package/dist/resource/filters.js
CHANGED
|
@@ -117,7 +117,7 @@ define(['lodash', 'i18n', 'ui/component', 'ui/generis/form/form', 'handlebars',
|
|
|
117
117
|
if (this.is('rendered')) {
|
|
118
118
|
this.getElement().empty();
|
|
119
119
|
properties = _.filter(data.properties, function (property) {
|
|
120
|
-
return _.
|
|
120
|
+
return _.includes(supportedWidgets, property.widget);
|
|
121
121
|
});
|
|
122
122
|
this.form = generisFormFactory({
|
|
123
123
|
properties: properties,
|
|
@@ -40,7 +40,7 @@ define(['jquery', 'lodash'], function ($, _) { 'use strict';
|
|
|
40
40
|
var nodes = {};
|
|
41
41
|
|
|
42
42
|
//validate the component in parameter
|
|
43
|
-
var isAComponent = _.
|
|
43
|
+
var isAComponent = _.every(['on', 'trigger', 'init', 'render', 'is', 'getElement'], function (method) {
|
|
44
44
|
return _.isFunction(component[method]);
|
|
45
45
|
});
|
|
46
46
|
var getConfig = function getConfig() {
|
package/dist/resource/tree.js
CHANGED
|
@@ -1804,9 +1804,7 @@ define(['jquery', 'lodash', 'ui/component', 'ui/resource/selectable', 'ui/hider'
|
|
|
1804
1804
|
return acc;
|
|
1805
1805
|
}
|
|
1806
1806
|
function reduceNodes(nodeList) {
|
|
1807
|
-
return _.sortBy(nodeList,
|
|
1808
|
-
return b.label - a.label;
|
|
1809
|
-
}).reduce(reduceNode, '');
|
|
1807
|
+
return _.sortBy(nodeList, ['label']).reduce(reduceNode, '');
|
|
1810
1808
|
}
|
|
1811
1809
|
if (this.is('rendered')) {
|
|
1812
1810
|
$component = this.getElement();
|
|
@@ -389,7 +389,7 @@ define(['jquery', 'lodash', 'async', 'i18n', 'core/mimetype', 'handlebars', 'lib
|
|
|
389
389
|
// Under rare circumstances a browser may report the mime type
|
|
390
390
|
// with quotes (e.g. "application/foo" instead of application/foo)
|
|
391
391
|
let checkType = file.type.replace(/^["']+|['"]+$/g, '');
|
|
392
|
-
return _.
|
|
392
|
+
return _.includes(filters, checkType);
|
|
393
393
|
});
|
|
394
394
|
if (files.length !== givenLength) {
|
|
395
395
|
//TODO use a feedback popup
|
|
@@ -412,7 +412,7 @@ define(['jquery', 'lodash', 'async', 'i18n', 'core/mimetype', 'handlebars', 'lib
|
|
|
412
412
|
});
|
|
413
413
|
} else {
|
|
414
414
|
//fallback on client side check
|
|
415
|
-
if (_.
|
|
415
|
+
if (_.includes(fileNames, file.name.toLowerCase())) {
|
|
416
416
|
//eslint-disable-next-line no-alert
|
|
417
417
|
result = window.confirm(__('Do you want to override "%s"?', file.name));
|
|
418
418
|
}
|
package/dist/themeLoader.js
CHANGED
|
@@ -133,7 +133,7 @@ define(['jquery', 'lodash'], function ($, _) { 'use strict';
|
|
|
133
133
|
/*
|
|
134
134
|
* Extract data from config
|
|
135
135
|
*/
|
|
136
|
-
const defaultTheme = config.default || _.
|
|
136
|
+
const defaultTheme = config.default || _.head(_.map(config.available, 'id'));
|
|
137
137
|
let activeTheme = defaultTheme;
|
|
138
138
|
const themes = [{
|
|
139
139
|
id: 'base',
|
|
@@ -194,7 +194,7 @@ define(['jquery', 'lodash'], function ($, _) { 'use strict';
|
|
|
194
194
|
*/
|
|
195
195
|
change(id) {
|
|
196
196
|
//support to change to the "default" theme regardless it's id
|
|
197
|
-
if (_.
|
|
197
|
+
if (_.includes(['base', 'default'], id) && !isAttached(id)) {
|
|
198
198
|
id = defaultTheme;
|
|
199
199
|
}
|
|
200
200
|
if (isAttached(id)) {
|
package/dist/tooltip.js
CHANGED
|
@@ -116,7 +116,7 @@ define(['jquery', 'lodash', 'core/dataattrhandler', 'lib/popper/tooltip', 'handl
|
|
|
116
116
|
var $content = DataAttrHandler.getTarget('tooltip', $$1(this));
|
|
117
117
|
var opt;
|
|
118
118
|
var predefinedOptions = _.cloneDeep(defaultOptions);
|
|
119
|
-
themeName = _.
|
|
119
|
+
themeName = _.includes(themes, $$1(this).data('tooltip-theme')) ? $$1(this).data('tooltip-theme') : 'default';
|
|
120
120
|
opt = {
|
|
121
121
|
template: themesMap[themeName]
|
|
122
122
|
};
|
|
@@ -146,7 +146,7 @@ define(['jquery', 'lodash', 'core/dataattrhandler', 'lib/popper/tooltip', 'handl
|
|
|
146
146
|
var template;
|
|
147
147
|
var predefinedOptions = _.cloneDeep(defaultOptions);
|
|
148
148
|
calculatedOptions = options ? _.merge(predefinedOptions, options) : predefinedOptions;
|
|
149
|
-
themeName = _.
|
|
149
|
+
themeName = _.includes(themes, calculatedOptions.theme) ? calculatedOptions.theme : 'default';
|
|
150
150
|
template = {
|
|
151
151
|
template: themesMap[themeName]
|
|
152
152
|
};
|
package/dist/transformer.js
CHANGED
|
@@ -152,7 +152,7 @@ define(['jquery', 'lodash', 'lib/unmatrix/unmatrix'], function ($, _, _unmatrix)
|
|
|
152
152
|
cssObj[prefix + 'transform'] = $.trim(cssObj[prefix + 'transform']);
|
|
153
153
|
$elem.css(cssObj);
|
|
154
154
|
$elem.removeClass('transform-translate transform-rotate transform-skew transform-scale');
|
|
155
|
-
$elem.addClass(_.
|
|
155
|
+
$elem.addClass(_.uniq(classNames).join(' '));
|
|
156
156
|
$elem.trigger('transform.' + ns, transforms);
|
|
157
157
|
}
|
|
158
158
|
|
package/dist/validator.js
CHANGED
|
@@ -228,7 +228,7 @@ define(['jquery', 'lodash', 'ui/validator/Report', 'ui/validator/Validator'], fu
|
|
|
228
228
|
|
|
229
229
|
//call the callback function is given:
|
|
230
230
|
if (_.isFunction(callback)) {
|
|
231
|
-
valid = _.
|
|
231
|
+
valid = _.filter(results, {
|
|
232
232
|
type: 'failure'
|
|
233
233
|
}).length === 0;
|
|
234
234
|
callback.call($elt[0], valid, results);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oat-sa/tao-core-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"displayName": "TAO Core UI",
|
|
5
5
|
"description": "UI libraries of TAO",
|
|
6
6
|
"scripts": {
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"@oat-sa/prettier-config": "^0.1.1",
|
|
53
53
|
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
|
|
54
54
|
"@oat-sa/tao-calculator": "^0.6.2",
|
|
55
|
-
"@oat-sa/tao-core-libs": "^0.
|
|
56
|
-
"@oat-sa/tao-core-sdk": "^
|
|
57
|
-
"@oat-sa/tao-core-shared-libs": "^1.
|
|
55
|
+
"@oat-sa/tao-core-libs": "^1.0.0",
|
|
56
|
+
"@oat-sa/tao-core-sdk": "^3.0.0",
|
|
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",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"interactjs": "1.3.4",
|
|
71
71
|
"jquery": "1.9.1",
|
|
72
72
|
"jquery-mockjax": "^2.5.0",
|
|
73
|
-
"lodash": "
|
|
73
|
+
"lodash": "^4.17.21",
|
|
74
74
|
"moment": "^2.29.4",
|
|
75
75
|
"moment-timezone": "^0.5.43",
|
|
76
76
|
"npm-run-all": "^4.1.5",
|
package/src/adder.js
CHANGED
package/src/areaBroker.js
CHANGED
|
@@ -89,8 +89,8 @@ export default function areaBroker(requiredAreas, $container, mapping) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
keys = _.keys(areasMapping);
|
|
92
|
-
required = _.
|
|
93
|
-
return _.
|
|
92
|
+
required = _.every(requiredAreas, function(val) {
|
|
93
|
+
return _.includes(keys, val);
|
|
94
94
|
});
|
|
95
95
|
if (!required) {
|
|
96
96
|
throw new TypeError('You have to define a mapping for at least : ' + requiredAreas.join(', '));
|
package/src/btngrouper.js
CHANGED
|
@@ -48,7 +48,7 @@ var BtnGrouper = {
|
|
|
48
48
|
//get options using default
|
|
49
49
|
options = _.defaults(options || {}, defaults);
|
|
50
50
|
|
|
51
|
-
if (!_.
|
|
51
|
+
if (!_.includes(availableActions, options.action)) {
|
|
52
52
|
return $.error('Action ' + options.action + ' not supported');
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -33,7 +33,7 @@ var dtdHandler = (function () {
|
|
|
33
33
|
if (mode.toLowerCase() === 'xhtml') {
|
|
34
34
|
mode = 'html';
|
|
35
35
|
}
|
|
36
|
-
if (!_.
|
|
36
|
+
if (!_.includes(['html', 'qti'], mode)) {
|
|
37
37
|
throw new Error('Unknown mode ' + mode);
|
|
38
38
|
}
|
|
39
39
|
dtdMode = mode;
|
|
@@ -123,7 +123,7 @@ var dtdHandler = (function () {
|
|
|
123
123
|
* @returns {*}
|
|
124
124
|
*/
|
|
125
125
|
var isChildOf = function (child, of) {
|
|
126
|
-
return _.
|
|
126
|
+
return _.includes(getChildrenOf(of), _normalizeElement(child));
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
/**
|
|
@@ -134,7 +134,7 @@ var dtdHandler = (function () {
|
|
|
134
134
|
* @returns {*}
|
|
135
135
|
*/
|
|
136
136
|
var isParentOf = function (parent, of) {
|
|
137
|
-
return _.
|
|
137
|
+
return _.includes(getParentsOf(of), _normalizeElement(parent));
|
|
138
138
|
};
|
|
139
139
|
|
|
140
140
|
/**
|
package/src/component.js
CHANGED
package/src/datatable.js
CHANGED
|
@@ -429,7 +429,7 @@ const dataTable = {
|
|
|
429
429
|
|
|
430
430
|
// process data by model rules
|
|
431
431
|
if (_.some(model, 'transform')) {
|
|
432
|
-
const transforms = _.
|
|
432
|
+
const transforms = _.filter(model, 'transform');
|
|
433
433
|
|
|
434
434
|
_.forEach(dataset.data, (row, index) => {
|
|
435
435
|
_.forEach(transforms, field => {
|
|
@@ -499,8 +499,8 @@ const dataTable = {
|
|
|
499
499
|
|
|
500
500
|
action.apply($btn, [
|
|
501
501
|
identifier,
|
|
502
|
-
_.
|
|
503
|
-
_.
|
|
502
|
+
_.head(
|
|
503
|
+
_.filter(dataset.data, {
|
|
504
504
|
id: identifier
|
|
505
505
|
})
|
|
506
506
|
)
|
|
@@ -516,7 +516,7 @@ const dataTable = {
|
|
|
516
516
|
|
|
517
517
|
// Attach listeners to model.type = action
|
|
518
518
|
if (_.some(options.model, 'type')) {
|
|
519
|
-
const types = _.
|
|
519
|
+
const types = _.filter(options.model, 'type');
|
|
520
520
|
_.forEach(types, field => {
|
|
521
521
|
if (field.type === 'actions' && field.actions) {
|
|
522
522
|
attachActionListeners(field.actions);
|
|
@@ -617,7 +617,7 @@ const dataTable = {
|
|
|
617
617
|
$rows.removeClass('selected');
|
|
618
618
|
currentRow.toggleClass('selected');
|
|
619
619
|
|
|
620
|
-
$elt.trigger('selected.' + ns, _.
|
|
620
|
+
$elt.trigger('selected.' + ns, _.filter(dataset.data, { id: currentRow.data('item-identifier') }));
|
|
621
621
|
});
|
|
622
622
|
}
|
|
623
623
|
|
package/src/datetime/picker.js
CHANGED
|
@@ -335,7 +335,7 @@ export default function dateTimePickerFactory(container, options) {
|
|
|
335
335
|
*/
|
|
336
336
|
updateConstraints: function updateConstraints(constraint, constraintValue) {
|
|
337
337
|
if (this.is('ready')) {
|
|
338
|
-
if (_.
|
|
338
|
+
if (_.includes(supportedConstraints, constraint)) {
|
|
339
339
|
this.picker.set(constraint, constraintValue);
|
|
340
340
|
}
|
|
341
341
|
}
|
|
@@ -475,7 +475,7 @@ export default function dateTimePickerFactory(container, options) {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
_.forEach(this.config.constraints, function(constraintValue, constraint) {
|
|
478
|
-
if (_.
|
|
478
|
+
if (_.includes(supportedConstraints, constraint) && constraintValue) {
|
|
479
479
|
self.pickerConfig[constraint] = constraintValue;
|
|
480
480
|
}
|
|
481
481
|
});
|
|
@@ -107,7 +107,7 @@ export default function destinationSelectorFactory($container, config) {
|
|
|
107
107
|
var uris;
|
|
108
108
|
//validate the selection
|
|
109
109
|
if (_.isPlainObject(select)) {
|
|
110
|
-
uris = _.
|
|
110
|
+
uris = _.map(select, 'uri');
|
|
111
111
|
if (uris.length) {
|
|
112
112
|
return uris[0];
|
|
113
113
|
}
|
package/src/dialog.js
CHANGED
|
@@ -124,7 +124,7 @@ const dialog = {
|
|
|
124
124
|
init(options) {
|
|
125
125
|
// split options to events
|
|
126
126
|
const events = {};
|
|
127
|
-
const initOptions = _.
|
|
127
|
+
const initOptions = _.omitBy(options || {}, (value, key) => {
|
|
128
128
|
if (key.length > 2 && 'on' === key.substr(0, 2)) {
|
|
129
129
|
events[key.substr(2)] = value;
|
|
130
130
|
return true;
|
package/src/feedback.js
CHANGED
|
@@ -111,7 +111,7 @@ var feedbackFactory = function feedbackFactory($container, config) {
|
|
|
111
111
|
message: function message(level, msg, params, options) {
|
|
112
112
|
var displayedMessage = msg;
|
|
113
113
|
|
|
114
|
-
if (!level || !_.
|
|
114
|
+
if (!level || !_.includes(levels, level)) {
|
|
115
115
|
level = 'info';
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -208,7 +208,9 @@ var feedbackFactory = function feedbackFactory($container, config) {
|
|
|
208
208
|
//close others
|
|
209
209
|
_(currents)
|
|
210
210
|
.reject(this)
|
|
211
|
-
.
|
|
211
|
+
.forEach(function (fb) {
|
|
212
|
+
fb.close();
|
|
213
|
+
});
|
|
212
214
|
|
|
213
215
|
//and display
|
|
214
216
|
return this.display();
|
|
@@ -287,7 +289,7 @@ var feedbackFactory = function feedbackFactory($container, config) {
|
|
|
287
289
|
//for backward compat
|
|
288
290
|
$container.trigger('close.feedback');
|
|
289
291
|
|
|
290
|
-
_.
|
|
292
|
+
_.pull(currents, this);
|
|
291
293
|
})
|
|
292
294
|
.init(config);
|
|
293
295
|
};
|
|
@@ -188,7 +188,7 @@ var formValidatorFactory = function formValidatorFactory(options) {
|
|
|
188
188
|
state.valid = state.valid && valid;
|
|
189
189
|
|
|
190
190
|
if (!valid) {
|
|
191
|
-
firstErrorData = _.
|
|
191
|
+
firstErrorData = _.map(_.filter(report, { type: 'failure' }), 'data')[0];
|
|
192
192
|
highlightField($field, false, firstErrorData.message);
|
|
193
193
|
state.errors.push(
|
|
194
194
|
$.extend(
|
|
@@ -39,7 +39,7 @@ var _widgetFactories = {
|
|
|
39
39
|
export default function(uri) {
|
|
40
40
|
var factory;
|
|
41
41
|
|
|
42
|
-
if (!uri || !_.
|
|
42
|
+
if (!uri || !_.includes(Object.keys(_widgetFactories), uri)) {
|
|
43
43
|
factory = _widgetFactories[_default];
|
|
44
44
|
} else {
|
|
45
45
|
factory = _widgetFactories[uri];
|
package/src/groupvalidator.js
CHANGED
|
@@ -44,7 +44,7 @@ $.fn.groupValidator = function(options) {
|
|
|
44
44
|
$container.trigger('validated.group', [
|
|
45
45
|
_(states)
|
|
46
46
|
.values()
|
|
47
|
-
.
|
|
47
|
+
.includes(false) === false,
|
|
48
48
|
this
|
|
49
49
|
]);
|
|
50
50
|
};
|
|
@@ -72,7 +72,7 @@ $.fn.groupValidator.defaults = {
|
|
|
72
72
|
$elt.siblings('.' + options.errorMessageClass).remove();
|
|
73
73
|
|
|
74
74
|
if (valid === false) {
|
|
75
|
-
rule = _.
|
|
75
|
+
rule = _.filter(results, { type: 'failure' })[0];
|
|
76
76
|
$elt.addClass(options.errorClass);
|
|
77
77
|
if (rule && rule.data.message) {
|
|
78
78
|
$elt.after("<span class='" + options.errorMessageClass + "'>" + rule.data.message + '</span>');
|
package/src/inplacer.js
CHANGED
|
@@ -170,7 +170,7 @@ const InPlacer = {
|
|
|
170
170
|
var width = options.width || $elt.width() + 'px';
|
|
171
171
|
var $editor;
|
|
172
172
|
emptyText($elt);
|
|
173
|
-
if (_.
|
|
173
|
+
if (_.includes(options.mapping.textarea, $elt.prop('tagName').toLowerCase())) {
|
|
174
174
|
const height = options.height || $elt.height() + 'px';
|
|
175
175
|
$editor = $elt
|
|
176
176
|
.append('<textarea>' + text + '</textarea>')
|
package/src/lock.js
CHANGED
|
@@ -96,7 +96,7 @@ const lockApi = {
|
|
|
96
96
|
* @returns {lockApi}
|
|
97
97
|
*/
|
|
98
98
|
message: function message(category, msg, options) {
|
|
99
|
-
if (!category || !_.
|
|
99
|
+
if (!category || !_.includes(_.keys(categories), category)) {
|
|
100
100
|
category = 'hasLock';
|
|
101
101
|
}
|
|
102
102
|
this.setState(states.created);
|
|
@@ -334,7 +334,7 @@ const lockState = {
|
|
|
334
334
|
if (_.isString(verify)) {
|
|
335
335
|
verify = [verify];
|
|
336
336
|
}
|
|
337
|
-
return _.
|
|
337
|
+
return _.includes(verify, this._state);
|
|
338
338
|
},
|
|
339
339
|
|
|
340
340
|
/**
|
|
@@ -343,7 +343,7 @@ const lockState = {
|
|
|
343
343
|
* @throws {Error} if we try to set an invalid state
|
|
344
344
|
*/
|
|
345
345
|
setState: function setState(state) {
|
|
346
|
-
if (!_.
|
|
346
|
+
if (!_.includes(states, state)) {
|
|
347
347
|
throw new Error('Unkown state ' + state);
|
|
348
348
|
}
|
|
349
349
|
this._state = state;
|
|
@@ -384,7 +384,7 @@ export default function mediaDimensionFactory($container, media, config) {
|
|
|
384
384
|
}
|
|
385
385
|
return chars;
|
|
386
386
|
})(),
|
|
387
|
-
allowed = _.
|
|
387
|
+
allowed = _.includes(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);
|
|
388
388
|
|
|
389
389
|
if (!allowed) {
|
|
390
390
|
e.preventDefault();
|
package/src/mediaplayer.js
CHANGED
|
@@ -236,7 +236,7 @@ function mediaplayerFactory(config) {
|
|
|
236
236
|
*/
|
|
237
237
|
init(mediaPlayerConfig) {
|
|
238
238
|
// load the config set, discard null values in order to allow defaults to be set
|
|
239
|
-
this.config = _.
|
|
239
|
+
this.config = _.omitBy(mediaPlayerConfig || {}, value => typeof value === 'undefined' || value === null);
|
|
240
240
|
_.defaults(this.config, defaults.options);
|
|
241
241
|
if (!this.config.mimeType && 'string' === typeof this.config.type && this.config.type.indexOf('/') > 0) {
|
|
242
242
|
this.config.mimeType = this.config.type;
|
package/src/mediasizer.js
CHANGED
|
@@ -482,7 +482,7 @@ MediaSizer = {
|
|
|
482
482
|
return chars;
|
|
483
483
|
})();
|
|
484
484
|
|
|
485
|
-
return _.
|
|
485
|
+
return _.includes(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);
|
|
486
486
|
});
|
|
487
487
|
|
|
488
488
|
_fields[unit][dim].on('keyup blur sliderchange', function(e) {
|
package/src/pageStatus.js
CHANGED
|
@@ -81,7 +81,7 @@ export default function pageStatusFactory(options) {
|
|
|
81
81
|
*/
|
|
82
82
|
pageStatus = eventifier({});
|
|
83
83
|
|
|
84
|
-
if (_.
|
|
84
|
+
if (_.includes(options.track, 'load')) {
|
|
85
85
|
//the load event won't be triggered on the current window,
|
|
86
86
|
//the window is already loaded
|
|
87
87
|
win.addEventListener('load', function() {
|
|
@@ -94,7 +94,7 @@ export default function pageStatusFactory(options) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
if (_.
|
|
97
|
+
if (_.includes(options.track, 'visibility')) {
|
|
98
98
|
//minimize, switch tab, move the window in background (mobile), etc.
|
|
99
99
|
win.addEventListener(visibilityChangeEvent, function(e) {
|
|
100
100
|
_.defer(function() {
|
|
@@ -107,7 +107,7 @@ export default function pageStatusFactory(options) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (_.
|
|
110
|
+
if (_.includes(options.track, 'focus')) {
|
|
111
111
|
//losing the window focus, the event can be triggered multiple time
|
|
112
112
|
win.addEventListener(
|
|
113
113
|
'blur',
|
package/src/resource/filters.js
CHANGED
|
@@ -118,7 +118,7 @@ export default function filtersFactory($container, config) {
|
|
|
118
118
|
this.getElement().empty();
|
|
119
119
|
|
|
120
120
|
properties = _.filter(data.properties, function(property) {
|
|
121
|
-
return _.
|
|
121
|
+
return _.includes(supportedWidgets, property.widget);
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
this.form = generisFormFactory(
|
|
@@ -46,7 +46,7 @@ export default function selectableFactory(component, config) {
|
|
|
46
46
|
var nodes = {};
|
|
47
47
|
|
|
48
48
|
//validate the component in parameter
|
|
49
|
-
var isAComponent = _.
|
|
49
|
+
var isAComponent = _.every(['on', 'trigger', 'init', 'render', 'is', 'getElement'], function(method) {
|
|
50
50
|
return _.isFunction(component[method]);
|
|
51
51
|
});
|
|
52
52
|
|
package/src/resource/tree.js
CHANGED
|
@@ -203,9 +203,7 @@ export default function resourceTreeFactory($container, config) {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
function reduceNodes(nodeList) {
|
|
206
|
-
return _.sortBy(nodeList,
|
|
207
|
-
return b.label - a.label;
|
|
208
|
-
}).reduce(reduceNode, '');
|
|
206
|
+
return _.sortBy(nodeList, ['label']).reduce(reduceNode, '');
|
|
209
207
|
}
|
|
210
208
|
|
|
211
209
|
if (this.is('rendered')) {
|
|
@@ -229,7 +229,7 @@ export default function (options) {
|
|
|
229
229
|
// Under rare circumstances a browser may report the mime type
|
|
230
230
|
// with quotes (e.g. "application/foo" instead of application/foo)
|
|
231
231
|
let checkType = file.type.replace(/^["']+|['"]+$/g, '');
|
|
232
|
-
return _.
|
|
232
|
+
return _.includes(filters, checkType);
|
|
233
233
|
});
|
|
234
234
|
|
|
235
235
|
if (files.length !== givenLength) {
|
|
@@ -259,7 +259,7 @@ export default function (options) {
|
|
|
259
259
|
);
|
|
260
260
|
} else {
|
|
261
261
|
//fallback on client side check
|
|
262
|
-
if (_.
|
|
262
|
+
if (_.includes(fileNames, file.name.toLowerCase())) {
|
|
263
263
|
//eslint-disable-next-line no-alert
|
|
264
264
|
result = window.confirm(__('Do you want to override "%s"?', file.name));
|
|
265
265
|
}
|
package/src/themeLoader.js
CHANGED
|
@@ -150,7 +150,7 @@ function themeLoader(config) {
|
|
|
150
150
|
/*
|
|
151
151
|
* Extract data from config
|
|
152
152
|
*/
|
|
153
|
-
const defaultTheme = config.default || _.
|
|
153
|
+
const defaultTheme = config.default || _.head(_.map(config.available, 'id'));
|
|
154
154
|
|
|
155
155
|
let activeTheme = defaultTheme;
|
|
156
156
|
|
|
@@ -219,7 +219,7 @@ function themeLoader(config) {
|
|
|
219
219
|
*/
|
|
220
220
|
change(id) {
|
|
221
221
|
//support to change to the "default" theme regardless it's id
|
|
222
|
-
if (_.
|
|
222
|
+
if (_.includes(['base', 'default'], id) && !isAttached(id)) {
|
|
223
223
|
id = defaultTheme;
|
|
224
224
|
}
|
|
225
225
|
|
package/src/tooltip.js
CHANGED
|
@@ -79,7 +79,7 @@ export default {
|
|
|
79
79
|
var $content = DataAttrHandler.getTarget('tooltip', $(this));
|
|
80
80
|
var opt;
|
|
81
81
|
var predefinedOptions = _.cloneDeep(defaultOptions);
|
|
82
|
-
themeName = _.
|
|
82
|
+
themeName = _.includes(themes, $(this).data('tooltip-theme'))
|
|
83
83
|
? $(this).data('tooltip-theme')
|
|
84
84
|
: 'default';
|
|
85
85
|
opt = {
|
|
@@ -110,7 +110,7 @@ export default {
|
|
|
110
110
|
var predefinedOptions = _.cloneDeep(defaultOptions);
|
|
111
111
|
|
|
112
112
|
calculatedOptions = options ? _.merge(predefinedOptions, options) : predefinedOptions;
|
|
113
|
-
themeName = _.
|
|
113
|
+
themeName = _.includes(themes, calculatedOptions.theme) ? calculatedOptions.theme : 'default';
|
|
114
114
|
template = {
|
|
115
115
|
template: themesMap[themeName]
|
|
116
116
|
};
|
package/src/transformer.js
CHANGED
|
@@ -172,7 +172,7 @@ function _transform($elem, transforms) {
|
|
|
172
172
|
|
|
173
173
|
$elem.css(cssObj);
|
|
174
174
|
$elem.removeClass('transform-translate transform-rotate transform-skew transform-scale');
|
|
175
|
-
$elem.addClass(_.
|
|
175
|
+
$elem.addClass(_.uniq(classNames).join(' '));
|
|
176
176
|
|
|
177
177
|
$elem.trigger('transform.' + ns, transforms);
|
|
178
178
|
}
|
package/src/validator.js
CHANGED
|
@@ -249,7 +249,7 @@ function validate($elt, callback, options) {
|
|
|
249
249
|
|
|
250
250
|
//call the callback function is given:
|
|
251
251
|
if (_.isFunction(callback)) {
|
|
252
|
-
valid = _.
|
|
252
|
+
valid = _.filter(results, { type: 'failure' }).length === 0;
|
|
253
253
|
callback.call($elt[0], valid, results);
|
|
254
254
|
}
|
|
255
255
|
};
|