assui 2.0.72 → 2.0.76
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.
- package/es/keep-tab/index.js +20 -1
- package/lib/keep-tab/index.js +21 -1
- package/package.json +3 -3
package/es/keep-tab/index.js
CHANGED
|
@@ -55,6 +55,7 @@ var __read = this && this.__read || function (o, n) {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
import * as React from 'react';
|
|
58
|
+
import { find } from 'lodash';
|
|
58
59
|
import Badge from 'antd/es/badge';
|
|
59
60
|
import Tabs from 'antd/es/tabs';
|
|
60
61
|
import { useParams } from 'react-router-dom';
|
|
@@ -81,6 +82,24 @@ var KeepTab = function KeepTab(props) {
|
|
|
81
82
|
urlParams = _c[0],
|
|
82
83
|
setUrlParams = _c[1];
|
|
83
84
|
|
|
85
|
+
var arrayChildren = toArray(children);
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
|
|
89
|
+
if (tabActiveKey) {
|
|
90
|
+
var resultActiveTab = find(arrayChildren, {
|
|
91
|
+
key: tabActiveKey
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (!resultActiveTab || resultActiveTab.props.disabled) {
|
|
95
|
+
setUrlParams((_a = {}, _a[saveActiveKeyName] = arrayChildren[0].key, _a));
|
|
96
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(arrayChildren[0].key);
|
|
97
|
+
} else {
|
|
98
|
+
setUrlParams((_b = {}, _b[saveActiveKeyName] = tabActiveKey, _b));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}, [tabActiveKey]);
|
|
102
|
+
|
|
84
103
|
var handleTabChange = function handleTabChange(nextActiveKey) {
|
|
85
104
|
var _a;
|
|
86
105
|
|
|
@@ -91,7 +110,7 @@ var KeepTab = function KeepTab(props) {
|
|
|
91
110
|
}
|
|
92
111
|
};
|
|
93
112
|
|
|
94
|
-
var resultChildren =
|
|
113
|
+
var resultChildren = arrayChildren.map(function (childItem) {
|
|
95
114
|
var _a;
|
|
96
115
|
|
|
97
116
|
var count = (_a = childItem === null || childItem === void 0 ? void 0 : childItem.props) === null || _a === void 0 ? void 0 : _a.count;
|
package/lib/keep-tab/index.js
CHANGED
|
@@ -102,6 +102,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
102
102
|
|
|
103
103
|
var React = __importStar(require("react"));
|
|
104
104
|
|
|
105
|
+
var lodash_1 = require("lodash");
|
|
106
|
+
|
|
105
107
|
var badge_1 = __importDefault(require("antd/es/badge"));
|
|
106
108
|
|
|
107
109
|
var tabs_1 = __importDefault(require("antd/es/tabs"));
|
|
@@ -133,6 +135,24 @@ var KeepTab = function KeepTab(props) {
|
|
|
133
135
|
urlParams = _c[0],
|
|
134
136
|
setUrlParams = _c[1];
|
|
135
137
|
|
|
138
|
+
var arrayChildren = toArray_1["default"](children);
|
|
139
|
+
React.useEffect(function () {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
|
|
142
|
+
if (tabActiveKey) {
|
|
143
|
+
var resultActiveTab = lodash_1.find(arrayChildren, {
|
|
144
|
+
key: tabActiveKey
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (!resultActiveTab || resultActiveTab.props.disabled) {
|
|
148
|
+
setUrlParams((_a = {}, _a[saveActiveKeyName] = arrayChildren[0].key, _a));
|
|
149
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(arrayChildren[0].key);
|
|
150
|
+
} else {
|
|
151
|
+
setUrlParams((_b = {}, _b[saveActiveKeyName] = tabActiveKey, _b));
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}, [tabActiveKey]);
|
|
155
|
+
|
|
136
156
|
var handleTabChange = function handleTabChange(nextActiveKey) {
|
|
137
157
|
var _a;
|
|
138
158
|
|
|
@@ -143,7 +163,7 @@ var KeepTab = function KeepTab(props) {
|
|
|
143
163
|
}
|
|
144
164
|
};
|
|
145
165
|
|
|
146
|
-
var resultChildren =
|
|
166
|
+
var resultChildren = arrayChildren.map(function (childItem) {
|
|
147
167
|
var _a;
|
|
148
168
|
|
|
149
169
|
var count = (_a = childItem === null || childItem === void 0 ? void 0 : childItem.props) === null || _a === void 0 ? void 0 : _a.count;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.76",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@ahooksjs/use-url-state": "^2.5.8",
|
|
34
34
|
"@tinymce/tinymce-react": "^3.13.0",
|
|
35
35
|
"@types/react-beautiful-dnd": "^13.1.2",
|
|
36
|
-
"a-icons": "^1.0.
|
|
36
|
+
"a-icons": "^1.0.43",
|
|
37
37
|
"ahooks": "^3.0.8",
|
|
38
38
|
"bignumber.js": "^9.0.1",
|
|
39
39
|
"copy-to-clipboard": "^3.3.1",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"node": ">=10.0.0"
|
|
70
70
|
},
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6e4862aa641f382f96afc1d00af96c68d23f424d"
|
|
73
73
|
}
|