@cloud-app-dev/vidc 2.0.0-alpha.11 → 2.0.0-alpha.12

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 (155) hide show
  1. package/.umirc.ts +1 -1
  2. package/es/AppRedirect/index.js +7 -11
  3. package/es/AppRoute/index.d.ts +2 -6
  4. package/es/AppRoute/index.js +46 -37
  5. package/es/AppRoute/interface.d.ts +1 -11
  6. package/es/AutoExit/index.js +7 -7
  7. package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
  8. package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
  9. package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
  10. package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
  11. package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
  12. package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
  13. package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
  14. package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
  15. package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
  16. package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
  17. package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
  18. package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
  19. package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
  20. package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
  21. package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
  22. package/es/{ContentBox → Box}/index.css +0 -0
  23. package/es/{ContentBox → Box}/index.d.ts +3 -3
  24. package/es/{ContentBox → Box}/index.js +5 -5
  25. package/es/CheckGroupFixed/index.js +4 -2
  26. package/es/Config/interface.d.ts +3 -1
  27. package/es/DeviceSelect/TreeType.d.ts +6 -0
  28. package/es/DeviceSelect/TreeType.js +36 -0
  29. package/es/DeviceSelect/demo.js +2 -2
  30. package/es/DeviceSelect/index.css +6 -1
  31. package/es/DeviceSelect/index.d.ts +5 -0
  32. package/es/DeviceSelect/index.js +22 -54
  33. package/es/IconFont/index.d.ts +0 -1
  34. package/es/IconFont/index.js +12 -13
  35. package/es/InitialRequest/utils.js +8 -9
  36. package/es/Input/index.js +3 -2
  37. package/es/List/CheckExt.d.ts +3 -5
  38. package/es/List/CheckExt.js +21 -13
  39. package/es/{AppRoute → List/DeviceList}/index.css +0 -0
  40. package/es/List/DeviceList/index.d.ts +11 -0
  41. package/es/{DeviceList → List/DeviceList}/index.js +6 -18
  42. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  43. package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
  44. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  45. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  46. package/es/List/DynamicDeviceList/index.js +205 -0
  47. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  48. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  49. package/es/List/DynamicDeviceList/utils.js +61 -0
  50. package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
  51. package/es/List/DynamicGridList/Demo.js +70 -0
  52. package/es/List/DynamicGridList/index.d.ts +26 -0
  53. package/es/List/DynamicGridList/index.js +73 -0
  54. package/es/List/GridList/Demo.d.ts +2 -0
  55. package/es/List/GridList/Demo.js +91 -0
  56. package/es/List/GridList/hook.d.ts +13 -0
  57. package/es/List/GridList/hook.js +301 -0
  58. package/es/List/GridList/index.css +7 -0
  59. package/es/List/GridList/index.d.ts +15 -0
  60. package/es/List/GridList/index.js +47 -0
  61. package/es/List/GridList/interface.d.ts +59 -0
  62. package/es/List/GridList/utils.d.ts +9 -0
  63. package/es/List/GridList/utils.js +43 -0
  64. package/es/List/ListExt/index.css +3 -0
  65. package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
  66. package/es/{ListExt → List/ListExt}/index.js +3 -3
  67. package/es/List/VList/index.css +6 -0
  68. package/es/List/VList/index.d.ts +18 -0
  69. package/es/List/VList/index.js +51 -0
  70. package/es/List/VList/utils.d.ts +14 -0
  71. package/es/{VList → List/VList}/utils.js +0 -0
  72. package/es/List/index.css +11 -12
  73. package/es/List/index.d.ts +5 -70
  74. package/es/List/index.js +32 -25
  75. package/es/List/interface.d.ts +87 -0
  76. package/es/List/renderItem.d.ts +1 -1
  77. package/es/List/renderItem.js +13 -10
  78. package/es/LoaderApp/index.js +4 -1
  79. package/es/LoaderScript/utils.js +60 -37
  80. package/es/Service/http.d.ts +1 -1
  81. package/es/Service/http.js +2 -8
  82. package/es/TableLayout/index.d.ts +3 -0
  83. package/es/TableLayout/index.js +14 -45
  84. package/es/{TreeTitle → Title}/index.css +5 -5
  85. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  86. package/es/{TreeTitle → Title}/index.js +7 -4
  87. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  88. package/es/Tree/BaseTree/demo.js +69 -0
  89. package/es/Tree/BaseTree/index.css +64 -0
  90. package/es/Tree/BaseTree/index.d.ts +24 -0
  91. package/es/Tree/BaseTree/index.js +83 -0
  92. package/es/Tree/demo.js +19 -56
  93. package/es/Tree/index.css +29 -55
  94. package/es/Tree/index.d.ts +19 -20
  95. package/es/Tree/index.js +185 -70
  96. package/es/UserSelect/index.js +6 -4
  97. package/es/WorkerFlow/Form/Condition.js +2 -4
  98. package/es/WorkerFlow/Form/FormAuth.js +2 -2
  99. package/es/WorkerFlow/Form/GroupList.js +2 -2
  100. package/es/WorkerFlow/Form/GroupSelectModalContent.js +1 -1
  101. package/es/WorkerFlow/Form/UserSelectModalContent.js +2 -2
  102. package/es/WorkerFlow/Form/UserSet.js +2 -2
  103. package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
  104. package/es/WorkerFlow/index.css +9 -3
  105. package/es/WorkerFlow/index.js +3 -2
  106. package/es/index.d.ts +3 -11
  107. package/es/index.js +3 -11
  108. package/es/useDrawer/index.d.ts +1 -1
  109. package/es/useDrawer/index.js +2 -1
  110. package/es/useModal/index.d.ts +1 -1
  111. package/es/useModal/index.js +2 -1
  112. package/es/{IconFont → useNavigate}/index.css +0 -0
  113. package/es/useNavigate/index.d.ts +4 -0
  114. package/es/useNavigate/index.js +14 -0
  115. package/es/utils.d.ts +9 -0
  116. package/es/utils.js +36 -1
  117. package/package.json +4 -8
  118. package/es/AppRoute/Render.d.ts +0 -23
  119. package/es/AppRoute/Render.js +0 -111
  120. package/es/AppRoute/Rendered.d.ts +0 -4
  121. package/es/AppRoute/Rendered.js +0 -11
  122. package/es/AppRoute/utils.d.ts +0 -1
  123. package/es/AppRoute/utils.js +0 -28
  124. package/es/DeviceList/index.css +0 -32
  125. package/es/DeviceList/index.d.ts +0 -14
  126. package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
  127. package/es/DynamicDeviceList/CheckExt.js +0 -36
  128. package/es/DynamicDeviceList/Demo.js +0 -17
  129. package/es/DynamicDeviceList/index.d.ts +0 -35
  130. package/es/DynamicDeviceList/index.js +0 -224
  131. package/es/DynamicDeviceList/utils.d.ts +0 -2
  132. package/es/DynamicDeviceList/utils.js +0 -15
  133. package/es/DynamicList/index.css +0 -7
  134. package/es/DynamicList/index.d.ts +0 -31
  135. package/es/DynamicList/index.js +0 -132
  136. package/es/List/utils.d.ts +0 -5
  137. package/es/List/utils.js +0 -18
  138. package/es/ListExt/index.css +0 -9
  139. package/es/ScrollList/index.css +0 -73
  140. package/es/ScrollList/index.d.ts +0 -24
  141. package/es/ScrollList/index.js +0 -262
  142. package/es/ScrollList/utils.js +0 -84
  143. package/es/TreeMode/demo.js +0 -32
  144. package/es/TreeMode/index.css +0 -38
  145. package/es/TreeMode/index.d.ts +0 -23
  146. package/es/TreeMode/index.js +0 -201
  147. package/es/VList/index.css +0 -4
  148. package/es/VList/index.d.ts +0 -16
  149. package/es/VList/index.js +0 -56
  150. package/es/VList/utils.d.ts +0 -10
  151. package/es/useChangeEffect/index.d.ts +0 -3
  152. package/es/useChangeEffect/index.js +0 -32
  153. package/es/useHistory/index.css +0 -0
  154. package/es/useHistory/index.d.ts +0 -3
  155. package/es/useHistory/index.js +0 -14
@@ -1,3 +1,7 @@
1
+ import _useUpdateEffect from "ahooks/es/useUpdateEffect";
2
+ import _nextTick from "@cloud-app-dev/utils/es/nextTick";
3
+ import _useFocusWithin from "ahooks/es/useFocusWithin";
4
+
1
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
6
 
3
7
  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."); }
@@ -10,10 +14,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
14
 
11
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
16
 
13
- import React, { useState, useEffect, useRef, useCallback, useContext } from 'react';
17
+ import React, { useState, useEffect, useRef, useContext } from 'react';
14
18
  import WFC from '../OperatorContext';
15
19
  import IconFont from '../../IconFont';
16
- import useChangeEffect from '../../useChangeEffect';
17
20
 
18
21
  function TitleElement(_ref) {
19
22
  var nodeName = _ref.nodeName,
@@ -25,57 +28,91 @@ function TitleElement(_ref) {
25
28
  var _useContext = useContext(WFC),
26
29
  readOnly = _useContext.readOnly;
27
30
 
28
- var _useState = useState(nodeName),
31
+ var ref = useRef(null);
32
+
33
+ var _useState = useState({
34
+ title: nodeName,
35
+ editable: false
36
+ }),
29
37
  _useState2 = _slicedToArray(_useState, 2),
30
- title = _useState2[0],
31
- setTitle = _useState2[1];
38
+ state = _useState2[0],
39
+ setState = _useState2[1];
32
40
 
33
- var _useState3 = useState(false),
34
- _useState4 = _slicedToArray(_useState3, 2),
35
- editable = _useState4[0],
36
- setEditable = _useState4[1];
41
+ var setTitle = function setTitle(title) {
42
+ return setState(function (old) {
43
+ return Object.assign(Object.assign({}, old), {
44
+ title: title
45
+ });
46
+ });
47
+ };
37
48
 
38
- var input = useRef(null);
39
- var onBlur = useCallback(function () {
40
- setEditable(false);
49
+ var setEditable = function setEditable(editable) {
50
+ return setState(function (old) {
51
+ return Object.assign(Object.assign({}, old), {
52
+ editable: editable
53
+ });
54
+ });
55
+ };
56
+
57
+ var isFocus = _useFocusWithin(ref);
41
58
 
42
- if (!title) {
43
- setTitle(placeholder);
44
- }
45
- }, [title, placeholder]);
46
59
  useEffect(function () {
47
- return !readOnly && editable && input.current.focus();
48
- }, [editable]);
49
- useChangeEffect(function () {
50
- !readOnly && !editable && onTitleChange && onTitleChange(title);
51
- }, [title, editable]);
52
- return /*#__PURE__*/React.createElement(React.Fragment, null, icon && /*#__PURE__*/React.createElement(IconFont, {
60
+ if (isFocus && !readOnly && state.editable) {
61
+ _nextTick(function () {
62
+ var _a;
63
+
64
+ return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.select();
65
+ });
66
+ }
67
+ }, [readOnly, isFocus, state.editable]);
68
+
69
+ _useUpdateEffect(function () {
70
+ return !readOnly && !state.editable && onTitleChange && onTitleChange(state.title);
71
+ }, [state.title, state.editable]);
72
+
73
+ _useUpdateEffect(function () {
74
+ var _a;
75
+
76
+ return (_a = ref.current) === null || _a === void 0 ? void 0 : _a.focus();
77
+ }, [state.editable]);
78
+
79
+ _useUpdateEffect(function () {
80
+ return !state.title && !isFocus && setTitle(placeholder);
81
+ }, [isFocus, state.title, placeholder]);
82
+
83
+ return /*#__PURE__*/React.createElement("div", {
84
+ className: "node-title-ele",
85
+ tabIndex: 1000
86
+ }, icon && /*#__PURE__*/React.createElement(IconFont, {
53
87
  type: icon,
54
88
  style: {
55
89
  paddingRight: 4
56
90
  }
57
- }), !readOnly && editable ? /*#__PURE__*/React.createElement("input", {
58
- ref: input,
91
+ }), /*#__PURE__*/React.createElement("input", {
92
+ ref: ref,
59
93
  type: "text",
94
+ style: {
95
+ display: !readOnly && state.editable ? 'inline-block' : 'none'
96
+ },
60
97
  className: "cloudapp-input editable-title-input",
61
- onBlur: onBlur,
62
98
  onChange: function onChange(e) {
63
99
  return setTitle(e.target.value);
64
100
  },
65
- onFocus: function onFocus(e) {
66
- return e.currentTarget.select();
101
+ onBlur: function onBlur() {
102
+ return setEditable(false);
67
103
  },
68
- value: title,
104
+ value: state.title,
69
105
  placeholder: placeholder
70
- }) : /*#__PURE__*/React.createElement("span", {
106
+ }), /*#__PURE__*/React.createElement("span", {
71
107
  className: "editable-title",
108
+ style: {
109
+ display: !(!readOnly && state.editable) ? 'inline-block' : 'none',
110
+ borderColor: readOnly ? 'transparent' : undefined
111
+ },
72
112
  onClick: function onClick() {
73
113
  return setEditable(true);
74
- },
75
- style: readOnly ? {
76
- borderColor: 'transparent'
77
- } : undefined
78
- }, title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
114
+ }
115
+ }, state.title), !readOnly && /*#__PURE__*/React.createElement(IconFont, {
79
116
  className: "worker-flow-node-del",
80
117
  type: "icon-MarkNo",
81
118
  onClick: delNode,
@@ -241,6 +241,9 @@
241
241
  color: #15bc83;
242
242
  text-align: left;
243
243
  line-height: 16px;
244
+ width: 100%;
245
+ }
246
+ .worker-flow-design .auto-judge .title-wrapper .node-title-ele {
244
247
  display: flex;
245
248
  justify-content: space-between;
246
249
  }
@@ -492,8 +495,6 @@
492
495
  }
493
496
  .node-wrap-box .title {
494
497
  position: relative;
495
- display: flex;
496
- align-items: center;
497
498
  padding-left: 10px;
498
499
  padding-right: 40px;
499
500
  width: 100%;
@@ -501,10 +502,15 @@
501
502
  line-height: 30px;
502
503
  font-size: 12px;
503
504
  color: #fff;
504
- text-align: left;
505
505
  background: #576a95;
506
506
  border-radius: 4px 4px 0 0;
507
507
  }
508
+ .node-wrap-box .title .node-title-ele {
509
+ width: 100%;
510
+ height: 100%;
511
+ display: flex;
512
+ align-items: center;
513
+ }
508
514
  .node-wrap-box .title .iconfont {
509
515
  font-size: 12px;
510
516
  margin-right: 5px;
@@ -1,3 +1,4 @@
1
+ import _useUpdateEffect from "ahooks/es/useUpdateEffect";
1
2
  import "antd/lib/modal/style";
2
3
  import _Modal from "antd/lib/modal";
3
4
 
@@ -38,7 +39,6 @@ import Tools from './Tools';
38
39
  import WFC from './OperatorContext';
39
40
  import { filterNoticeNode, getJAVATaskData, getUserFormKeys } from './utils';
40
41
  import RefDrawer from '../RefDrawer';
41
- import useChangeEffect from '../useChangeEffect';
42
42
  import "./index.css";
43
43
  var FormMap = {
44
44
  1: ApproverForm,
@@ -291,13 +291,14 @@ function WorkerFlow(_ref, ref) {
291
291
  * @description onChange传递数据
292
292
  */
293
293
 
294
- useChangeEffect(function () {
294
+ _useUpdateEffect(function () {
295
295
  return onChange && onChange(getConfig());
296
296
  }, [config]);
297
297
  /**
298
298
  * @description ref传递数据
299
299
  */
300
300
 
301
+
301
302
  useImperativeHandle(ref, function () {
302
303
  return {
303
304
  getConfig: getConfig
package/es/index.d.ts CHANGED
@@ -4,18 +4,15 @@ export { default as AppRedirect } from './AppRedirect';
4
4
  export { default as AppRoute } from './AppRoute';
5
5
  export { default as Auth } from './Auth';
6
6
  export { default as AutoExit } from './AutoExit';
7
+ export { default as Box } from './Box';
7
8
  export { default as CheckGroupFixed } from './CheckGroupFixed';
8
9
  export { default as Config } from './Config';
9
10
  export { default as ConfigContext } from './ConfigContext';
10
- export { default as ContentBox } from './ContentBox';
11
11
  export { default as DeviceIcon } from './DeviceIcon';
12
- export { default as DeviceList } from './DeviceList';
13
12
  export { default as DeviceSelect } from './DeviceSelect';
14
13
  export { default as Dict } from './Dict';
15
14
  export { default as Drag } from './Drag';
16
15
  export { default as Drawer } from './Drawer';
17
- export { default as DynamicDeviceList } from './DynamicDeviceList';
18
- export { default as DynamicList } from './DynamicList';
19
16
  export { default as FullScreen } from './FullScreen';
20
17
  export { default as HightLevel } from './HightLevel';
21
18
  export { default as IconFont } from './IconFont';
@@ -25,7 +22,6 @@ export { default as InitialRequest } from './InitialRequest';
25
22
  export { default as Input } from './Input';
26
23
  export { default as LabelValue } from './LabelValue';
27
24
  export { default as List } from './List';
28
- export { default as ListExt } from './ListExt';
29
25
  export { default as LoaderApp } from './LoaderApp';
30
26
  export { default as LoaderScript } from './LoaderScript';
31
27
  export { default as Modal } from './Modal';
@@ -33,18 +29,14 @@ export { default as Picture } from './Picture';
33
29
  export { default as Progress } from './Progress';
34
30
  export { default as RefDrawer } from './RefDrawer';
35
31
  export { default as RefModal } from './RefModal';
36
- export { default as ScrollList } from './ScrollList';
37
32
  export { default as Service } from './Service';
38
33
  export { default as TableLayout } from './TableLayout';
39
34
  export { default as ThemeAntd } from './ThemeAntd';
35
+ export { default as Title } from './Title';
40
36
  export { default as Tree } from './Tree';
41
- export { default as TreeMode } from './TreeMode';
42
- export { default as TreeTitle } from './TreeTitle';
43
- export { default as useChangeEffect } from './useChangeEffect';
44
37
  export { default as useDrawer } from './useDrawer';
45
- export { default as useHistory } from './useHistory';
46
38
  export { default as useHttp } from './useHttp';
47
39
  export { default as useModal } from './useModal';
40
+ export { default as useNavigate } from './useNavigate';
48
41
  export { default as UserSelect } from './UserSelect';
49
- export { default as VList } from './VList';
50
42
  export { default as WorkerFlow } from './WorkerFlow';
package/es/index.js CHANGED
@@ -4,18 +4,15 @@ export { default as AppRedirect } from './AppRedirect';
4
4
  export { default as AppRoute } from './AppRoute';
5
5
  export { default as Auth } from './Auth';
6
6
  export { default as AutoExit } from './AutoExit';
7
+ export { default as Box } from './Box';
7
8
  export { default as CheckGroupFixed } from './CheckGroupFixed';
8
9
  export { default as Config } from './Config';
9
10
  export { default as ConfigContext } from './ConfigContext';
10
- export { default as ContentBox } from './ContentBox';
11
11
  export { default as DeviceIcon } from './DeviceIcon';
12
- export { default as DeviceList } from './DeviceList';
13
12
  export { default as DeviceSelect } from './DeviceSelect';
14
13
  export { default as Dict } from './Dict';
15
14
  export { default as Drag } from './Drag';
16
15
  export { default as Drawer } from './Drawer';
17
- export { default as DynamicDeviceList } from './DynamicDeviceList';
18
- export { default as DynamicList } from './DynamicList';
19
16
  export { default as FullScreen } from './FullScreen';
20
17
  export { default as HightLevel } from './HightLevel';
21
18
  export { default as IconFont } from './IconFont';
@@ -25,7 +22,6 @@ export { default as InitialRequest } from './InitialRequest';
25
22
  export { default as Input } from './Input';
26
23
  export { default as LabelValue } from './LabelValue';
27
24
  export { default as List } from './List';
28
- export { default as ListExt } from './ListExt';
29
25
  export { default as LoaderApp } from './LoaderApp';
30
26
  export { default as LoaderScript } from './LoaderScript';
31
27
  export { default as Modal } from './Modal';
@@ -33,18 +29,14 @@ export { default as Picture } from './Picture';
33
29
  export { default as Progress } from './Progress';
34
30
  export { default as RefDrawer } from './RefDrawer';
35
31
  export { default as RefModal } from './RefModal';
36
- export { default as ScrollList } from './ScrollList';
37
32
  export { default as Service } from './Service';
38
33
  export { default as TableLayout } from './TableLayout';
39
34
  export { default as ThemeAntd } from './ThemeAntd';
35
+ export { default as Title } from './Title';
40
36
  export { default as Tree } from './Tree';
41
- export { default as TreeMode } from './TreeMode';
42
- export { default as TreeTitle } from './TreeTitle';
43
- export { default as useChangeEffect } from './useChangeEffect';
44
37
  export { default as useDrawer } from './useDrawer';
45
- export { default as useHistory } from './useHistory';
46
38
  export { default as useHttp } from './useHttp';
47
39
  export { default as useModal } from './useModal';
40
+ export { default as useNavigate } from './useNavigate';
48
41
  export { default as UserSelect } from './UserSelect';
49
- export { default as VList } from './VList';
50
42
  export { default as WorkerFlow } from './WorkerFlow';
@@ -7,7 +7,7 @@ export interface IUseDrawerHookState {
7
7
  width?: number | string;
8
8
  className?: string;
9
9
  }
10
- declare function useDrawer(): {
10
+ declare function useDrawer(prefixCls?: string): {
11
11
  open: (options: IUseDrawerHookState) => void;
12
12
  close: () => void;
13
13
  };
@@ -19,6 +19,7 @@ import Drawer from '../Drawer';
19
19
  import CC from '../ConfigContext';
20
20
 
21
21
  function useDrawer() {
22
+ var prefixCls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cloudapp';
22
23
  var context = useContext(CC);
23
24
  var root = useMemo(function () {
24
25
  return (context === null || context === void 0 ? void 0 : context.root) || document.body;
@@ -49,7 +50,7 @@ function useDrawer() {
49
50
  }, []);
50
51
  useEffect(function () {
51
52
  ReactDOM.render( /*#__PURE__*/React.createElement(_ConfigProvider, {
52
- prefixCls: "cloudapp",
53
+ prefixCls: prefixCls,
53
54
  getPopupContainer: function getPopupContainer() {
54
55
  return root;
55
56
  }
@@ -7,7 +7,7 @@ export interface IUseModalHookState {
7
7
  width?: number | string;
8
8
  className?: string;
9
9
  }
10
- declare function useModal(): {
10
+ declare function useModal(prefixCls?: string): {
11
11
  open: (options: IUseModalHookState) => void;
12
12
  close: () => void;
13
13
  };
@@ -19,6 +19,7 @@ import Modal from '../Modal';
19
19
  import CC from '../ConfigContext';
20
20
 
21
21
  function useModal() {
22
+ var prefixCls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'cloudapp';
22
23
  var context = useContext(CC);
23
24
  var root = useMemo(function () {
24
25
  return (context === null || context === void 0 ? void 0 : context.root) || document.body;
@@ -49,7 +50,7 @@ function useModal() {
49
50
  }, []);
50
51
  useEffect(function () {
51
52
  ReactDOM.render( /*#__PURE__*/React.createElement(_ConfigProvider, {
52
- prefixCls: "cloudapp",
53
+ prefixCls: prefixCls,
53
54
  getPopupContainer: function getPopupContainer() {
54
55
  return root;
55
56
  }
File without changes
@@ -0,0 +1,4 @@
1
+ import { NavigateFunction } from 'react-router-dom';
2
+ import './index.less';
3
+ declare function useNavigate(): NavigateFunction;
4
+ export default useNavigate;
@@ -0,0 +1,14 @@
1
+ import { useMemo } from 'react';
2
+ import { useNavigate as useNativeNavigate } from 'react-router-dom';
3
+ import "./index.css";
4
+ var _global = window;
5
+
6
+ function useNavigate() {
7
+ var naticeNavigate = useNativeNavigate();
8
+ var navigate = useMemo(function () {
9
+ return _global.BasicNavigate || naticeNavigate;
10
+ }, [naticeNavigate]);
11
+ return navigate;
12
+ }
13
+
14
+ export default useNavigate;
package/es/utils.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { MutableRefObject } from 'react';
1
2
  export declare const getHeader: () => {
2
3
  Authorization: any;
3
4
  };
@@ -13,3 +14,11 @@ export declare function getParentListById(id: string, orgList?: any[], list?: an
13
14
  export declare function getPlaceCodesWithParent(areaCode: string, list?: any[], areaCodes?: string[], key?: string, pkey?: string): any;
14
15
  export declare function nextTick(cb: () => void): void;
15
16
  export declare function tryCatch(resolveFn: () => Promise<any>, rejectFn?: (e: unknown) => void): Promise<void>;
17
+ declare type TargetValue<T> = T | undefined | null;
18
+ declare type TargetType = HTMLElement | Element | Window | Document;
19
+ export declare type BasicTarget<T extends TargetType = Element> = (() => TargetValue<T>) | TargetValue<T> | MutableRefObject<TargetValue<T>>;
20
+ export declare function getTargetElement<T extends TargetType>(target: BasicTarget<T>, defaultElement?: T): T;
21
+ declare const getScrollTop: (el: Document | Element) => number;
22
+ declare const getScrollHeight: (el: Document | Element) => number;
23
+ declare const getClientHeight: (el: Document | Element) => number;
24
+ export { getScrollTop, getScrollHeight, getClientHeight };
package/es/utils.js CHANGED
@@ -88,4 +88,39 @@ export function tryCatch(resolveFn) {
88
88
  }
89
89
  }, _callee, null, [[0, 5]]);
90
90
  }));
91
- }
91
+ }
92
+ export function getTargetElement(target, defaultElement) {
93
+ if (!target) {
94
+ return defaultElement;
95
+ }
96
+
97
+ var targetElement;
98
+
99
+ if (typeof target === 'function') {
100
+ targetElement = target();
101
+ } else if ('current' in target) {
102
+ targetElement = target.current;
103
+ } else {
104
+ targetElement = target;
105
+ }
106
+
107
+ return targetElement;
108
+ }
109
+
110
+ var getScrollTop = function getScrollTop(el) {
111
+ if (el === document || el === document.body) {
112
+ return Math.max(window.pageYOffset, document.documentElement.scrollTop, document.body.scrollTop);
113
+ }
114
+
115
+ return el.scrollTop;
116
+ };
117
+
118
+ var getScrollHeight = function getScrollHeight(el) {
119
+ return el.scrollHeight || Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
120
+ };
121
+
122
+ var getClientHeight = function getClientHeight(el) {
123
+ return el.clientHeight || Math.max(document.documentElement.clientHeight, document.body.clientHeight);
124
+ };
125
+
126
+ export { getScrollTop, getScrollHeight, getClientHeight };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "@cloud-app-dev/vidc",
4
4
  "description": "Video Image Data Componennts",
5
- "version": "2.0.0-alpha.11",
5
+ "version": "2.0.0-alpha.12",
6
6
  "scripts": {
7
7
  "start": "dumi dev",
8
8
  "docs:build": "dumi build",
@@ -31,22 +31,18 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "add-dom-event-listener": "^1.1.0",
34
- "ahooks": "^2.10.12",
34
+ "ahooks": "^3.1.0",
35
35
  "chroma-js": "^2.1.2",
36
36
  "fetch-like-axios": "^0.0.5",
37
37
  "immer": "^9.0.5",
38
- "jsencrypt": "^3.2.1",
39
38
  "lodash-es": "^4.17.21",
40
- "mobx": "^6.3.2",
41
- "rc-queue-anim": "^2.0.0",
42
- "react-virtualized": "^9.22.3"
39
+ "rc-queue-anim": "^2.0.0"
43
40
  },
44
41
  "devDependencies": {
45
42
  "@cloud-app-dev/utils": "^3.0.2",
46
43
  "@types/add-dom-event-listener": "^1.1.0",
47
44
  "@types/chroma-js": "^2.1.3",
48
45
  "@types/lodash-es": "^4.17.5",
49
- "@types/react-virtualized": "^9.21.15",
50
46
  "@umijs/test": "^3.0.5",
51
47
  "antd": "^4.17.0",
52
48
  "babel-plugin-import": "^1.13.3",
@@ -58,7 +54,7 @@
58
54
  "prettier": "^2.2.1",
59
55
  "react": "^17.0.2",
60
56
  "react-dom": "^17.0.2",
61
- "react-router-dom": "^5.2.0",
57
+ "react-router-dom": "^6.2.1",
62
58
  "rollup-plugin-node-polyfills": "^0.2.1",
63
59
  "yorkie": "^2.0.0"
64
60
  },
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- import { match, RouteProps } from 'react-router-dom';
3
- import { IRenderRouteProps } from './interface';
4
- import * as H from 'history';
5
- /**
6
- * @TODO
7
- * @多种修正使用url判断异步处理这里防止回调执行的时候url变化导致一直执行
8
- * @每次执行先清除上一次的
9
- */
10
- export declare const RenderRoute: React.MemoExoticComponent<({ location, match, history, setRouteProps }: IRenderRouteProps) => any>;
11
- interface IRenderComponentsProps {
12
- state: any;
13
- props: any;
14
- }
15
- export declare const RenderComponents: React.MemoExoticComponent<({ state, props }: IRenderComponentsProps) => any>;
16
- interface IRenderRoutesProps extends RouteProps {
17
- routes?: RouteProps[];
18
- setRouteProps: (match: match<any>, location: H.Location, history: H.History) => void;
19
- children?: React.ReactNode;
20
- }
21
- export declare function RenderRoutes({ routes, setRouteProps, children }: IRenderRoutesProps): JSX.Element;
22
- export declare function RenderSingleRoute({ exact, strict, sensitive, path, setRouteProps, children }: IRenderRoutesProps): JSX.Element;
23
- export {};
@@ -1,111 +0,0 @@
1
- import { __rest } from "tslib";
2
- import React, { useEffect, useMemo } from 'react';
3
- import { getRouteItem } from './utils';
4
- import useHistory from '../useHistory';
5
- import { Route, Switch } from 'react-router-dom';
6
- /**
7
- * @TODO
8
- * @多种修正使用url判断异步处理这里防止回调执行的时候url变化导致一直执行
9
- * @每次执行先清除上一次的
10
- */
11
-
12
- export var RenderRoute = /*#__PURE__*/React.memo(function (_ref) {
13
- var location = _ref.location,
14
- match = _ref.match,
15
- history = _ref.history,
16
- setRouteProps = _ref.setRouteProps;
17
- // eslint-disable-next-line react-hooks/exhaustive-deps
18
- useEffect(function () {
19
- return setRouteProps(match, location, history);
20
- }, [location.pathname]);
21
- return null;
22
- });
23
- export var RenderComponents = /*#__PURE__*/React.memo(function (_ref2) {
24
- var state = _ref2.state,
25
- props = _ref2.props;
26
-
27
- var _useMemo = useMemo(function () {
28
- return state;
29
- }, [state]),
30
- match = _useMemo.match,
31
- location = _useMemo.location;
32
-
33
- var history = useHistory();
34
-
35
- var _a = useMemo(function () {
36
- return props;
37
- }, [props]),
38
- path = _a.path,
39
- component = _a.component,
40
- render = _a.render,
41
- routes = _a.routes,
42
- other = __rest(_a, ["path", "component", "render", "routes"]);
43
-
44
- var _useMemo2 = useMemo(function () {
45
- var Com, Ren;
46
-
47
- if (!routes) {
48
- Com = component;
49
- Ren = render;
50
- } else {
51
- var routeItem = getRouteItem(match, routes);
52
- Com = routeItem.component;
53
- Ren = routeItem.render;
54
- }
55
-
56
- return {
57
- Com: Com,
58
- Ren: Ren
59
- };
60
- }, [component, match, render, routes]),
61
- Com = _useMemo2.Com,
62
- Ren = _useMemo2.Ren;
63
-
64
- return Com ? /*#__PURE__*/React.cloneElement( /*#__PURE__*/React.createElement(Com, null), Object.assign(Object.assign({}, other), {
65
- match: match,
66
- location: location,
67
- history: history
68
- })) : Ren(Object.assign(Object.assign({}, other), {
69
- match: match,
70
- location: location,
71
- history: history
72
- }));
73
- });
74
- export function RenderRoutes(_ref3) {
75
- var routes = _ref3.routes,
76
- setRouteProps = _ref3.setRouteProps,
77
- children = _ref3.children;
78
- return /*#__PURE__*/React.createElement(Switch, null, routes.map(function (item, i) {
79
- return /*#__PURE__*/React.createElement(Route, {
80
- exact: !!item.exact,
81
- sensitive: !!item.sensitive,
82
- strict: !!item.strict,
83
- key: i,
84
- path: item.path,
85
- render: function render(props) {
86
- return /*#__PURE__*/React.createElement(RenderRoute, Object.assign({}, props, {
87
- setRouteProps: setRouteProps
88
- }));
89
- }
90
- });
91
- }), children);
92
- }
93
- export function RenderSingleRoute(_ref4) {
94
- var exact = _ref4.exact,
95
- strict = _ref4.strict,
96
- sensitive = _ref4.sensitive,
97
- path = _ref4.path,
98
- setRouteProps = _ref4.setRouteProps,
99
- children = _ref4.children;
100
- return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
101
- exact: !!exact,
102
- strict: !!strict,
103
- sensitive: !!sensitive,
104
- path: path,
105
- render: function render(props) {
106
- return /*#__PURE__*/React.createElement(RenderRoute, Object.assign({}, props, {
107
- setRouteProps: setRouteProps
108
- }));
109
- }
110
- }), children);
111
- }
@@ -1,4 +0,0 @@
1
- declare function Rendered({ onRendered }: {
2
- onRendered: () => void;
3
- }): JSX.Element;
4
- export default Rendered;
@@ -1,11 +0,0 @@
1
- import React, { useEffect } from 'react';
2
-
3
- function Rendered(_ref) {
4
- var onRendered = _ref.onRendered;
5
- useEffect(function () {
6
- return onRendered();
7
- }, []);
8
- return /*#__PURE__*/React.createElement(React.Fragment, null);
9
- }
10
-
11
- export default Rendered;
@@ -1 +0,0 @@
1
- export declare const getRouteItem: (match: any, routes: any[]) => any;