@zgfe/business-lib 1.1.28 → 1.1.29-alpha.0

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 (131) hide show
  1. package/es/addToPanel/components/addPanel.js +21 -8
  2. package/es/addToPanel/components/radioGroup.js +3 -1
  3. package/es/addToPanel/components/styleList.js +22 -5
  4. package/es/addToPanel/demo/edit.js +12 -5
  5. package/es/addToPanel/demo/index.js +12 -5
  6. package/es/addToPanel/index.js +58 -21
  7. package/es/addToScene/addGroup.js +4 -0
  8. package/es/addToScene/demo/index.js +12 -5
  9. package/es/addToScene/index.js +40 -13
  10. package/es/assets/demo/index.js +2 -0
  11. package/es/assets/demo/input.js +12 -5
  12. package/es/assets/iconfont/iconfont.js +17 -10
  13. package/es/assets/theme.js +1 -0
  14. package/es/attrConditions/components/operateList.js +27 -10
  15. package/es/attrConditions/components/stringList.js +97 -68
  16. package/es/attrConditions/components/valuesList.js +40 -14
  17. package/es/attrConditions/demo/group.js +23 -11
  18. package/es/attrConditions/demo/index.js +26 -17
  19. package/es/attrConditions/group.js +48 -17
  20. package/es/attrConditions/index.js +49 -22
  21. package/es/attrConditions/types.js +1 -0
  22. package/es/attributeSelector/demo/disable.js +16 -8
  23. package/es/attributeSelector/demo/index.js +17 -8
  24. package/es/attributeSelector/index.js +45 -22
  25. package/es/attributeSelector/listPanel.js +46 -18
  26. package/es/attributeSelector/option.js +13 -3
  27. package/es/attributeSelector/types.d.ts +1 -0
  28. package/es/attributeSelector/types.js +5 -0
  29. package/es/attributeSelector/util.js +3 -0
  30. package/es/chart/demo/index.js +14 -5
  31. package/es/chart/index.js +44 -30
  32. package/es/chart/util/chartOptionConfig.d.ts +3 -3
  33. package/es/chart/util/chartOptionConfig.js +37 -13
  34. package/es/chart/util/data/china.js +4 -1
  35. package/es/chart/util/formatData.d.ts +2 -2
  36. package/es/chart/util/formatData.js +5 -0
  37. package/es/chart/util/formatOption.js +13 -0
  38. package/es/chart/util/mapUtil.js +26 -5
  39. package/es/config.js +2 -0
  40. package/es/constants/common.d.ts +10 -0
  41. package/es/constants/common.js +30 -0
  42. package/es/cycleTime/demo/disable.js +1 -0
  43. package/es/cycleTime/index.js +46 -19
  44. package/es/cycleTime/month.js +27 -8
  45. package/es/datePicker/datePicker.js +23 -5
  46. package/es/datePicker/demo/customType.js +22 -13
  47. package/es/datePicker/demo/day.js +22 -13
  48. package/es/datePicker/demo/index.js +21 -12
  49. package/es/datePicker/index.js +41 -18
  50. package/es/datePicker/utils.js +7 -0
  51. package/es/demoWrapper/content.js +56 -31
  52. package/es/demoWrapper/head.js +23 -9
  53. package/es/demoWrapper/index.js +30 -14
  54. package/es/dialog/demo/index.js +12 -5
  55. package/es/dialog/index.js +6 -4
  56. package/es/dnd/demo/data.js +28 -19
  57. package/es/dnd/demo/handle.js +28 -19
  58. package/es/dnd/index.js +45 -21
  59. package/es/dnd/item.js +30 -10
  60. package/es/eventSelector/demo/index.js +24 -12
  61. package/es/eventSelector/index.js +47 -16
  62. package/es/eventSelector/listPanel.js +64 -29
  63. package/es/eventSelector/option.js +11 -6
  64. package/es/eventSelector/types.d.ts +2 -0
  65. package/es/icon/iconFont.js +13 -7
  66. package/es/layout/analysisLayout/demo/index.js +6 -0
  67. package/es/layout/analysisLayout/index.d.ts +1 -1
  68. package/es/layout/analysisLayout/index.js +34 -16
  69. package/es/layout/detail/index.js +3 -1
  70. package/es/loginForm/index.js +18 -7
  71. package/es/searchInput/index.js +7 -2
  72. package/es/select/demo/children.js +16 -8
  73. package/es/select/demo/customLabel.js +2 -0
  74. package/es/select/demo/group.js +17 -8
  75. package/es/select/demo/index.js +19 -11
  76. package/es/select/demo/loading.js +18 -8
  77. package/es/select/demo/multiple.js +16 -8
  78. package/es/select/handle.js +34 -14
  79. package/es/select/index.js +59 -22
  80. package/es/select/option.js +30 -10
  81. package/es/select/overlay.js +62 -25
  82. package/es/table/demo/data/table.js +2 -0
  83. package/es/table/demo/index.js +39 -13
  84. package/es/table/demo/index2.js +15 -5
  85. package/es/table/demo/index3.js +28 -7
  86. package/es/table/index.js +33 -14
  87. package/es/targetConditionGroup/components/targetDimension.js +38 -12
  88. package/es/targetConditionGroup/demo/group.js +36 -21
  89. package/es/targetConditionGroup/demo/index.js +15 -6
  90. package/es/targetConditionGroup/index.js +97 -43
  91. package/es/targetConditionGroup/types.d.ts +1 -0
  92. package/es/targetSelector/demo/index.js +28 -15
  93. package/es/targetSelector/editBox.js +20 -5
  94. package/es/targetSelector/index.js +36 -15
  95. package/es/targetSelector/optionIcon.js +5 -1
  96. package/es/targetSelector/optionMenu.js +3 -0
  97. package/es/userCondition/conditionTypeList.js +12 -7
  98. package/es/userCondition/conditionWrap.js +2 -0
  99. package/es/userCondition/conditions/cdpCondition.js +97 -51
  100. package/es/userCondition/conditions/eventCondition.js +16 -6
  101. package/es/userCondition/conditions/periodCondition.js +26 -8
  102. package/es/userCondition/conditions/propCondition.js +61 -29
  103. package/es/userCondition/conditions/runTimesCondition.js +10 -5
  104. package/es/userCondition/conditions/tagsCondition.d.ts +1 -1
  105. package/es/userCondition/conditions/tagsCondition.js +33 -15
  106. package/es/userCondition/conditions/textDesc.js +67 -16
  107. package/es/userCondition/demo/index.js +21 -11
  108. package/es/userCondition/index.js +91 -51
  109. package/es/userCondition/orConditions.js +48 -11
  110. package/es/userCondition/relationLabel.js +4 -1
  111. package/es/userCondition/types.d.ts +1 -1
  112. package/es/userCondition/types.js +1 -0
  113. package/es/userCondition/util.js +13 -4
  114. package/es/userGroup/demo/group.js +23 -14
  115. package/es/userGroup/demo/index.js +15 -5
  116. package/es/userGroup/index.js +30 -12
  117. package/es/userTagsSelector/cascaderOverlay.js +51 -19
  118. package/es/userTagsSelector/components/search/index.js +2 -0
  119. package/es/userTagsSelector/demo/index.js +3 -0
  120. package/es/userTagsSelector/groups/groupOption.js +8 -6
  121. package/es/userTagsSelector/groups/index.js +30 -15
  122. package/es/userTagsSelector/index.js +35 -17
  123. package/es/userTagsSelector/multipleCheckPanel/checkOption.js +6 -3
  124. package/es/userTagsSelector/multipleCheckPanel/index.js +21 -8
  125. package/es/userTagsSelector/util.js +2 -0
  126. package/es/utils/ajax.js +71 -45
  127. package/es/utils/base64.js +22 -3
  128. package/es/utils/type.d.ts +1 -1
  129. package/es/utils/type.js +7 -4
  130. package/es/utils/util.js +16 -0
  131. package/package.json +2 -2
