carbon-react 93.0.4 → 94.0.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.
Files changed (81) hide show
  1. package/lib/__internal__/checkable-input/checkable-input.component.js +7 -1
  2. package/lib/__internal__/checkable-input/hidden-checkable-input.component.js +11 -1
  3. package/lib/__internal__/checkable-input/hidden-checkable-input.d.ts +5 -1
  4. package/lib/__internal__/form-field/form-field.component.js +9 -8
  5. package/lib/__internal__/form-field/form-field.d.ts +2 -0
  6. package/lib/components/action-popover/action-popover.component.js +28 -20
  7. package/lib/components/action-popover/action-popover.style.js +22 -12
  8. package/lib/components/i18n-provider/i18n-provider.component.js +0 -3
  9. package/lib/locales/en-gb.js +1 -8
  10. package/lib/locales/locale.d.ts +0 -7
  11. package/lib/locales/pl-pl.js +1 -8
  12. package/package.json +1 -6
  13. package/lib/components/action-toolbar/action-toolbar.component.js +0 -213
  14. package/lib/components/action-toolbar/action-toolbar.d.ts +0 -20
  15. package/lib/components/action-toolbar/action-toolbar.style.js +0 -40
  16. package/lib/components/action-toolbar/index.d.ts +0 -1
  17. package/lib/components/action-toolbar/index.js +0 -15
  18. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.component.js +0 -174
  19. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.d.ts +0 -25
  20. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.style.js +0 -73
  21. package/lib/components/configurable-items/configurable-item-row/index.d.ts +0 -1
  22. package/lib/components/configurable-items/configurable-item-row/index.js +0 -15
  23. package/lib/components/configurable-items/configurable-items.component.js +0 -155
  24. package/lib/components/configurable-items/configurable-items.d.ts +0 -20
  25. package/lib/components/configurable-items/configurable-items.style.js +0 -70
  26. package/lib/components/configurable-items/index.d.ts +0 -2
  27. package/lib/components/configurable-items/index.js +0 -23
  28. package/lib/components/drag-and-drop/__internal__/item-target/index.js +0 -15
  29. package/lib/components/drag-and-drop/__internal__/item-target/item-target.js +0 -44
  30. package/lib/components/drag-and-drop/__internal__/item-types/index.js +0 -15
  31. package/lib/components/drag-and-drop/__internal__/item-types/item-types.js +0 -20
  32. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +0 -171
  33. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.style.js +0 -28
  34. package/lib/components/drag-and-drop/custom-drag-layer/index.js +0 -15
  35. package/lib/components/drag-and-drop/drag-and-drop-test.stories.js +0 -95
  36. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/index.js +0 -15
  37. package/lib/components/drag-and-drop/draggable-context/__internal__/scrollable-parent/scrollable-parent.js +0 -36
  38. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +0 -264
  39. package/lib/components/drag-and-drop/draggable-context/index.js +0 -15
  40. package/lib/components/drag-and-drop/index.js +0 -39
  41. package/lib/components/drag-and-drop/with-drag/index.js +0 -15
  42. package/lib/components/drag-and-drop/with-drag/with-drag.js +0 -176
  43. package/lib/components/drag-and-drop/with-drop/index.js +0 -15
  44. package/lib/components/drag-and-drop/with-drop/with-drop.js +0 -201
  45. package/lib/components/table/draggable-table-cell/draggable-table-cell.component.js +0 -59
  46. package/lib/components/table/draggable-table-cell/draggable-table-cell.style.js +0 -36
  47. package/lib/components/table/draggable-table-cell/index.js +0 -15
  48. package/lib/components/table/index.js +0 -43
  49. package/lib/components/table/table-cell/index.js +0 -15
  50. package/lib/components/table/table-cell/table-cell.component.js +0 -164
  51. package/lib/components/table/table-cell/table-cell.style.js +0 -164
  52. package/lib/components/table/table-header/index.js +0 -15
  53. package/lib/components/table/table-header/table-header.component.js +0 -282
  54. package/lib/components/table/table-header/table-header.style.js +0 -116
  55. package/lib/components/table/table-modern.style.js +0 -110
  56. package/lib/components/table/table-row/index.js +0 -15
  57. package/lib/components/table/table-row/table-row-modern.style.js +0 -70
  58. package/lib/components/table/table-row/table-row.component.js +0 -486
  59. package/lib/components/table/table-row/table-row.style.js +0 -165
  60. package/lib/components/table/table-sizes.style.js +0 -33
  61. package/lib/components/table/table-story-helpers/table-story-wrapper.component.js +0 -189
  62. package/lib/components/table/table-subheader/index.js +0 -15
  63. package/lib/components/table/table-subheader/table-subheader.component.js +0 -35
  64. package/lib/components/table/table-subheader/table-subheader.style.js +0 -33
  65. package/lib/components/table/table.component.js +0 -792
  66. package/lib/components/table/table.config.js +0 -14
  67. package/lib/components/table/table.style.js +0 -139
  68. package/lib/components/table-ajax/__internal__/serialize/package.json +0 -3
  69. package/lib/components/table-ajax/__internal__/serialize/serialize.js +0 -26
  70. package/lib/components/table-ajax/index.js +0 -37
  71. package/lib/components/table-ajax/table-ajax.component.js +0 -602
  72. package/lib/patterns/configurable-items/actions/actions.js +0 -41
  73. package/lib/patterns/configurable-items/actions/package.json +0 -3
  74. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +0 -140
  75. package/lib/patterns/configurable-items/configurable-items-content/package.json +0 -3
  76. package/lib/patterns/configurable-items/configurable-items.js +0 -216
  77. package/lib/patterns/configurable-items/constants/constants.js +0 -13
  78. package/lib/patterns/configurable-items/constants/package.json +0 -3
  79. package/lib/patterns/configurable-items/package.json +0 -3
  80. package/lib/patterns/configurable-items/store/package.json +0 -3
  81. package/lib/patterns/configurable-items/store/store.js +0 -92
