@get-set/gs-sortable 0.0.13 → 0.0.14

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.
@@ -5,9 +5,9 @@ import init from '../actions/init';
5
5
  import destroy from '../actions/destroy';
6
6
  import PropTypes from 'prop-types';
7
7
  import defaultParams from '../constants/defaultParams';
8
- import initMouseMove from "../actions/initMouseMove";
9
- import initSortEnd from "../actions/initSortEnd";
10
- import initScroll from "../actions/initScroll";
8
+ import initMouseMove from '../actions/initMouseMove';
9
+ import initSortEnd from '../actions/initSortEnd';
10
+ import initScroll from '../actions/initScroll';
11
11
  import types from '../constants/types';
12
12
  import './styles/GSSortable.css';
13
13
 
@@ -17,7 +17,7 @@ const params = {
17
17
  gap: PropTypes.string,
18
18
  allowOutOfBox: PropTypes.bool,
19
19
  count: PropTypes.number,
20
- type: PropTypes.oneOf([types.column, types.row, types.grid])
20
+ type: PropTypes.oneOf([types.column, types.row, types.grid]),
21
21
  };
22
22
 
23
23
  /**
@@ -58,14 +58,14 @@ const GSSortable = ({ children, ...rest }) => {
58
58
  }
59
59
  },
60
60
  };
61
-
62
- window.addEventListener("mousemove", (e) => {
61
+
62
+ window.addEventListener('mousemove', e => {
63
63
  initMouseMove(e);
64
64
  });
65
- window.addEventListener("mouseup", (e) => {
65
+ window.addEventListener('mouseup', e => {
66
66
  initSortEnd(e);
67
67
  });
68
- window.addEventListener("scroll", () => {
68
+ window.addEventListener('scroll', () => {
69
69
  initScroll();
70
70
  });
71
71
  }
@@ -81,7 +81,7 @@ const GSSortable = ({ children, ...rest }) => {
81
81
  ref: {
82
82
  isAddjusting: false,
83
83
  grid: gridRef.current,
84
- currentParams : {...currentParams, reference: componentKey},
84
+ currentParams: { ...currentParams, reference: componentKey },
85
85
  destroy: () => {
86
86
  destroy(window.GSSortableConfigue.instance(componentKey));
87
87
  },
@@ -114,6 +114,16 @@ const GSSortable = ({ children, ...rest }) => {
114
114
  );
115
115
  }, []);
116
116
 
117
+ useEffect(() => {
118
+ console.log('children change');
119
+ if (componentKey != null) {
120
+ const ref = window.GSSortableConfigue.instance(componentKey);
121
+ if (ref !== undefined) {
122
+ ref.refresh();
123
+ }
124
+ }
125
+ }, [children]);
126
+
117
127
  return (
118
128
  <div
119
129
  className={`gs-sortable-instance gs-sortable-${params.type}`}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@get-set/gs-sortable",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Get-Set Sortable",
5
5
  "main": "index.js",
6
6
  "author": "Get-Set",