tenjin-ui-kit 0.3.73 → 0.3.74

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 (107) hide show
  1. package/README.md +13 -13
  2. package/common/hooks/apiHooks.js +199 -91
  3. package/common/hooks/newApiHook.js +258 -127
  4. package/common/utils/security/index.js +2 -2
  5. package/common/utils/security/securityConfig.js +2 -1
  6. package/components/Canvas.js +101 -172
  7. package/components/DragBox/index.js +31 -21
  8. package/components/InputWithChip/index.js +83 -178
  9. package/components/RightContext/index.css +20 -20
  10. package/components/RightContext/index.js +41 -17
  11. package/components/WorkFlow.js +29 -19
  12. package/components/WorkFlowBuilder.js +56 -32
  13. package/components/alert/Style.js +14 -11
  14. package/components/alert/index.js +14 -8
  15. package/components/attachment/index.js +31 -26
  16. package/components/authenticationProvider/AuthError.js +4 -3
  17. package/components/authenticationProvider/AuthLoader.js +4 -3
  18. package/components/authenticationProvider/index.js +130 -58
  19. package/components/avatar/index.js +23 -24
  20. package/components/avatar/styles.js +77 -76
  21. package/components/breadCrumbs/index.js +89 -64
  22. package/components/breadCrumbs/style.js +4 -1
  23. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +6 -7
  24. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +8 -5
  25. package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +6 -7
  26. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +7 -8
  27. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +7 -8
  28. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +19 -16
  29. package/components/browsingTestCaseLayout/index.js +46 -30
  30. package/components/browsingTestCaseLayout/style.css +82 -82
  31. package/components/button/index.js +58 -47
  32. package/components/chatBotModal/index.js +61 -40
  33. package/components/checkBox/index.js +10 -8
  34. package/components/combobox/index.js +216 -182
  35. package/components/divider/index.js +18 -9
  36. package/components/editableField/index.js +46 -19
  37. package/components/error/index.js +12 -6
  38. package/components/errorBoundary/index.js +98 -74
  39. package/components/fileUploader/index.js +58 -46
  40. package/components/fileUploader/style.js +49 -46
  41. package/components/filter/ValueSelector.js +243 -148
  42. package/components/filter/index.js +66 -43
  43. package/components/iconButton/index.js +4 -3
  44. package/components/input/index.js +74 -60
  45. package/components/layout/index.js +49 -36
  46. package/components/layout/main/index.js +14 -13
  47. package/components/layout/main/style.js +14 -11
  48. package/components/layout/pageContent/index.js +7 -8
  49. package/components/layout/sidebar/FlatMenu.js +47 -51
  50. package/components/layout/sidebar/GroupedIconMenu.js +194 -169
  51. package/components/layout/sidebar/GroupedMenu.js +50 -45
  52. package/components/layout/sidebar/ProjectMenu.js +185 -165
  53. package/components/layout/sidebar/index.js +26 -27
  54. package/components/layout/sidebar/style.js +143 -138
  55. package/components/layout/topBar/ProjectTopbar.js +119 -86
  56. package/components/layout/topBar/UserAvatar.js +65 -51
  57. package/components/layout/topBar/index.js +41 -23
  58. package/components/loader/index.js +12 -9
  59. package/components/menu/index.js +42 -23
  60. package/components/modal/Modal.js +6 -5
  61. package/components/modal/index.js +20 -16
  62. package/components/modal/style.js +56 -53
  63. package/components/optionMenu/index.js +72 -57
  64. package/components/pagination/index.js +43 -23
  65. package/components/pagination/style.js +28 -25
  66. package/components/paginationUpdated/index.js +26 -19
  67. package/components/paper/index.js +22 -20
  68. package/components/paper/style.js +27 -24
  69. package/components/reactSelect/index.js +97 -64
  70. package/components/reactSelect/style.js +151 -131
  71. package/components/richTextEditor/index.js +48 -24
  72. package/components/select/GroupedSelect.js +100 -56
  73. package/components/select/SimpleSelect.js +99 -59
  74. package/components/select/index.js +69 -56
  75. package/components/simpleSelect/index.js +22 -18
  76. package/components/sort/index.js +36 -23
  77. package/components/switch/index.js +15 -14
  78. package/components/switch/style.js +32 -29
  79. package/components/switch/switch.js +47 -30
  80. package/components/table/ReactTable.js +83 -59
  81. package/components/table/SimpleTable.js +91 -67
  82. package/components/table/index.js +206 -300
  83. package/components/text/index.js +30 -22
  84. package/components/timeStamp/index.js +6 -4
  85. package/components/timeStamp/style.js +15 -12
  86. package/components/topBar/index.js +102 -86
  87. package/components/tree/index.js +58 -30
  88. package/components/tree/style.js +23 -20
  89. package/components/valuePicker/ValueSelector.js +160 -78
  90. package/components/valuePicker/index.js +50 -30
  91. package/components/wrapperLayout/layout/index.js +7 -8
  92. package/components/wrapperLayout/main/index.js +7 -8
  93. package/components/wrapperLayout/main/pageContainer/index.js +5 -6
  94. package/components/wrapperLayout/main/sideBar/index.js +175 -171
  95. package/components/wrapperLayout/main/sideBar/style.js +183 -177
  96. package/components/wrapperLayout/topBar/UserAvatar.js +5 -6
  97. package/components/wrapperLayout/topBar/avatar.js +18 -15
  98. package/components/wrapperLayout/topBar/index.js +107 -115
  99. package/components/wrapperLayout/topBar/menuIcon.js +5 -6
  100. package/components/wrapperLayout/topBar/style.js +64 -63
  101. package/http/index.js +188 -92
  102. package/index.js +55 -53
  103. package/package.json +124 -125
  104. package/templates/listPage/index.js +196 -168
  105. package/themes/default.js +7 -5
  106. package/themes/defaultSmall.js +3 -2
  107. package/themes/responsiveTheme.js +8 -6
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -11,155 +12,75 @@ var _WorkFlow = _interopRequireDefault(require("./WorkFlow"));
11
12
  require("../../App.css");