@@ -1,9 +1,15 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import { Card, Spin } from 'antd';
8
14
  import React, { useEffect, useState } from 'react';
9
15
  import BizLoginForm from '../loginForm';
@@ -11,26 +17,32 @@ import request from '../utils/ajax';
11
17
  import DemoContent from './content';
12
18
  import DemoHeader from './head';
13
19
  import './index.less';
20
+
14
21
  var DemoWrapper = function DemoWrapper(_ref) {
15
22
  var children = _ref.children,
16
- className = _ref.className,
17
- defaultApp = _ref.defaultApp,
18
- needMeta = _ref.needMeta;
23
+ className = _ref.className,
24
+ defaultApp = _ref.defaultApp,
25
+ needMeta = _ref.needMeta;
26
+
19
27
  var _useState = useState(true),
20
- _useState2 = _slicedToArray(_useState, 2),
21
- loading = _useState2[0],
22
- setLoading = _useState2[1];
28
+ _useState2 = _slicedToArray(_useState, 2),
29
+ loading = _useState2[0],
30
+ setLoading = _useState2[1];
31
+
23
32
  var _useState3 = useState(false),
24
- _useState4 = _slicedToArray(_useState3, 2),
25
- notLogin = _useState4[0],
26
- setNotLogin = _useState4[1];
33
+ _useState4 = _slicedToArray(_useState3, 2),
34
+ notLogin = _useState4[0],
35
+ setNotLogin = _useState4[1];
36
+
27
37
  var _useState5 = useState(defaultApp),
28
- _useState6 = _slicedToArray(_useState5, 2),
29
- appId = _useState6[0],
30
- setAppId = _useState6[1];
38
+ _useState6 = _slicedToArray(_useState5, 2),
39
+ appId = _useState6[0],
40
+ setAppId = _useState6[1];
41
+
31
42
  useEffect(function () {
32
43
  getCurrentUser();
33
44
  }, []);
45
+
34
46
  function getCurrentUser() {
35
47
  request('/analysis/api/common/proxy/user/getUserInfo.jsp').then(function (res) {
36
48
  if (res.status === 503 || res.ret === '-1') setNotLogin(true);
@@ -40,9 +52,11 @@ var DemoWrapper = function DemoWrapper(_ref) {
40
52
  setLoading(false);
41
53
  });
42
54
  }
55
+
43
56
  if (loading) {
44
57
  return /*#__PURE__*/React.createElement(Spin, null);
45
58
  }
59
+
46
60
  if (notLogin) {
47
61
  return /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(BizLoginForm, {
48
62
  onSuccess: function onSuccess() {
@@ -50,6 +64,7 @@ var DemoWrapper = function DemoWrapper(_ref) {
50
64
  }
51
65
  }));
52
66
  }
67
+
53
68
  return /*#__PURE__*/React.createElement(Card, {
54
69
  title: /*#__PURE__*/React.createElement(DemoHeader, {
55
70
  defaultApp: defaultApp,
@@ -64,4 +79,5 @@ var DemoWrapper = function DemoWrapper(_ref) {
64
79
  needMeta: needMeta
65
80
  }, children));
66
81
  };
82
+
67
83
  export default DemoWrapper;
@@ -1,17 +1,24 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useState } from 'react';
8
14
  import { BizDialog } from '@zgfe/business-lib';
9
15
  import { Button } from 'antd';
10
16
  export default (function () {
11
17
  var _useState = useState(false),
12
- _useState2 = _slicedToArray(_useState, 2),
13
- visible = _useState2[0],
14
- setVisible = _useState2[1];
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ visible = _useState2[0],
20
+ setVisible = _useState2[1];
21
+
15
22
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
16
23
  type: "primary",
17
24
  onClick: function onClick() {
@@ -1,14 +1,15 @@
1
- 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); }
2
1
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
+
5
+ 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; }
6
+
7
7
  import { Modal } from 'antd';
8
8
  import React from 'react';
9
9
  import './styles/index.less';
10
10
  import { IconFont } from '..';
11
11
  export var classPrefix = 'biz-dialog';
12
+
12
13
  var BizDialog = function BizDialog(props) {
13
14
  return /*#__PURE__*/React.createElement(Modal, _objectSpread(_objectSpread({
14
15
  bodyStyle: {
@@ -21,6 +22,7 @@ var BizDialog = function BizDialog(props) {
21
22
  })
22
23
  }), props.children);
23
24
  };
25
+
24
26
  BizDialog.defaultProps = {
25
27
  width: 520,
26
28
  visible: false,
@@ -1,32 +1,39 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useState } from 'react';
8
14
  import { BizDnd } from '@zgfe/business-lib';
9
15
  import styles from './styles/index.less';
10
16
  import _ from 'lodash';
11
17
  export default (function () {
12
18
  var _useState = useState([{
13
- id: 0,
14
- label: 'a'
15
- }, {
16
- id: 1,
17
- label: 'b'
18
- }, {
19
- id: 2,
20
- label: 'c'
21
- }, {
22
- id: 3,
23
- label: '添加',
24
- disabled: true,
25
- isAdd: true
26
- }]),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- list = _useState2[0],
29
- setList = _useState2[1];
19
+ id: 0,
20
+ label: 'a'
21
+ }, {
22
+ id: 1,
23
+ label: 'b'
24
+ }, {
25
+ id: 2,
26
+ label: 'c'
27
+ }, {
28
+ id: 3,
29
+ label: '添加',
30
+ disabled: true,
31
+ isAdd: true
32
+ }]),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ list = _useState2[0],
35
+ setList = _useState2[1];
36
+
30
37
  function onAdd() {
31
38
  setList(function (list) {
32
39
  var res = [];
@@ -37,11 +44,13 @@ export default (function () {
37
44
  label: String.fromCharCode(97 + i)
38
45
  });
39
46
  }
47
+
40
48
  res.push(_.cloneDeep(item));
41
49
  });
42
50
  return res;
43
51
  });
