Skip to content

Commit

Permalink
Merge branch 'release-3.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
yukipastelcat committed Oct 5, 2023
2 parents 0365f86 + af7e0b9 commit 1ead599
Show file tree
Hide file tree
Showing 32 changed files with 128 additions and 279 deletions.
293 changes: 71 additions & 222 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"@oat-sa/prettier-config": "^0.1.1",
"@oat-sa/rollup-plugin-wildcard-external": "^1.0.0",
"@oat-sa/tao-calculator": "^0.6.2",
"@oat-sa/tao-core-libs": "^0.5.3",
"@oat-sa/tao-core-sdk": "^2.0.1",
"@oat-sa/tao-core-libs": "^1.0.0",
"@oat-sa/tao-core-sdk": "^3.0.0",
"@oat-sa/tao-core-shared-libs": "^1.4.1",
"@oat-sa/tao-qunit-testrunner": "^2.0.0",
"async": "^0.2.10",
Expand All @@ -70,7 +70,7 @@
"interactjs": "1.3.4",
"jquery": "1.9.1",
"jquery-mockjax": "^2.5.0",
"lodash": "2.4.1",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"npm-run-all": "^4.1.5",
Expand Down
2 changes: 1 addition & 1 deletion src/adder.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const Adder = {
}
}
//check supported positions
if (!_.contains(positions, options.position)) {
if (!_.includes(positions, options.position)) {
return $.error('Unsupported position option');
}

Expand Down
4 changes: 2 additions & 2 deletions src/areaBroker.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export default function areaBroker(requiredAreas, $container, mapping) {
}

keys = _.keys(areasMapping);
required = _.all(requiredAreas, function(val) {
return _.contains(keys, val);
required = _.every(requiredAreas, function(val) {
return _.includes(keys, val);
});
if (!required) {
throw new TypeError('You have to define a mapping for at least : ' + requiredAreas.join(', '));
Expand Down
2 changes: 1 addition & 1 deletion src/btngrouper.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var BtnGrouper = {
//get options using default
options = _.defaults(options || {}, defaults);

if (!_.contains(availableActions, options.action)) {
if (!_.includes(availableActions, options.action)) {
return $.error('Action ' + options.action + ' not supported');
}

Expand Down
6 changes: 3 additions & 3 deletions src/ckeditor/dtdHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var dtdHandler = (function () {
if (mode.toLowerCase() === 'xhtml') {
mode = 'html';
}
if (!_.contains(['html', 'qti'], mode)) {
if (!_.includes(['html', 'qti'], mode)) {
throw new Error('Unknown mode ' + mode);
}
dtdMode = mode;
Expand Down Expand Up @@ -123,7 +123,7 @@ var dtdHandler = (function () {
* @returns {*}
*/
var isChildOf = function (child, of) {
return _.contains(getChildrenOf(of), _normalizeElement(child));
return _.includes(getChildrenOf(of), _normalizeElement(child));
};

/**
Expand All @@ -134,7 +134,7 @@ var dtdHandler = (function () {
* @returns {*}
*/
var isParentOf = function (parent, of) {
return _.contains(getParentsOf(of), _normalizeElement(parent));
return _.includes(getParentsOf(of), _normalizeElement(parent));
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function component(specs, defaults) {
*/
init: function init(config) {
this.config = _(config || {})
.omit(function(value) {
.omitBy(function(value) {
return value === null || typeof value === 'undefined';
})
.defaults(defaults || {})
Expand Down
10 changes: 5 additions & 5 deletions src/datatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ const dataTable = {

// process data by model rules
if (_.some(model, 'transform')) {
const transforms = _.where(model, 'transform');
const transforms = _.filter(model, 'transform');

_.forEach(dataset.data, (row, index) => {
_.forEach(transforms, field => {
Expand Down Expand Up @@ -499,8 +499,8 @@ const dataTable = {

action.apply($btn, [
identifier,
_.first(
_.where(dataset.data, {
_.head(
_.filter(dataset.data, {
id: identifier
})
)
Expand All @@ -516,7 +516,7 @@ const dataTable = {

// Attach listeners to model.type = action
if (_.some(options.model, 'type')) {
const types = _.where(options.model, 'type');
const types = _.filter(options.model, 'type');
_.forEach(types, field => {
if (field.type === 'actions' && field.actions) {
attachActionListeners(field.actions);
Expand Down Expand Up @@ -617,7 +617,7 @@ const dataTable = {
$rows.removeClass('selected');
currentRow.toggleClass('selected');

$elt.trigger('selected.' + ns, _.where(dataset.data, { id: currentRow.data('item-identifier') }));
$elt.trigger('selected.' + ns, _.filter(dataset.data, { id: currentRow.data('item-identifier') }));
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/datetime/picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export default function dateTimePickerFactory(container, options) {
*/
updateConstraints: function updateConstraints(constraint, constraintValue) {
if (this.is('ready')) {
if (_.contains(supportedConstraints, constraint)) {
if (_.includes(supportedConstraints, constraint)) {
this.picker.set(constraint, constraintValue);
}
}
Expand Down Expand Up @@ -475,7 +475,7 @@ export default function dateTimePickerFactory(container, options) {
}

_.forEach(this.config.constraints, function(constraintValue, constraint) {
if (_.contains(supportedConstraints, constraint) && constraintValue) {
if (_.includes(supportedConstraints, constraint) && constraintValue) {
self.pickerConfig[constraint] = constraintValue;
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/destination/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function destinationSelectorFactory($container, config) {
var uris;
//validate the selection
if (_.isPlainObject(select)) {
uris = _.pluck(select, 'uri');
uris = _.map(select, 'uri');
if (uris.length) {
return uris[0];
}
Expand Down
2 changes: 1 addition & 1 deletion src/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const dialog = {
init(options) {
// split options to events
const events = {};
const initOptions = _.omit(options || {}, (value, key) => {
const initOptions = _.omitBy(options || {}, (value, key) => {
if (key.length > 2 && 'on' === key.substr(0, 2)) {
events[key.substr(2)] = value;
return true;
Expand Down
8 changes: 5 additions & 3 deletions src/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var feedbackFactory = function feedbackFactory($container, config) {
message: function message(level, msg, params, options) {
var displayedMessage = msg;

if (!level || !_.contains(levels, level)) {
if (!level || !_.includes(levels, level)) {
level = 'info';
}

Expand Down Expand Up @@ -208,7 +208,9 @@ var feedbackFactory = function feedbackFactory($container, config) {
//close others
_(currents)
.reject(this)
.invoke('close');
.forEach(function (fb) {
fb.close();
});

//and display
return this.display();
Expand Down Expand Up @@ -287,7 +289,7 @@ var feedbackFactory = function feedbackFactory($container, config) {
//for backward compat
$container.trigger('close.feedback');

_.remove(currents, this);
_.pull(currents, this);
})
.init(config);
};
Expand Down
2 changes: 1 addition & 1 deletion src/formValidator/formValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ var formValidatorFactory = function formValidatorFactory(options) {
state.valid = state.valid && valid;

if (!valid) {
firstErrorData = _.pluck(_.filter(report, { type: 'failure' }), 'data')[0];
firstErrorData = _.map(_.filter(report, { type: 'failure' }), 'data')[0];
highlightField($field, false, firstErrorData.message);
state.errors.push(
$.extend(
Expand Down
2 changes: 1 addition & 1 deletion src/generis/widget/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var _widgetFactories = {
export default function(uri) {
var factory;

if (!uri || !_.contains(Object.keys(_widgetFactories), uri)) {
if (!uri || !_.includes(Object.keys(_widgetFactories), uri)) {
factory = _widgetFactories[_default];
} else {
factory = _widgetFactories[uri];
Expand Down
4 changes: 2 additions & 2 deletions src/groupvalidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $.fn.groupValidator = function(options) {
$container.trigger('validated.group', [
_(states)
.values()
.contains(false) === false,
.includes(false) === false,
this
]);
};
Expand Down Expand Up @@ -72,7 +72,7 @@ $.fn.groupValidator.defaults = {
$elt.siblings('.' + options.errorMessageClass).remove();

if (valid === false) {
rule = _.where(results, { type: 'failure' })[0];
rule = _.filter(results, { type: 'failure' })[0];
$elt.addClass(options.errorClass);
if (rule && rule.data.message) {
$elt.after("<span class='" + options.errorMessageClass + "'>" + rule.data.message + '</span>');
Expand Down
2 changes: 1 addition & 1 deletion src/image/ImgStateActive/mediaSizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const mediaSizer = function mediaSizer(media, widget) {

}

_(['width', 'height']).each(function (sizeAttr) {
_(['width', 'height']).forEach(function (sizeAttr) {
let val;
if (
media[sizeAttr] === '' ||
Expand Down
2 changes: 1 addition & 1 deletion src/inplacer.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const InPlacer = {
var width = options.width || $elt.width() + 'px';
var $editor;
emptyText($elt);
if (_.contains(options.mapping.textarea, $elt.prop('tagName').toLowerCase())) {
if (_.includes(options.mapping.textarea, $elt.prop('tagName').toLowerCase())) {
const height = options.height || $elt.height() + 'px';
$editor = $elt
.append('<textarea>' + text + '</textarea>')
Expand Down
6 changes: 3 additions & 3 deletions src/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const lockApi = {
* @returns {lockApi}
*/
message: function message(category, msg, options) {
if (!category || !_.contains(_.keys(categories), category)) {
if (!category || !_.includes(_.keys(categories), category)) {
category = 'hasLock';
}
this.setState(states.created);
Expand Down Expand Up @@ -334,7 +334,7 @@ const lockState = {
if (_.isString(verify)) {
verify = [verify];
}
return _.contains(verify, this._state);
return _.includes(verify, this._state);
},

/**
Expand All @@ -343,7 +343,7 @@ const lockState = {
* @throws {Error} if we try to set an invalid state
*/
setState: function setState(state) {
if (!_.contains(states, state)) {
if (!_.includes(states, state)) {
throw new Error('Unkown state ' + state);
}
this._state = state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export default function mediaDimensionFactory($container, media, config) {
}
return chars;
})(),
allowed = _.contains(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);
allowed = _.includes(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);

if (!allowed) {
e.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion src/mediaplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function mediaplayerFactory(config) {
*/
init(mediaPlayerConfig) {
// load the config set, discard null values in order to allow defaults to be set
this.config = _.omit(mediaPlayerConfig || {}, value => typeof value === 'undefined' || value === null);
this.config = _.omitBy(mediaPlayerConfig || {}, value => typeof value === 'undefined' || value === null);
_.defaults(this.config, defaults.options);
if (!this.config.mimeType && 'string' === typeof this.config.type && this.config.type.indexOf('/') > 0) {
this.config.mimeType = this.config.type;
Expand Down
2 changes: 1 addition & 1 deletion src/mediasizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ MediaSizer = {
return chars;
})();

return _.contains(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);
return _.includes(specChars, c) || (c >= 48 && c <= 57) || (c >= 96 && c <= 105);
});

_fields[unit][dim].on('keyup blur sliderchange', function(e) {
Expand Down
6 changes: 3 additions & 3 deletions src/pageStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function pageStatusFactory(options) {
*/
pageStatus = eventifier({});

if (_.contains(options.track, 'load')) {
if (_.includes(options.track, 'load')) {
//the load event won't be triggered on the current window,
//the window is already loaded
win.addEventListener('load', function() {
Expand All @@ -94,7 +94,7 @@ export default function pageStatusFactory(options) {
});
}

if (_.contains(options.track, 'visibility')) {
if (_.includes(options.track, 'visibility')) {
//minimize, switch tab, move the window in background (mobile), etc.
win.addEventListener(visibilityChangeEvent, function(e) {
_.defer(function() {
Expand All @@ -107,7 +107,7 @@ export default function pageStatusFactory(options) {
});
}

if (_.contains(options.track, 'focus')) {
if (_.includes(options.track, 'focus')) {
//losing the window focus, the event can be triggered multiple time
win.addEventListener(
'blur',
Expand Down
2 changes: 1 addition & 1 deletion src/resource/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export default function filtersFactory($container, config) {
this.getElement().empty();

properties = _.filter(data.properties, function(property) {
return _.contains(supportedWidgets, property.widget);
return _.includes(supportedWidgets, property.widget);
});

this.form = generisFormFactory(
Expand Down
2 changes: 1 addition & 1 deletion src/resource/selectable.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function selectableFactory(component, config) {
var nodes = {};

//validate the component in parameter
var isAComponent = _.all(['on', 'trigger', 'init', 'render', 'is', 'getElement'], function(method) {
var isAComponent = _.every(['on', 'trigger', 'init', 'render', 'is', 'getElement'], function(method) {
return _.isFunction(component[method]);
});

Expand Down
4 changes: 1 addition & 3 deletions src/resource/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ export default function resourceTreeFactory($container, config) {
}

function reduceNodes(nodeList) {
return _.sortBy(nodeList, function (a, b) {
return b.label - a.label;
}).reduce(reduceNode, '');
return _.sortBy(nodeList, ['label']).reduce(reduceNode, '');
}

if (this.is('rendered')) {
Expand Down
4 changes: 2 additions & 2 deletions src/resourcemgr/fileSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export default function (options) {
// Under rare circumstances a browser may report the mime type
// with quotes (e.g. "application/foo" instead of application/foo)
let checkType = file.type.replace(/^["']+|['"]+$/g, '');
return _.contains(filters, checkType);
return _.includes(filters, checkType);
});

if (files.length !== givenLength) {
Expand Down Expand Up @@ -259,7 +259,7 @@ export default function (options) {
);
} else {
//fallback on client side check
if (_.contains(fileNames, file.name.toLowerCase())) {
if (_.includes(fileNames, file.name.toLowerCase())) {
//eslint-disable-next-line no-alert
result = window.confirm(__('Do you want to override "%s"?', file.name));
}
Expand Down
4 changes: 2 additions & 2 deletions src/themeLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function themeLoader(config) {
/*
* Extract data from config
*/
const defaultTheme = config.default || _.first(_.pluck(config.available, 'id'));
const defaultTheme = config.default || _.head(_.map(config.available, 'id'));

let activeTheme = defaultTheme;

Expand Down Expand Up @@ -219,7 +219,7 @@ function themeLoader(config) {
*/
change(id) {
//support to change to the "default" theme regardless it's id
if (_.contains(['base', 'default'], id) && !isAttached(id)) {
if (_.includes(['base', 'default'], id) && !isAttached(id)) {
id = defaultTheme;
}

Expand Down
Loading

0 comments on commit 1ead599

Please sign in to comment.