@sis-cc/dotstatsuite-visions 6.4.2 → 6.4.3

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.
@@ -1,14 +1,5 @@
1
1
  import * as R from 'ramda';
2
2
 
3
- export var swap = R.curry(function (index1, index2, list) {
4
- if (index1 < 0 || index2 < 0 || index1 > list.length - 1 || index2 > list.length - 1) {
5
- return list; // index out of bound
6
- }
7
- var value1 = list[index1];
8
- var value2 = list[index2];
9
- return R.pipe(R.set(R.lensIndex(index1), value2), R.set(R.lensIndex(index2), value1))(list);
10
- });
11
-
12
3
  export var changeLayout = function changeLayout(_ref) {
13
4
  var dragIndex = _ref.dragIndex,
14
5
  hoverIndex = _ref.hoverIndex,
@@ -17,8 +8,7 @@ export var changeLayout = function changeLayout(_ref) {
17
8
  currentLayout = _ref.currentLayout;
18
9
 
19
10
  if (R.equals(dragZone, dropZone)) {
20
- // swap elements in same box
21
- return R.over(R.lensProp(dropZone), swap(dragIndex, hoverIndex), currentLayout);
11
+ return R.over(R.lensProp(dropZone), R.move(dragIndex, hoverIndex), currentLayout);
22
12
  }
23
13
  var item = R.pipe(R.prop(dragZone), R.nth(dragIndex))(currentLayout);
24
14
  return R.pipe(R.over(R.lensProp(dragZone), R.without([item])), R.over(R.lensProp(dropZone), R.insert(hoverIndex, item)))(currentLayout);
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  exports.__esModule = true;
4
- exports.addHiddenElement = exports.rejectHiddenElement = exports.changeLayout = exports.swap = undefined;
4
+ exports.addHiddenElement = exports.rejectHiddenElement = exports.changeLayout = undefined;
5
5
 
6
6
  var _ramda = require('ramda');
7
7
 
@@ -9,15 +9,6 @@ var R = _interopRequireWildcard(_ramda);
9
9
 
10
10
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
11
11
 
12
- var swap = exports.swap = R.curry(function (index1, index2, list) {
13
- if (index1 < 0 || index2 < 0 || index1 > list.length - 1 || index2 > list.length - 1) {
14
- return list; // index out of bound
15
- }
16
- var value1 = list[index1];
17
- var value2 = list[index2];
18
- return R.pipe(R.set(R.lensIndex(index1), value2), R.set(R.lensIndex(index2), value1))(list);
19
- });
20
-
21
12
  var changeLayout = exports.changeLayout = function changeLayout(_ref) {
22
13
  var dragIndex = _ref.dragIndex,
23
14
  hoverIndex = _ref.hoverIndex,
@@ -26,8 +17,7 @@ var changeLayout = exports.changeLayout = function changeLayout(_ref) {
26
17
  currentLayout = _ref.currentLayout;
27
18
 
28
19
  if (R.equals(dragZone, dropZone)) {
29
- // swap elements in same box
30
- return R.over(R.lensProp(dropZone), swap(dragIndex, hoverIndex), currentLayout);
20
+ return R.over(R.lensProp(dropZone), R.move(dragIndex, hoverIndex), currentLayout);
31
21
  }
32
22
  var item = R.pipe(R.prop(dragZone), R.nth(dragIndex))(currentLayout);
33
23
  return R.pipe(R.over(R.lensProp(dragZone), R.without([item])), R.over(R.lensProp(dropZone), R.insert(hoverIndex, item)))(currentLayout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "6.4.2",
3
+ "version": "6.4.3",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",