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

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 +3 -7
  4. package/es/AppRoute/index.js +45 -41
  5. package/es/AppRoute/interface.d.ts +2 -12
  6. package/es/AutoExit/index.js +12 -10
  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 -2
  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,201 +0,0 @@
1
- import _treeHelper from "@cloud-app-dev/utils/es/treeHelper";
2
-
3
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
-
5
- 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."); }
6
-
7
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
-
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
-
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
-
13
- 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."); }
14
-
15
- 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); }
16
-
17
- 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; }
18
-
19
- 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; }
20
-
21
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
-
23
- import { __rest } from "tslib";
24
- import React, { useEffect, useMemo, useState } from 'react';
25
- import api from '../Api';
26
- import TreeTitle from '../TreeTitle';
27
- import { getParentListById, getPlaceCodesWithParent } from '../utils';
28
- import IconFont from '../IconFont';
29
- import useHttp from '../useHttp';
30
- import Tree from '../Tree';
31
- import "./index.css";
32
- var defaultList = [];
33
-
34
- function TreeMode(_a) {
35
- var title = _a.title,
36
- className = _a.className,
37
- renderHeader = _a.renderHeader,
38
- inputPlaceholder = _a.inputPlaceholder,
39
- treeNodeProps = _a.treeNodeProps,
40
- onDefailtSelect = _a.onDefailtSelect,
41
- mode = _a.mode,
42
- showIcon = _a.showIcon,
43
- props = __rest(_a, ["title", "className", "renderHeader", "inputPlaceholder", "treeNodeProps", "onDefailtSelect", "mode", "showIcon"]);
44
-
45
- var _useState = useState({
46
- keyword: undefined,
47
- expandedKeys: undefined,
48
- focusKey: Date.now()
49
- }),
50
- _useState2 = _slicedToArray(_useState, 2),
51
- state = _useState2[0],
52
- setState = _useState2[1];
53
- /**
54
- * @description 根据mode获取树的数据
55
- */
56
-
57
-
58
- var _useHttp = useHttp(['TreeMode', mode], function (_ref) {
59
- var _ref2 = _slicedToArray(_ref, 2),
60
- _ = _ref2[0],
61
- mode = _ref2[1];
62
-
63
- return mode === 'Bz' ? api.getDeviceBzTree() : mode === 'Custom' ? api.getCustomDeviceGroup() : mode === 'Org' ? api.getOrgs() : api.getPlacesByHasDevice();
64
- }),
65
- _useHttp$data = _useHttp.data,
66
- list = _useHttp$data === void 0 ? defaultList : _useHttp$data;
67
-
68
- var treeData = useMemo(function () {
69
- return mode === 'Place' ? _treeHelper.computPlaceTree(list) : _treeHelper.computTreeList(list);
70
- }, [list, mode]);
71
- /**
72
- * @description 实现关键字展开节点
73
- */
74
-
75
- useEffect(function () {
76
- var _a, _b;
77
-
78
- var keys = [];
79
- var defaultKeys = mode === 'Place' ? [] : ((_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id) ? [(_b = treeData[0]) === null || _b === void 0 ? void 0 : _b.id] : [];
80
-
81
- if (!state.keyword) {
82
- setState(function (old) {
83
- return Object.assign(Object.assign({}, old), {
84
- expandedKeys: defaultKeys,
85
- focusKey: Date.now()
86
- });
87
- });
88
- return null;
89
- }
90
-
91
- switch (mode) {
92
- case 'Place':
93
- var places = list.filter(function (v) {
94
- return v.areaName.includes(state.keyword);
95
- });
96
- places.forEach(function (v) {
97
- var codes = getPlaceCodesWithParent(v.areaCode, list);
98
- keys = [].concat(keys, codes);
99
- });
100
- break;
101
-
102
- case 'Bz':
103
- case 'Custom':
104
- var trees = list.filter(function (v) {
105
- return v.groupName.includes(state.keyword);
106
- });
107
- trees.forEach(function (v) {
108
- var ids = getParentListById(v.id, list).map(function (v) {
109
- return v.id;
110
- });
111
- keys = [].concat(keys, ids);
112
- });
113
-
114
- case 'Org':
115
- var orgs = list.filter(function (v) {
116
- return v.organizationName.includes(state.keyword);
117
- });
118
- orgs.forEach(function (v) {
119
- var ids = getParentListById(v.id, list).map(function (v) {
120
- return v.id;
121
- });
122
- keys = [].concat(keys, ids);
123
- });
124
- break;
125
- }
126
-
127
- var expandedKeys = _toConsumableArray(new Set(_toConsumableArray(keys)));
128
-
129
- setState(function (old) {
130
- var _a;
131
-
132
- return Object.assign(Object.assign({}, old), {
133
- expandedKeys: expandedKeys.length > 0 ? expandedKeys : [(_a = treeData[0]) === null || _a === void 0 ? void 0 : _a.id],
134
- focusKey: Date.now()
135
- });
136
- });
137
- }, [state.keyword, list, treeData, mode]);
138
- var treeKey = useMemo(function () {
139
- return mode === 'Place' ? 'areaCode' : 'id';
140
- }, [mode]);
141
- var treeName = useMemo(function () {
142
- return mode === 'Place' ? 'areaName' : mode === 'Org' ? 'organizationName' : 'groupName';
143
- }, [mode]);
144
- /**
145
- * @description 触发默认选中节点事件
146
- */
147
-
148
- useEffect(function () {
149
- var id = treeData[0] ? treeData[0][treeKey] : undefined;
150
-
151
- if (id && onDefailtSelect) {
152
- onDefailtSelect(id);
153
- }
154
- }, [treeData, treeKey]);
155
- return /*#__PURE__*/React.createElement("div", {
156
- className: "bc-type-tree-layout ".concat(className)
157
- }, /*#__PURE__*/React.createElement(TreeTitle, {
158
- title: title,
159
- value: state.keyword,
160
- inputPlaceholder: inputPlaceholder,
161
- onChange: function onChange(val) {
162
- return setState(function (old) {
163
- return Object.assign(Object.assign({}, old), {
164
- keyword: val
165
- });
166
- });
167
- }
168
- }), renderHeader && renderHeader(), list.length > 0 && /*#__PURE__*/React.createElement(Tree, Object.assign({}, props, {
169
- treeData: treeData,
170
- key: state.focusKey,
171
- showIcon: showIcon,
172
- onExpand: function onExpand(keys) {
173
- return setState(function (old) {
174
- return Object.assign(Object.assign({}, old), {
175
- expandedKeys: keys
176
- });
177
- });
178
- },
179
- expandedKeys: state.expandedKeys,
180
- defaultExpandedKeys: treeData[0] ? [treeData[0].id] : undefined,
181
- treeNodeProps: {
182
- keyword: state.keyword,
183
- suffix: treeNodeProps === null || treeNodeProps === void 0 ? void 0 : treeNodeProps.suffix,
184
- nameKey: treeName,
185
- key: treeKey
186
- },
187
- icon: function icon(node) {
188
- return /*#__PURE__*/React.createElement(IconFont, {
189
- type: "".concat(treeData.length === 1 && node.id === treeData[0].id ? 'icon-S_Bar_Home' : mode === 'Place' ? node.level > 4 ? 'icon-S_Place_Place' : 'icon-S_Bar_Add' : 'icon-S_Photo_ListTree')
190
- });
191
- }
192
- })));
193
- }
194
-
195
- TreeMode.defaultProps = {
196
- mode: 'Bz',
197
- className: '',
198
- treeNodeProps: {},
199
- showIcon: true
200
- };
201
- export default TreeMode;
@@ -1,4 +0,0 @@
1
- .bc-simple-list-layout {
2
- width: 100%;
3
- height: 100%;
4
- }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import './index.less';
3
- interface SimpleListProps<T> {
4
- data?: Array<T>;
5
- rowHeight?: number;
6
- className?: string;
7
- rowRenderer?({ key, index, style }: {
8
- key: string;
9
- index: number;
10
- style: React.CSSProperties;
11
- }): JSX.Element;
12
- renderItem?(item: T, index: number): JSX.Element;
13
- forwardRef?: React.ForwardedRef<any>;
14
- }
15
- declare const ListView: React.ForwardRefExoticComponent<SimpleListProps<any> & React.RefAttributes<any>>;
16
- export default ListView;
package/es/VList/index.js DELETED
@@ -1,56 +0,0 @@
1
- import React, { useImperativeHandle, useMemo, useRef } from 'react';
2
- import List from 'react-virtualized/dist/es/List';
3
- import AutoSizer from 'react-virtualized/dist/es/AutoSizer';
4
- import { renderRowItem } from './utils';
5
- import "./index.css";
6
-
7
- function VList(_ref) {
8
- var className = _ref.className,
9
- rowRenderer = _ref.rowRenderer,
10
- rowHeight = _ref.rowHeight,
11
- data = _ref.data,
12
- renderItem = _ref.renderItem,
13
- forwardRef = _ref.forwardRef;
14
- var listRef = useRef(null);
15
-
16
- var forceUpdateGrid = function forceUpdateGrid() {
17
- var _a;
18
-
19
- (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.forceUpdateGrid();
20
- };
21
-
22
- useImperativeHandle(forwardRef, function () {
23
- return {
24
- forceUpdateGrid: forceUpdateGrid
25
- };
26
- });
27
- var render = useMemo(function () {
28
- return renderRowItem(rowRenderer, renderItem, data);
29
- }, [rowRenderer, renderItem, data]);
30
- return /*#__PURE__*/React.createElement(AutoSizer, {
31
- className: "bc-simple-list-layout ".concat(className)
32
- }, function (_ref2) {
33
- var width = _ref2.width,
34
- height = _ref2.height;
35
- return /*#__PURE__*/React.createElement(List, {
36
- width: width,
37
- height: height,
38
- rowCount: data.length,
39
- rowHeight: rowHeight,
40
- rowRenderer: render,
41
- ref: listRef
42
- });
43
- });
44
- }
45
-
46
- VList.defaultProps = {
47
- className: '',
48
- rowHeight: 30,
49
- data: []
50
- };
51
- var ListView = /*#__PURE__*/React.forwardRef(function (props, ref) {
52
- return /*#__PURE__*/React.createElement(VList, Object.assign({}, props, {
53
- forwardRef: ref
54
- }));
55
- });
56
- export default ListView;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export declare function renderRowItem(rowRenderer?: ({ key, index, style }: {
3
- key: string;
4
- index: number;
5
- style: React.CSSProperties;
6
- }) => JSX.Element, renderItem?: (item: any, index: number) => JSX.Element, data?: any[]): ({ key, index, style }: {
7
- key: string;
8
- index: number;
9
- style: React.CSSProperties;
10
- }) => JSX.Element;
@@ -1,3 +0,0 @@
1
- declare type HookFunctionHandle = () => (() => void) | undefined | null | void;
2
- declare function useChangeEffect(fn: HookFunctionHandle, deps: Array<any>): void;
3
- export default useChangeEffect;
@@ -1,32 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
-
3
- 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."); }
4
-
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); }
6
-
7
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
-
9
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
-
11
- 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; }
12
-
13
- import { useEffect, useRef } from 'react';
14
-
15
- function useChangeEffect(fn, deps) {
16
- var statusRef = useRef(false);
17
- useEffect(function () {
18
- if (!statusRef.current) {
19
- return null;
20
- }
21
-
22
- var destory = fn();
23
- return function () {
24
- destory && destory();
25
- };
26
- }, _toConsumableArray(deps));
27
- useEffect(function () {
28
- statusRef.current = true;
29
- }, []);
30
- }
31
-
32
- export default useChangeEffect;
File without changes
@@ -1,3 +0,0 @@
1
- import './index.less';
2
- declare function useHistory(): any;
3
- export default useHistory;
@@ -1,14 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useHistory as useNativeHistory } from 'react-router-dom';
3
- import "./index.css";
4
- var _global = window;
5
-
6
- function useHistory() {
7
- var naticeHistory = useNativeHistory();
8
- var history = useMemo(function () {
9
- return _global.BasicHistory || naticeHistory;
10
- }, [naticeHistory]);
11
- return history;
12
- }
13
-
14
- export default useHistory;