assui 2.0.73 → 2.0.74
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/keep-tab/index.js +14 -3
- package/lib/keep-tab/index.js +15 -3
- package/package.json +2 -2
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,11 +82,21 @@ var KeepTab = function KeepTab(props) {
|
|
|
81
82
|
urlParams = _c[0],
|
|
82
83
|
setUrlParams = _c[1];
|
|
83
84
|
|
|
85
|
+
var arrayChildren = toArray(children);
|
|
84
86
|
React.useEffect(function () {
|
|
85
|
-
var _a;
|
|
87
|
+
var _a, _b;
|
|
86
88
|
|
|
87
89
|
if (tabActiveKey) {
|
|
88
|
-
|
|
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
|
+
}
|
|
89
100
|
}
|
|
90
101
|
}, [tabActiveKey]);
|
|
91
102
|
|
|
@@ -99,7 +110,7 @@ var KeepTab = function KeepTab(props) {
|
|
|
99
110
|
}
|
|
100
111
|
};
|
|
101
112
|
|
|
102
|
-
var resultChildren =
|
|
113
|
+
var resultChildren = arrayChildren.map(function (childItem) {
|
|
103
114
|
var _a;
|
|
104
115
|
|
|
105
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,11 +135,21 @@ var KeepTab = function KeepTab(props) {
|
|
|
133
135
|
urlParams = _c[0],
|
|
134
136
|
setUrlParams = _c[1];
|
|
135
137
|
|
|
138
|
+
var arrayChildren = toArray_1["default"](children);
|
|
136
139
|
React.useEffect(function () {
|
|
137
|
-
var _a;
|
|
140
|
+
var _a, _b;
|
|
138
141
|
|
|
139
142
|
if (tabActiveKey) {
|
|
140
|
-
|
|
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
|
+
}
|
|
141
153
|
}
|
|
142
154
|
}, [tabActiveKey]);
|
|
143
155
|
|
|
@@ -151,7 +163,7 @@ var KeepTab = function KeepTab(props) {
|
|
|
151
163
|
}
|
|
152
164
|
};
|
|
153
165
|
|
|
154
|
-
var resultChildren =
|
|
166
|
+
var resultChildren = arrayChildren.map(function (childItem) {
|
|
155
167
|
var _a;
|
|
156
168
|
|
|
157
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.74",
|
|
4
4
|
"description": "react ui library",
|
|
5
5
|
"author": "jason <usochen@gmail.com>",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"node": ">=10.0.0"
|
|
70
70
|
},
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "6540dd4b00962653d25bd49ed55ff75adb4b6c93"
|
|
73
73
|
}
|