12
13
  var _material = require("@mui/material");
13
14
  var _text = _interopRequireDefault(require("./text"));
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
16
- // import { Grid } from '@mui/material';
17
- // import React, { useState } from 'react';
18
-
19
- // const Canvas = () => {
20
- // const [inputBoxes, setInputBoxes] = useState([]);
21
- // let [type, setType] = useState(null);
22
-
23
- // const addInputBox = () => {
24
- // setInputBoxes([...inputBoxes, { label: 'Text', value: '' }]);
25
- // setType('input');
26
- // };
27
-
28
- // const handleInputChange = (index, event) => {
29
- // const values = [...inputBoxes];
30
- // values[index] = event.target.value;
31
- // setInputBoxes(values);
32
- // };
33
-
34
- // const addIfElseInputBox = () => {
35
- // setInputBoxes([
36
- // ...inputBoxes,
37
- // { label: 'If', value: '' },
38
- // { label: 'Else', value: '' },
39
- // ]);
40
- // setType('if_else');
41
- // };
42
-
43
- // // const handleIfElseInputChange = (index, event) => {
44
- // // const values = [...inputBoxes];
45
- // // values[index] = event.target.value;
46
- // // setInputBoxes(values);
47
- // // };
48
-
49
- // return (
50
- // <div
51
- // style={{
52
- // border: '1px solid black',
53
- // padding: '10px',
54
- // display: 'inline-block',
55
- // }}
56
- // >
57
- // <div
58
- // style={{
59
- // display: 'flex',
60
- // justifyContent: 'center',
61
- // alignItems: 'center',
62
- // }}
63
- // >
64
- // <div
65
- // style={{ fontSize: '30px', cursor: 'pointer' }}
66
- // onClick={addInputBox}
67
- // title="Add Text Box"
68
- // >
69
- // +
70
- // </div>
71
- // </div>
72
- // <div
73
- // style={{
74
- // display: 'flex',
75
- // justifyContent: 'center',
76
- // alignItems: 'center',
77
- // }}
78
- // >
79
- // <div
80
- // style={{ fontSize: '30px', cursor: 'pointer' }}
81
- // onClick={addIfElseInputBox}
82
- // title="Add If Else Box"
83
- // >
84
- // +
85
- // </div>
86
- // </div>
87
-
88
- // {inputBoxes.map((box, index) => (
89
- // <Grid item container>
90
- // <Grid item xs>
91
- // <div
92
- // style={{
93
- // border: '1px solid black',
94
- // padding: '10px',
95
- // display: 'inline-block',
96
- // }}
97
- // >
98
- // <div key={index} style={{ marginTop: '1rem' }}>
99
- // <label htmlFor={`${type}-${index}`}>{box.label}</label>
100
- // <br />
101
- // <input
102
- // id={`${type}-${index}`}
103
- // type="text"
104
- // value={box.value}
105
- // onChange={(e) => {
106
- // const updatedBoxes = [...inputBoxes];
107
- // updatedBoxes[index].value = e.target.value;
108
- // setInputBoxes(updatedBoxes);
109
- // }}
110
- // />
111
- // </div>
112
- // </div>
113
- // </Grid>
114
- // </Grid>
115
- // ))}
116
- // </div>
117
- // );
118
- // };
119
-
120
- // export default Canvas;
121
-
122
- ///New
123
-
124
- const Canvas = () => {
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
19
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
21
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
22
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
26
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
27
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
28
+ var Canvas = function Canvas() {
125
29
  return /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
126
30
  backend: _reactDndHtml5Backend.HTML5Backend
127
31
  }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(DragDrop, null)));