44
52
  }
53
+
45
54
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizDnd, {
46
55
  className: styles.container,
47
56
  store: list,
@@ -1,32 +1,39 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useState } from 'react';
8
14
  import { BizDnd } from '@zgfe/business-lib';
9
15
  import styles from './styles/index.less';
10
16
  import _ from 'lodash';
11
17
  export default (function () {
12
18
  var _useState = useState([{
13
- id: 0,
14
- label: 'a'
15
- }, {
16
- id: 1,
17
- label: 'b'
18
- }, {
19
- id: 2,
20
- label: 'c'
21
- }, {
22
- id: 3,
23
- label: '添加',
24
- disabled: true,
25
- isAdd: true
26
- }]),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- list = _useState2[0],
29
- setList = _useState2[1];
19
+ id: 0,
20
+ label: 'a'
21
+ }, {
22
+ id: 1,
23
+ label: 'b'
24
+ }, {
25
+ id: 2,
26
+ label: 'c'
27
+ }, {
28
+ id: 3,
29
+ label: '添加',
30
+ disabled: true,
31
+ isAdd: true
32
+ }]),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ list = _useState2[0],
35
+ setList = _useState2[1];
36
+
30
37
  function onAdd() {
31
38
  setList(function (list) {
32
39
  var res = [];
@@ -37,11 +44,13 @@ export default (function () {
37
44
  label: String.fromCharCode(97 + i)
38
45
  });
39
46
  }
47
+
40
48
  res.push(_.cloneDeep(item));
41
49
  });