@@ -1,264 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _reactDndLegacy = require("react-dnd-legacy");
11
-
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _reactDndTouchBackend = _interopRequireDefault(require("react-dnd-touch-backend"));
15
-
16
- var _reactDom = _interopRequireDefault(require("react-dom"));
17
-
18
- var _itemTarget = _interopRequireDefault(require("../__internal__/item-target"));
19
-
20
- var _customDragLayer = _interopRequireDefault(require("../custom-drag-layer"));
21
-
22
- var _browser = _interopRequireDefault(require("../../../__internal__/utils/helpers/browser"));
23
-
24
- var _scrollableParent = _interopRequireDefault(require("./__internal__/scrollable-parent"));
25
-
26
- var _logger = _interopRequireDefault(require("../../../__internal__/utils/logger"));
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
-
32
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
33
-
34
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
35
-
36
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
37
-
38
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
39
-
40
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
41
-
42
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
43
-
44
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
-
46
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
47
-
48
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
49
-
50
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
51
-
52
- let deprecatedWarnTriggered = false;
53
-
54
- let DraggableContext = /*#__PURE__*/function (_React$Component) {
55
- _inherits(DraggableContext, _React$Component);
56
-
57
- var _super = _createSuper(DraggableContext);
58
-
59
- function DraggableContext(_props) {
60
- var _this;
61
-
62
- _classCallCheck(this, DraggableContext);
63
-
64
- _this = _super.call(this, _props);
65
-
66
- _defineProperty(_assertThisInitialized(_this), "state", {
67
- activeIndex: null // {Number} tracks the currently dragged index
68
-
69
- });
70
-
71
- _defineProperty(_assertThisInitialized(_this), "handleHover", _itemTarget.default.onHoverUpDown);
72
-
73
- _defineProperty(_assertThisInitialized(_this), "checkAutoScroll", event => {
74
- if (_this.state.activeIndex === null) {
75
- return;
76
- } // constant for the position of the mouse pointer
77
- // on the y axis
78
-
79
-
80
- const {
81
- clientY
82
- } = event;
83
-
84
- const {
85
- innerHeight
86
- } = _browser.default.getWindow(); // constant for the threshold where the auto scroll begins
87
-
88
-
89
- const threshold = Math.max(140, innerHeight / 4);
90
- let speed = 0;
91
-
92
- if (clientY < threshold) {
93
- // -1 to 0 as we move from 0 to threshold
94
- speed = -1 + clientY / threshold;
95
- } else if (clientY > innerHeight - threshold) {
96
- // 0 to 1 as we move from (innerHeight - threshold) to innerHeight
97
- speed = 1 - (innerHeight - clientY) / threshold;
98
- }
99
-
100
- const shouldScroll = _this.speed === 0 && speed !== 0;
101
- _this.speed = speed;
102
- if (shouldScroll) _this.startScrolling();
103
- });
104
-
105
- _defineProperty(_assertThisInitialized(_this), "startScrolling", () => {
106
- if (!_this.frame) {
107
- _this.frame = _browser.default.getWindow().requestAnimationFrame(_this.tick);
108
- }
109
- });
110
-
111
- _defineProperty(_assertThisInitialized(_this), "tick", () => {
112
- if (!_this.speed) {
113
- _this.frame = null;
114
- return;
115
- }
116
-
117
- const window = _browser.default.getWindow();
118
-
119
- if (!_this.element) {
120
- const node = _reactDom.default.findDOMNode(_assertThisInitialized(_this)); // eslint-disable-line react/no-find-dom-node
121
-
122
-
123
- _this.element = _scrollableParent.default.searchForScrollableParent(node);
124
- } else {
125
- _this.element.scrollTop += _this.speed * 10;
126
- }
127
-
128
- window.scrollTo(0, window.scrollY + _this.speed * 10);
129
- _this.frame = window.requestAnimationFrame(_this.tick);
130
- });
131
-
132
- _defineProperty(_assertThisInitialized(_this), "handleDrag", (originalIndex, hoverIndex) => {
133
- _this.setState({
134
- activeIndex: hoverIndex
135
- });
136
-
137
- if (typeof originalIndex !== "undefined") {
138
- _this.props.onDrag(originalIndex, hoverIndex);
139
- }
140
- });
141
-
142
- _defineProperty(_assertThisInitialized(_this), "handleBeginDrag", props => {
143
- return {
144
- index: props.index,
145
- offsetDiffY: 0,
146
- ...props
147
- };
148
- });
149
-
150
- _defineProperty(_assertThisInitialized(_this), "handleEndDrag", () => {
151
- // dragging has ended so remove the active index
152
- _this.setState({
153
- activeIndex: null
154
- });
155
-
156
- _this.speed = 0;
157
- });
158
-
159
- if (!deprecatedWarnTriggered) {
160
- deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
161
-
162
- _logger.default.deprecate("`DraggableContext` component is deprecated and will soon be removed.");
163
- } // Default speed of auto scrolling
164
-
165
-
166
- _this.speed = 0; // Frame callback ref
167
-
168
- _this.frame = null; // Document element to scroll if any
169
-
170
- _this.element = null;
171
- return _this;
172
- }
173
- /**
174
- * Returns this draggable context properties to child components.
175
- *
176
- * @method getChildContext
177
- * @return {void}
178
- */
179
-
180
-
181
- _createClass(DraggableContext, [{
182
- key: "getChildContext",
183
- value: function getChildContext() {
184
- return {
185
- dragAndDropActiveIndex: this.state.activeIndex,
186
- dragAndDropBeginDrag: this.handleBeginDrag,
187
- dragAndDropEndDrag: this.handleEndDrag,
188
- dragAndDropHover: this.handleHover,
189
- dragAndDropOnDrag: this.handleDrag
190
- };
191
- }
192
- /**
193
- * A callback for when hover is triggered
194
- *
195
- * @method handleHover
196
- * @return {Void}
197
- */
198
-
199
- }, {
200
- key: "render",
201
- value:
202
- /**
203
- * Renders the component
204
- */
205
- function render() {
206
- return /*#__PURE__*/_react.default.createElement("div", {
207
- onMouseMove: this.props.autoScroll && this.state.activeIndex !== null ? this.checkAutoScroll : undefined
208
- }, this.props.children, this.props.customDragLayer);
209
- }
210
- }]);
211
-
212
- return DraggableContext;
213
- }(_react.default.Component);
214
-
215
- DraggableContext.propTypes = {
216
- /**
217
- * The element(s) where you want to apply drag
218
- * and drop functionality
219
- */
220
- children: _propTypes.default.node.isRequired,
221
-
222
- /**
223
- * Optional CustomDragLayer to use for the ghost row when dragging & dropping
224
- */
225
- customDragLayer: _propTypes.default.node,
226
-
227
- /**
228
- * Callback function for when an item has been dragged
229
- * e.g. to update data in a store
230
- */
231
- onDrag: _propTypes.default.func.isRequired,
232
-
233
- /**
234
- * Prop to enable/disable auto scroll on drag
235
- */
236
- autoScroll: _propTypes.default.bool
237
- };
238
- /**
239
- * Defines a context object for child components of the draggable context component.
240
- * https://facebook.github.io/react/docs/context.html
241
- */
242
-
243
- DraggableContext.childContextTypes = {
244
- dragAndDropActiveIndex: _propTypes.default.number,
245
- // Tracks the currently dragged index
246
- dragAndDropBeginDrag: _propTypes.default.func,
247
- // Callback for when dragging begins
248
- dragAndDropEndDrag: _propTypes.default.func,
249
- // Callback for when dragging ends
250
- dragAndDropHover: _propTypes.default.func,
251
- // Callback for when a hover is triggered
252
- dragAndDropOnDrag: _propTypes.default.func // Callback for when order is changed
253
-
254
- };
255
- DraggableContext.defaultProps = {
256
- customDragLayer: /*#__PURE__*/_react.default.createElement(_customDragLayer.default, null),
257
- autoScroll: false
258
- };
259
-
260
- var _default = (0, _reactDndLegacy.DragDropContext)((0, _reactDndTouchBackend.default)({
261
- enableMouseEvents: true
262
- }))(DraggableContext);
263
-
264
- exports.default = _default;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _draggableContext.default;
10
- }
11
- });
12
-
13
- var _draggableContext = _interopRequireDefault(require("./draggable-context"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "DraggableContext", {
7
- enumerable: true,
8
- get: function () {
9
- return _draggableContext.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "WithDrag", {
13
- enumerable: true,
14
- get: function () {
15
- return _withDrag.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "WithDrop", {
19
- enumerable: true,
20
- get: function () {
21
- return _withDrop.default;
22
- }
23
- });
24
- Object.defineProperty(exports, "CustomDragLayer", {
25
- enumerable: true,
26
- get: function () {
27
- return _customDragLayer.default;
28
- }
29
- });
30
-
31
- var _draggableContext = _interopRequireDefault(require("./draggable-context"));
32
-
33
- var _withDrag = _interopRequireDefault(require("./with-drag"));
34
-
35
- var _withDrop = _interopRequireDefault(require("./with-drop"));
36
-
37
- var _customDragLayer = _interopRequireDefault(require("./custom-drag-layer"));
38
-
39
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _withDrag.default;
10
- }
11
- });
12
-
13
- var _withDrag = _interopRequireDefault(require("./with-drag"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,176 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _reactDndLegacy = require("react-dnd-legacy");
13
-
14
- var _itemTypes = _interopRequireDefault(require("../__internal__/item-types"));
15
-
16
- var _browser = _interopRequireDefault(require("../../../__internal__/utils/helpers/browser"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
-
22
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
-
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
-
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
-
28
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
-
30
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
-
32
- function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33
-
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- let WithDrag = /*#__PURE__*/function (_React$Component) {
43
- _inherits(WithDrag, _React$Component);
44
-
45
- var _super = _createSuper(WithDrag);
46
-
47
- function WithDrag(...args) {
48
- var _this;
49
-
50
- _classCallCheck(this, WithDrag);
51
-
52
- _this = _super.call(this, ...args);
53
-
54
- _defineProperty(_assertThisInitialized(_this), "allowTextSelection", event => {
55
- const allowedElements = ["INPUT", "TEXTAREA", "SELECT"];
56
- const nonInputElement = event.target instanceof HTMLElement && allowedElements.indexOf(event.target.tagName) < 0;
57
-
58
- if (nonInputElement || _this.dragging) {
59
- event.preventDefault();
60
- return false;
61
- }
62
-
63
- return true;
64
- });
65
-
66
- return _this;
67
- }
68
-
69
- _createClass(WithDrag, [{
70
- key: "componentDidMount",
71
- value: function componentDidMount() {
72
- _browser.default.getWindow().addEventListener("selectstart", this.allowTextSelection);
73
- }
74
- }, {
75
- key: "componentWillUnmount",
76
- value: function componentWillUnmount() {
77
- _browser.default.getWindow().removeEventListener("selectstart", this.allowTextSelection);
78
- } // In Safari it changes the mouse cursor when dragging because it thinks text is being selected
79
- // We test if the target is an html element (not text) or if we already know the user is dragging
80
-
81
- }, {
82
- key: "render",
83
- value: function render() {
84
- // this.props.connectDragSource comes from react-dnd DragSource higher
85
- // order component, so disable the react/prop-types ESLint rule on the line
86
- // below
87
- return this.props.connectDragSource(this.props.children, {
88
- // eslint-disable-line react/prop-types
89
- dropEffect: "copy"
90
- });
91
- }
92
- }]);
93
-
94
- return WithDrag;
95
- }(_react.default.Component);
96
-
97
- WithDrag.propTypes = {
98
- /**
99
- * The component that will have drag enabled
100
- */
101
- children: _propTypes.default.node.isRequired,
102
-
103
- /**
104
- * A function that returns the dom node being dragged.
105
- * It not used in this compnent but is passed to CustomDragLayer via the DragLayer higher order component
106
- * You cannot pass a ref directly as the prop because it is undefined until mounted.
107
- */
108
-
109
- /* eslint-disable react/no-unused-prop-types */
110
- draggableNode: _propTypes.default.func,
111
-
112
- /* eslint-enable react/no-unused-prop-types */
113
- // The following prop types are required by react-dnd,
114
- // and aren't used in this component directly. Therefore
115
- // disable the ESLint rule react/no-unused-prop-types
116
-
117
- /* eslint-disable react/no-unused-prop-types */
118
-
119
- /**
120
- * @private
121
- * @ignore
122
- */
123
- identifier: _propTypes.default.string,
124
- // identifies an association between WithDrag and WithDrop
125
-
126
- /**
127
- * @private
128
- * @ignore
129
- */
130
- canDrag: _propTypes.default.func,
131
- // an optional callback to determine if this item can be dragged
132
-
133
- /**
134
- * @private
135
- * @ignore
136
- */
137
- beginDrag: _propTypes.default.func,
138
- // an optional callback to trigger when dragging begins
139
-
140
- /**
141
- * @private
142
- * @ignore
143
- */
144
- endDrag: _propTypes.default.func // an optional callback to trigger when dragging ends
145
-
146
- /* eslint-enable react/no-unused-prop-types */
147
-
148
- };
149
- WithDrag.contextTypes = {
150
- dragAndDropBeginDrag: _propTypes.default.func,
151
- dragAndDropEndDrag: _propTypes.default.func
152
- };
153
- const ItemSource = {
154
- canDrag(props, monitor) {
155
- return props.canDrag ? props.canDrag(props, monitor) : true;
156
- },
157
-
158
- beginDrag(props, monitor, component) {
159
- component.dragging = true;
160
- const beginDrag = props.beginDrag || component.context.dragAndDropBeginDrag;
161
- return beginDrag(props, monitor, component);
162
- },
163
-
164
- endDrag(props, monitor, component) {
165
- component.dragging = false;
166
- const endDrag = props.endDrag || component.context.dragAndDropEndDrag;
167
- return endDrag(props, monitor, component);
168
- }
169
-
170
- }; // eslint-disable-next-line no-class-assign
171
-
172
- WithDrag = (0, _reactDndLegacy.DragSource)(_itemTypes.default.getItemType, ItemSource, connect => ({
173
- connectDragSource: connect.dragSource()
174
- }))(WithDrag);
175
- var _default = WithDrag;
176
- exports.default = _default;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "default", {
7
- enumerable: true,
8
- get: function () {
9
- return _withDrop.default;
10
- }
11
- });
12
-
13
- var _withDrop = _interopRequireDefault(require("./with-drop"));
14
-
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }