assui 2.0.73 → 2.0.77

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.
@@ -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;
88
+
89
+ if (!('activeKey' in props)) {
90
+ var resultActiveTab = find(arrayChildren, {
91
+ key: urlParams[saveActiveKeyName]
92
+ });
86
93
 
87
- if (tabActiveKey) {
88
- setUrlParams((_a = {}, _a[saveActiveKeyName] = tabActiveKey, _a));
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
+ }
98
+ } else {
99
+ setUrlParams((_b = {}, _b[saveActiveKeyName] = tabActiveKey, _b));
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 = toArray(children).map(function (childItem) {
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;
@@ -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
- if (tabActiveKey) {
140
- setUrlParams((_a = {}, _a[saveActiveKeyName] = tabActiveKey, _a));
142
+ if (!('activeKey' in props)) {
143
+ var resultActiveTab = lodash_1.find(arrayChildren, {
144
+ key: urlParams[saveActiveKeyName]
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
+ }
151
+ } else {
152
+ setUrlParams((_b = {}, _b[saveActiveKeyName] = tabActiveKey, _b));
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 = toArray_1["default"](children).map(function (childItem) {
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.73",
3
+ "version": "2.0.77",
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.41",
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": "a60e892b826887fec397bc27462cfee4a672abdc"
72
+ "gitHead": "9636a87471d75ecd5b903061c2ce5022d684833f"
73
73
  }