42
50
  return res;
43
51
  });
44
52
  }
53
+
45
54
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizDnd, {
46
55
  className: styles.container,
47
56
  store: list,
package/es/dnd/index.js CHANGED
@@ -1,58 +1,75 @@
1
- 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); }
2
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
+ 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; }
2
+
5
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
6
5
  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."); }
6
+
7
7
  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); }
8
- 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; }
9
- 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; } }
8
+
9
+ 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; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
10
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
11
15
  import React, { useEffect, useState } from 'react';
12
16
  import BizDndItem from './item';
13
17
  import _ from 'lodash';
14
18
  import './styles/index.less';
15
19
  export var classPrefix = 'biz-dnd';
20
+
16
21
  var BizDnd = function BizDnd(props) {
17
22
  var store = props.store,
18
- keyField = props.keyField,
19
- className = props.className,
20
- itemClassName = props.itemClassName,
21
- tempClassName = props.tempClassName,
22
- draddingClassName = props.draddingClassName,
23
- handle = props.handle,
24
- handleClassName = props.handleClassName;
23
+ keyField = props.keyField,
24
+ className = props.className,
25
+ itemClassName = props.itemClassName,
26
+ tempClassName = props.tempClassName,
27
+ draddingClassName = props.draddingClassName,
28
+ handle = props.handle,
29
+ handleClassName = props.handleClassName;
30
+
25
31
  var _useState = useState(),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- current = _useState2[0],
28
- setCurrent = _useState2[1];
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ current = _useState2[0],
34
+ setCurrent = _useState2[1];
35
+
29
36
  var _useState3 = useState(),
30
- _useState4 = _slicedToArray(_useState3, 2),
31
- setHoverTarget = _useState4[1];
37
+ _useState4 = _slicedToArray(_useState3, 2),
38
+ setHoverTarget = _useState4[1];
39
+
32
40
  var _useState5 = useState(store),
33
- _useState6 = _slicedToArray(_useState5, 2),
34
- renderData = _useState6[0],
35
- setRenderData = _useState6[1];
41
+ _useState6 = _slicedToArray(_useState5, 2),
42
+ renderData = _useState6[0],
43
+ setRenderData = _useState6[1];
44
+
36
45
  useEffect(function () {
37
46
  setRenderData(_.cloneDeep(store));
38
47
  }, [store]);
48
+
39
49
  function onMouseOver(data) {
40
50
  setHoverTarget(data);
41
51
  setHoverTarget(data);
42
52
  setRenderData(function (list) {
43
53
  var res = [];
54
+
44
55
  for (var i = 0; i < list.length; i++) {
45
56
  var item = _.cloneDeep(list[i]);
57
+
46
58
  if (item.isTemp) continue;
59
+
47
60
  if (current && item[keyField] === data[keyField]) {
48
61
  var _res$push;
62
+
49
63
  res.push((_res$push = {}, _defineProperty(_res$push, props.keyField, "".concat(item[props.keyField], "-temp")), _defineProperty(_res$push, "isTemp", true), _res$push));
50
64
  }
65
+
51
66
  res.push(item);
52
67
  }
68
+
53
69
  return res;
54
70
  });
55
71
  }
72
+
56
73
  function onDropEnd(data) {
57
74
  setHoverTarget(function (target) {
58
75
  setCurrent(undefined);
@@ -61,14 +78,19 @@ var BizDnd = function BizDnd(props) {
61
78
  if (!list.find(function (item) {
62
79
  return item.isTemp;
63
80
  })) return list;
81
+
64
82
  for (var i = 0; i < list.length; i++) {
65
83
  var item = _.cloneDeep(list[i]);
84
+
66
85
  if (item[keyField] === data[keyField] || item.isTemp) continue;
86
+
67
87
  if (item[keyField] === target[keyField]) {
68
88
  res.push(data);
69
89
  }
90
+
70
91
  res.push(item);
71
92
  }
93
+
72
94
  setTimeout(function () {
73
95
  if (props.onChange) props.onChange(res);
74
96
  });
@@ -77,6 +99,7 @@ var BizDnd = function BizDnd(props) {
77
99
  return target;
78
100
  });
79
101
  }
102
+
80
103
  return /*#__PURE__*/React.createElement("div", {
81
104
  className: "".concat(classPrefix, "-container ").concat(className)
82
105
  }, renderData.map(function (data, i) {
@@ -95,6 +118,7 @@ var BizDnd = function BizDnd(props) {
95
118
  });
96
119
  }));
97
120
  };
121
+
98
122
  BizDnd.defaultProps = {
99
123
  keyField: 'key'
100
124
  };
package/es/dnd/item.js CHANGED
@@ -1,9 +1,15 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useRef, useState } from 'react';
8
14
  import { classPrefix } from '.';