128
32
  };
129
- var _default = exports.default = Canvas;
130
- const WorkFlowList = [{
33
+ var _default = Canvas;
34
+ exports.default = _default;
35
+ var WorkFlowList = [{
131
36
  id: 1,
132
37
  name: "If Else Box"
133
38
  }, {
134
39
  id: 2,
135
40
  name: "Simple Text Box"
136
41
  }];
137
- const DragDrop = () => {
138
- const [board, setBoard] = (0, _react.useState)([]);
139
- const [{
140
- isOver
141
- }, drop] = (0, _reactDnd.useDrop)(() => ({
142
- accept: "block",
143
- drop: item => addBlockToBoard(item.id, true),
144
- collect: monitor => ({
145
- isOver: !!monitor.isOver()
146
- })
147
- }));
148
- const addBlockToBoard = (id, isDropped) => {
149
- const workFlowList = WorkFlowList.filter(workflow => id === workflow.id);
150
- const workflow = {
42
+ var DragDrop = function DragDrop() {
43
+ var _useState = (0, _react.useState)([]),
44
+ _useState2 = _slicedToArray(_useState, 2),
45
+ board = _useState2[0],
46
+ setBoard = _useState2[1];
47
+ var _useDrop = (0, _reactDnd.useDrop)(function () {
48
+ return {
49
+ accept: "block",
50
+ drop: function drop(item) {
51
+ return addBlockToBoard(item.id, true);
52
+ },
53
+ collect: function collect(monitor) {
54
+ return {
55
+ isOver: !!monitor.isOver()
56
+ };
57
+ }
58
+ };
59
+ }),
60
+ _useDrop2 = _slicedToArray(_useDrop, 2),
61
+ isOver = _useDrop2[0].isOver,
62
+ drop = _useDrop2[1];
63
+ var addBlockToBoard = function addBlockToBoard(id, isDropped) {
64
+ var workFlowList = WorkFlowList.filter(function (workflow) {
65
+ return id === workflow.id;
66
+ });
67
+ var workflow = {
151
68
  name: workFlowList[0].name,
152
69
  id: workFlowList[0].id
153
70
  };
154
71
  if (isDropped) {
155
- setBoard(board => [...board, workflow]);
72
+ setBoard(function (board) {
73
+ return [].concat(_toConsumableArray(board), [workflow]);
74
+ });
156
75
  } else {
157
- setBoard(board => [...board, workflow.name]);
76
+ setBoard(function (board) {
77
+ return [].concat(_toConsumableArray(board), [workflow.name]);
78
+ });
158
79
  }
159
80
  };
160
81
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
161
82
  className: "WorkFlow"
162
- }, WorkFlowList?.map(workflow => {
83
+ }, WorkFlowList === null || WorkFlowList === void 0 ? void 0 : WorkFlowList.map(function (workflow) {
163
84
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_WorkFlow.default, {
164
85
  name: workflow.name,
165
86
  id: workflow.id
@@ -167,7 +88,7 @@ const DragDrop = () => {
167
88
  })), /*#__PURE__*/_react.default.createElement("div", {
168
89
  className: "Board",
169
90
  ref: drop
170
- }, board?.map((workflow, index) => {
91
+ }, board === null || board === void 0 ? void 0 : board.map(function (workflow, index) {
171
92
  return /*#__PURE__*/_react.default.createElement("div", {
172
93
  key: index
173
94
  }, workflow.name === "If Else Box" ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
@@ -227,29 +148,35 @@ const DragDrop = () => {
227
148
  }));
228
149
  };
229
150
  exports.DragDrop = DragDrop;
230
- const AddNewBox = () => {
231
- const [inputBoxes, setInputBoxes] = (0, _react.useState)([]);
232
- let [type, setType] = (0, _react.useState)(null);
233
- const addInputBox = () => {
234
- setInputBoxes([...inputBoxes, {
151
+ var AddNewBox = function AddNewBox() {
152
+ var _useState3 = (0, _react.useState)([]),
153
+ _useState4 = _slicedToArray(_useState3, 2),
154
+ inputBoxes = _useState4[0],
155
+ setInputBoxes = _useState4[1];
156
+ var _useState5 = (0, _react.useState)(null),
157
+ _useState6 = _slicedToArray(_useState5, 2),
158
+ type = _useState6[0],
159
+ setType = _useState6[1];
160
+ var addInputBox = function addInputBox() {
161
+ setInputBoxes([].concat(_toConsumableArray(inputBoxes), [{
235
162
  label: "Text",
236
163
  value: ""
237
- }]);
164
+ }]));
238
165
  setType("input");
239
166
  };
240
- const handleInputChange = (index, event) => {
241
- const values = [...inputBoxes];
167
+ var handleInputChange = function handleInputChange(index, event) {
168
+ var values = _toConsumableArray(inputBoxes);
242
169
  values[index] = event.target.value;
243
170
  setInputBoxes(values);
244
171
  };
245
- const addIfElseInputBox = () => {
246
- setInputBoxes([...inputBoxes, {
172
+ var addIfElseInputBox = function addIfElseInputBox() {
173
+ setInputBoxes([].concat(_toConsumableArray(inputBoxes), [{
247
174
  label: "If",
248
175
  value: ""
249
176
  }, {
250
177
  label: "Else",
251
178
  value: ""
252
- }]);
179
+ }]));
253
180
  setType("if_else");
254
181
  };
255
182
 
@@ -291,35 +218,37 @@ const AddNewBox = () => {
291
218
  },
292
219
  onClick: addIfElseInputBox,
293
220
  title: "Add If Else Box"
294
- }, /*#__PURE__*/_react.default.createElement(_text.default, null, "+"))), inputBoxes.map((box, index) => /*#__PURE__*/_react.default.createElement(_material.Grid, {
295
- item: true,
296
- container: true
297
- }, /*#__PURE__*/_react.default.createElement(_material.Grid, {
298
- item: true,
299
- xs: true
300
- }, /*#__PURE__*/_react.default.createElement("div", {
301
- style: {
302
- border: "1px solid black",
303
- padding: "10px",
304
- display: "inline-block",
305
- margin: "0.5rem"
306
- }
307
- }, /*#__PURE__*/_react.default.createElement("div", {
308
- key: index,
309
- style: {
310
- marginTop: "1rem"
311
- }
312
- }, /*#__PURE__*/_react.default.createElement("label", {
313
- htmlFor: `${type}-${index}`
314
- }, /*#__PURE__*/_react.default.createElement(_text.default, null, box.label)), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("input", {
315
- id: `${type}-${index}`,
316
- type: "text",
317
- value: box.value,
318
- onChange: e => {
319
- const updatedBoxes = [...inputBoxes];
320
- updatedBoxes[index].value = e.target.value;
321
- setInputBoxes(updatedBoxes);
322
- }
323
- })))))));
221
+ }, /*#__PURE__*/_react.default.createElement(_text.default, null, "+"))), inputBoxes.map(function (box, index) {
222
+ return /*#__PURE__*/_react.default.createElement(_material.Grid, {
223
+ item: true,
224
+ container: true
225
+ }, /*#__PURE__*/_react.default.createElement(_material.Grid, {
226
+ item: true,
227
+ xs: true
228
+ }, /*#__PURE__*/_react.default.createElement("div", {
229
+ style: {
230
+ border: "1px solid black",
231
+ padding: "10px",
232
+ display: "inline-block",
233
+ margin: "0.5rem"
234
+ }
235
+ }, /*#__PURE__*/_react.default.createElement("div", {
236
+ key: index,
237
+ style: {
238
+ marginTop: "1rem"
239
+ }
240
+ }, /*#__PURE__*/_react.default.createElement("label", {
241
+ htmlFor: "".concat(type, "-").concat(index)
242
+ }, /*#__PURE__*/_react.default.createElement(_text.default, null, box.label)), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("input", {
243
+ id: "".concat(type, "-").concat(index),
244
+ type: "text",
245
+ value: box.value,
246
+ onChange: function onChange(e) {
247
+ var updatedBoxes = _toConsumableArray(inputBoxes);
248
+ updatedBoxes[index].value = e.target.value;
249
+ setInputBoxes(updatedBoxes);
250
+ }
251
+ })))));
252
+ }));
324
253
  };
325
254
  exports.AddNewBox = AddNewBox;
@@ -7,29 +7,39 @@ exports.DragBox = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _reactDnd = require("react-dnd");
9
9
  var _text = _interopRequireDefault(require("../text"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const DragBox = exports.DragBox = function DragBox(_ref) {
12
- let {
13
- name
14
- } = _ref;
15
- const [{
16
- isDragging
17
- }, drag] = (0, _reactDnd.useDrag)(() => ({
18
- type: "box",
19
- item: {
20
- name
21
- },
22
- collect: monitor => ({
23
- isDragging: monitor.isDragging(),
24
- handlerId: monitor.getHandlerId()
25
- })
26
- }));
27
- const opacity = isDragging ? 0.4 : 1;
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ var DragBox = function DragBox(_ref) {
18
+ var name = _ref.name;
19
+ var _useDrag = (0, _reactDnd.useDrag)(function () {
20
+ return {
21
+ type: "box",
22
+ item: {
23
+ name: name
24
+ },
25
+ collect: function collect(monitor) {
26
+ return {
27
+ isDragging: monitor.isDragging(),
28
+ handlerId: monitor.getHandlerId()
29
+ };
30
+ }
31
+ };
32
+ }),
33
+ _useDrag2 = _slicedToArray(_useDrag, 2),
34
+ isDragging = _useDrag2[0].isDragging,
35
+ drag = _useDrag2[1];
36
+ var opacity = isDragging ? 0.4 : 1;
28
37
  return /*#__PURE__*/_react.default.createElement("div", {
29
38
  ref: drag,
30
39
  style: {
31
- opacity
40
+ opacity: opacity
32
41
  },
33
- "data-testid": `box`
42
+ "data-testid": "box"
34
43
  }, /*#__PURE__*/_react.default.createElement(_text.default, null, name));
35
- };
44
+ };
45
+ exports.DragBox = DragBox;