9
15
  var preMouse = {
@@ -16,22 +22,28 @@ var style = {
16
22
  left: 0,
17
23
  pointerEvents: 'inherit'
18
24
  };
25
+
19
26
  var BizDndItem = function BizDndItem(props) {
20
27
  var className = props.className,
21
- render = props.render,
22
- data = props.data,
23
- draddingClassName = props.draddingClassName;
28
+ render = props.render,
29
+ data = props.data,
30
+ draddingClassName = props.draddingClassName;
31
+
24
32
  var _useState = useState(false),
25
- _useState2 = _slicedToArray(_useState, 2),
26
- isDragging = _useState2[0],
27
- setIsDragging = _useState2[1];
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ isDragging = _useState2[0],
35
+ setIsDragging = _useState2[1];
36
+
28
37
  var ref = useRef();
38
+
29
39
  function onMousedown(e) {
30
40
  var _e$currentTarget$getB = e.currentTarget.getBoundingClientRect(),
31
- top = _e$currentTarget$getB.top,
32
- left = _e$currentTarget$getB.left;
41
+ top = _e$currentTarget$getB.top,
42
+ left = _e$currentTarget$getB.left;
43
+
33
44
  window.addEventListener('mousemove', onMouseMove);
34
45
  window.addEventListener('mouseup', onMouseUp);
46
+
35
47
  if (ref.current) {
36
48
  var computedStyle = window.getComputedStyle(ref.current);
37
49
  style = {
@@ -50,6 +62,7 @@ var BizDndItem = function BizDndItem(props) {
50
62
  setIsDragging(true);
51
63
  }
52
64
  }
65
+
53
66
  function onMouseMove(e) {
54
67
  var computedStyle = window.getComputedStyle(ref.current);
55
68
  style.position = 'fixed';
@@ -65,6 +78,7 @@ var BizDndItem = function BizDndItem(props) {
65
78
  };
66
79
  if (props.onDragging) props.onDragging(data);
67
80
  }
81
+
68
82
  function onMouseUp() {
69
83
  setIsDragging(false);
70
84
  window.removeEventListener('mousemove', onMouseMove);
@@ -80,6 +94,7 @@ var BizDndItem = function BizDndItem(props) {
80
94
  setStyle();
81
95
  if (props.onDropEnd) props.onDropEnd(data);
82
96
  }
97
+
83
98
  function setStyle() {
84
99
  if (ref.current) {
85
100
  ref.current.style.position = style.position;
@@ -89,10 +104,12 @@ var BizDndItem = function BizDndItem(props) {
89
104
  ref.current.style.width = style.width;
90
105
  }
91
106
  }
107
+
92
108
  if (props.data.isTemp) return /*#__PURE__*/React.createElement("div", {
93
109
  className: "".concat(classPrefix, "-item ").concat(className),
94
110
  ref: ref
95
111
  });
112
+
96
113
  if (props.data.disabled) {
97
114
  return /*#__PURE__*/React.createElement("div", {
98
115
  className: "".concat(classPrefix, "-item disable ").concat(className),
@@ -102,6 +119,7 @@ var BizDndItem = function BizDndItem(props) {
102
119
  }
103
120
  }, render(data, props.index));
104
121
  }
122
+
105
123
  if (props.handle) {
106
124
  var handle = /*#__PURE__*/React.createElement("span", {
107
125
  className: "".concat(classPrefix, "-handle ").concat(props.handleClassName),
@@ -115,6 +133,7 @@ var BizDndItem = function BizDndItem(props) {
115
133
  ref: ref
116
134
  }, render(data, props.index, handle));
117
135
  }
136
+
118
137
  return /*#__PURE__*/React.createElement("div", {
119
138
  className: "".concat(classPrefix, "-item ").concat(className, " ").concat(isDragging ? draddingClassName : ''),
120
139
  onMouseDown: onMousedown,
@@ -124,4 +143,5 @@ var BizDndItem = function BizDndItem(props) {
124
143
  ref: ref
125
144
  }, render(data, props.index));
126
145
  };
146
+
127
147
  export default BizDndItem;
@@ -1,30 +1,40 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
2
3
  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."); }
4
+
3
5
  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); }
4
- 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; }
5
- 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; } }
6
+
7
+ 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; }
8
+
9
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
+
6
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
7
13
  import React, { useState } from 'react';
8
14
  import { BizEventSelector, convertAttributeData, BizGlobalDataContext } from '@zgfe/business-lib';
9
15
  import eventData from '../../mock/event';
16
+
10
17
  var EventDemo = function EventDemo() {
11
18
  var store = convertAttributeData({
12
19
  eventList: eventData
13
20
  });
21
+
14
22
  var _useState = useState({
15
- group: {
16
- id: 4201
17
- },
18
- event: {
19
- id: 24143017
20
- }
21
- }),
22
- _useState2 = _slicedToArray(_useState, 2),
23
- value = _useState2[0],
24
- setValue = _useState2[1];
23
+ group: {
24
+ id: 4201
25
+ },
26
+ event: {
27
+ id: 24143017
28
+ }
29
+ }),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ value = _useState2[0],
32
+ setValue = _useState2[1];
33
+
25
34
  var onChange = function onChange(data) {
26
35
  setValue(data);
27
36
  };
37
+
28
38
  return /*#__PURE__*/React.createElement("div", {
29
39
  style: {
30
40
  height: '500px',
@@ -39,11 +49,13 @@ var EventDemo = function EventDemo() {
39
49
  eventGroupList: store.eventGroupList
40
50
  }
41
51
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
52
+ showBuiltInTarget: true,
42
53
  defaultValue: value,
43
54
  alias: "\u522B\u540D",
44
55
  onChange: onChange
45
56
  })), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u9009\u62E9\u7684\u4E8B\u4EF6\u662F\uFF1A", JSON.stringify(value))));
46
57
  };
58
+
47
59
  export default (function () {
48
60
  return /*#__PURE__*/React.createElement(EventDemo, null);
49
61
  });