@bit-sun/business-component 2.1.14 → 2.1.16

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.
@@ -11,3 +11,4 @@ export declare function handleUserPhone(): any;
11
11
  export declare const setLoginOutPath: () => void;
12
12
  export declare const getBreadcrumbNameMap: (menuData: any) => {};
13
13
  export declare const ergodicMenuRoutes: (routes: any) => any[];
14
+ export declare const encodeUrlQuery: (pathStr: any) => string;
package/dist/index.esm.js CHANGED
@@ -14234,7 +14234,7 @@ var SortableTable = /*#__PURE__*/function (_React$Component) {
14234
14234
  var columnConfig = _this.getConfigFromlocalstorage();
14235
14235
 
14236
14236
  var initialDataSourceData = columnConfig.length ? datasource.map(function (item) {
14237
- var _showColumnItem$, _inner$;
14237
+ var _inner$, _showColumnItem$, _inner$2;
14238
14238
 
14239
14239
  var inner = columnConfig.filter(function (innerItem) {
14240
14240
  return innerItem.dataIndex && innerItem.dataIndex === item.dataIndex || innerItem.key && innerItem.key === item.key;
@@ -14243,8 +14243,9 @@ var SortableTable = /*#__PURE__*/function (_React$Component) {
14243
14243
  return inneritem.dataIndex && inneritem.dataIndex === item.dataIndex || inneritem.key && inneritem.key === item.key;
14244
14244
  });
14245
14245
  return _objectSpread2(_objectSpread2({}, item), {}, {
14246
+ fixed: inner.length ? (_inner$ = inner[0]) === null || _inner$ === void 0 ? void 0 : _inner$.fixed : item === null || item === void 0 ? void 0 : item.fixed,
14246
14247
  key: item.key || item.dataIndex,
14247
- width: ((_showColumnItem$ = showColumnItem[0]) === null || _showColumnItem$ === void 0 ? void 0 : _showColumnItem$.width) || ((_inner$ = inner[0]) === null || _inner$ === void 0 ? void 0 : _inner$.width) || item.width,
14248
+ width: ((_showColumnItem$ = showColumnItem[0]) === null || _showColumnItem$ === void 0 ? void 0 : _showColumnItem$.width) || ((_inner$2 = inner[0]) === null || _inner$2 === void 0 ? void 0 : _inner$2.width) || item.width,
14248
14249
  hidden: columnConfig.length && !inner.length
14249
14250
  });
14250
14251
  }) : _toConsumableArray(datasource);
@@ -17556,6 +17557,27 @@ var ergodicMenuRoutes = function ergodicMenuRoutes(routes) {
17556
17557
  ergodicRoutes(routes);
17557
17558
  return codeArray;
17558
17559
  };
17560
+ var encodeUrlQuery = function encodeUrlQuery(pathStr) {
17561
+ var newPathStr = '';
17562
+
17563
+ if (pathStr.indexOf('#') > -1) {
17564
+ var index = pathStr.indexOf('?');
17565
+ var str1 = pathStr.substr(0, index + 1);
17566
+ var str2 = pathStr.substr(index + 1, pathStr.length - index - 1);
17567
+ var queryArr = str2.split('&');
17568
+ var newArr = queryArr.map(function (item) {
17569
+ var index = item.indexOf('=');
17570
+ var s1 = item.substr(0, index);
17571
+ var s2 = item.substr(index + 1, item.length - index - 1);
17572
+ return "".concat(s1, "=").concat(encodeURIComponent(s2));
17573
+ });
17574
+ newPathStr = "".concat(str1).concat(newArr.join('&'));
17575
+ } else {
17576
+ newPathStr = pathStr;
17577
+ }
17578
+
17579
+ return newPathStr;
17580
+ };
17559
17581
 
17560
17582
  var AllFunc = function AllFunc(props) {
17561
17583
  var _useState = useState(''),
@@ -19933,7 +19955,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
19933
19955
  });
19934
19956
 
19935
19957
  localStorage.setItem('isTabChange', '1');
19936
- history.push(key);
19958
+ var newKey = encodeUrlQuery(key);
19959
+ history.push(newKey);
19937
19960
  }
19938
19961
  };
19939
19962
 
@@ -20010,8 +20033,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20010
20033
  listenRouterState: newListenRouterState,
20011
20034
  listenRouterKey: newListenRouterKey
20012
20035
  }, function () {
20036
+ var newKey = encodeUrlQuery(newActiveKey);
20013
20037
  history.push({
20014
- pathname: newActiveKey
20038
+ pathname: newKey
20015
20039
  });
20016
20040
 
20017
20041
  _this.checkisNavSlide();
@@ -20046,8 +20070,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20046
20070
 
20047
20071
  _this.handleMenuClick = function (item) {
20048
20072
  if (item.children || !item.component) return;
20073
+ var newKey = encodeUrlQuery(item.path);
20049
20074
  history.push({
20050
- pathname: item.path
20075
+ pathname: newKey
20051
20076
  });
20052
20077
 
20053
20078
  _this.setShowMenu(false);
@@ -20165,8 +20190,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20165
20190
 
20166
20191
  _this.updateState(newlistenRouterState, newlistenRouterKey, function () {
20167
20192
  if (deleteKey === activeKey) {
20193
+ var newKey = encodeUrlQuery(newActiveKey);
20168
20194
  history.push({
20169
- pathname: newActiveKey
20195
+ pathname: newKey
20170
20196
  });
20171
20197
  }
20172
20198
  });
@@ -20189,8 +20215,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20189
20215
  })) {
20190
20216
  return;
20191
20217
  } else {
20218
+ var newKey = encodeUrlQuery(key);
20192
20219
  history.push({
20193
- pathname: key
20220
+ pathname: newKey
20194
20221
  });
20195
20222
  }
20196
20223
  });
@@ -20218,8 +20245,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20218
20245
  })) {
20219
20246
  return;
20220
20247
  } else {
20248
+ var newKey = encodeUrlQuery(key);
20221
20249
  history.push({
20222
- pathname: key
20250
+ pathname: newKey
20223
20251
  });
20224
20252
  }
20225
20253
  });
@@ -20244,8 +20272,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20244
20272
  return item === key || item === '/';
20245
20273
  }), function () {
20246
20274
  if (key !== activeKey) {
20275
+ var newKey = encodeUrlQuery(key);
20247
20276
  history.push({
20248
- pathname: key
20277
+ pathname: newKey
20249
20278
  });
20250
20279
  }
20251
20280
  });
@@ -20316,7 +20345,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20316
20345
  }
20317
20346
 
20318
20347
  if (typeof e.data === 'string') {
20319
- history.push(e.data.replace(/^\/\w+\//, '/'));
20348
+ var newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
20349
+ history.push(newKey);
20320
20350
  } else {
20321
20351
  var info = e.data;
20322
20352
 
@@ -20567,8 +20597,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20567
20597
  }), listenRouterKey.filter(function (d) {
20568
20598
  return d !== activeKey;
20569
20599
  }), function () {
20600
+ var newKey = encodeUrlQuery(newActiveKey);
20570
20601
  history.push({
20571
- pathname: newActiveKey
20602
+ pathname: newKey
20572
20603
  });
20573
20604
  });
20574
20605
  }
package/dist/index.js CHANGED
@@ -14248,7 +14248,7 @@ var SortableTable = /*#__PURE__*/function (_React$Component) {
14248
14248
  var columnConfig = _this.getConfigFromlocalstorage();
14249
14249
 
14250
14250
  var initialDataSourceData = columnConfig.length ? datasource.map(function (item) {
14251
- var _showColumnItem$, _inner$;
14251
+ var _inner$, _showColumnItem$, _inner$2;
14252
14252
 
14253
14253
  var inner = columnConfig.filter(function (innerItem) {
14254
14254
  return innerItem.dataIndex && innerItem.dataIndex === item.dataIndex || innerItem.key && innerItem.key === item.key;
@@ -14257,8 +14257,9 @@ var SortableTable = /*#__PURE__*/function (_React$Component) {
14257
14257
  return inneritem.dataIndex && inneritem.dataIndex === item.dataIndex || inneritem.key && inneritem.key === item.key;
14258
14258
  });
14259
14259
  return _objectSpread2(_objectSpread2({}, item), {}, {
14260
+ fixed: inner.length ? (_inner$ = inner[0]) === null || _inner$ === void 0 ? void 0 : _inner$.fixed : item === null || item === void 0 ? void 0 : item.fixed,
14260
14261
  key: item.key || item.dataIndex,
14261
- width: ((_showColumnItem$ = showColumnItem[0]) === null || _showColumnItem$ === void 0 ? void 0 : _showColumnItem$.width) || ((_inner$ = inner[0]) === null || _inner$ === void 0 ? void 0 : _inner$.width) || item.width,
14262
+ width: ((_showColumnItem$ = showColumnItem[0]) === null || _showColumnItem$ === void 0 ? void 0 : _showColumnItem$.width) || ((_inner$2 = inner[0]) === null || _inner$2 === void 0 ? void 0 : _inner$2.width) || item.width,
14262
14263
  hidden: columnConfig.length && !inner.length
14263
14264
  });
14264
14265
  }) : _toConsumableArray(datasource);
@@ -17570,6 +17571,27 @@ var ergodicMenuRoutes = function ergodicMenuRoutes(routes) {
17570
17571
  ergodicRoutes(routes);
17571
17572
  return codeArray;
17572
17573
  };
17574
+ var encodeUrlQuery = function encodeUrlQuery(pathStr) {
17575
+ var newPathStr = '';
17576
+
17577
+ if (pathStr.indexOf('#') > -1) {
17578
+ var index = pathStr.indexOf('?');
17579
+ var str1 = pathStr.substr(0, index + 1);
17580
+ var str2 = pathStr.substr(index + 1, pathStr.length - index - 1);
17581
+ var queryArr = str2.split('&');
17582
+ var newArr = queryArr.map(function (item) {
17583
+ var index = item.indexOf('=');
17584
+ var s1 = item.substr(0, index);
17585
+ var s2 = item.substr(index + 1, item.length - index - 1);
17586
+ return "".concat(s1, "=").concat(encodeURIComponent(s2));
17587
+ });
17588
+ newPathStr = "".concat(str1).concat(newArr.join('&'));
17589
+ } else {
17590
+ newPathStr = pathStr;
17591
+ }
17592
+
17593
+ return newPathStr;
17594
+ };
17573
17595
 
17574
17596
  var AllFunc = function AllFunc(props) {
17575
17597
  var _useState = React.useState(''),
@@ -19947,7 +19969,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
19947
19969
  });
19948
19970
 
19949
19971
  localStorage.setItem('isTabChange', '1');
19950
- umi.history.push(key);
19972
+ var newKey = encodeUrlQuery(key);
19973
+ umi.history.push(newKey);
19951
19974
  }
19952
19975
  };
19953
19976
 
@@ -20024,8 +20047,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20024
20047
  listenRouterState: newListenRouterState,
20025
20048
  listenRouterKey: newListenRouterKey
20026
20049
  }, function () {
20050
+ var newKey = encodeUrlQuery(newActiveKey);
20027
20051
  umi.history.push({
20028
- pathname: newActiveKey
20052
+ pathname: newKey
20029
20053
  });
20030
20054
 
20031
20055
  _this.checkisNavSlide();
@@ -20060,8 +20084,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20060
20084
 
20061
20085
  _this.handleMenuClick = function (item) {
20062
20086
  if (item.children || !item.component) return;
20087
+ var newKey = encodeUrlQuery(item.path);
20063
20088
  umi.history.push({
20064
- pathname: item.path
20089
+ pathname: newKey
20065
20090
  });
20066
20091
 
20067
20092
  _this.setShowMenu(false);
@@ -20179,8 +20204,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20179
20204
 
20180
20205
  _this.updateState(newlistenRouterState, newlistenRouterKey, function () {
20181
20206
  if (deleteKey === activeKey) {
20207
+ var newKey = encodeUrlQuery(newActiveKey);
20182
20208
  umi.history.push({
20183
- pathname: newActiveKey
20209
+ pathname: newKey
20184
20210
  });
20185
20211
  }
20186
20212
  });
@@ -20203,8 +20229,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20203
20229
  })) {
20204
20230
  return;
20205
20231
  } else {
20232
+ var newKey = encodeUrlQuery(key);
20206
20233
  umi.history.push({
20207
- pathname: key
20234
+ pathname: newKey
20208
20235
  });
20209
20236
  }
20210
20237
  });
@@ -20232,8 +20259,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20232
20259
  })) {
20233
20260
  return;
20234
20261
  } else {
20262
+ var newKey = encodeUrlQuery(key);
20235
20263
  umi.history.push({
20236
- pathname: key
20264
+ pathname: newKey
20237
20265
  });
20238
20266
  }
20239
20267
  });
@@ -20258,8 +20286,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20258
20286
  return item === key || item === '/';
20259
20287
  }), function () {
20260
20288
  if (key !== activeKey) {
20289
+ var newKey = encodeUrlQuery(key);
20261
20290
  umi.history.push({
20262
- pathname: key
20291
+ pathname: newKey
20263
20292
  });
20264
20293
  }
20265
20294
  });
@@ -20330,7 +20359,8 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20330
20359
  }
20331
20360
 
20332
20361
  if (typeof e.data === 'string') {
20333
- history.push(e.data.replace(/^\/\w+\//, '/'));
20362
+ var newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
20363
+ history.push(newKey);
20334
20364
  } else {
20335
20365
  var info = e.data;
20336
20366
 
@@ -20581,8 +20611,9 @@ var BasicLayout = /*#__PURE__*/function (_React$PureComponent) {
20581
20611
  }), listenRouterKey.filter(function (d) {
20582
20612
  return d !== activeKey;
20583
20613
  }), function () {
20614
+ var newKey = encodeUrlQuery(newActiveKey);
20584
20615
  umi.history.push({
20585
- pathname: newActiveKey
20616
+ pathname: newKey
20586
20617
  });
20587
20618
  });
20588
20619
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.1.14",
3
+ "version": "2.1.16",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -33,6 +33,7 @@ import {
33
33
  getBreadcrumbNameMap,
34
34
  ergodicMenuRoutes,
35
35
  matchPath,
36
+ encodeUrlQuery,
36
37
  } from './utils';
37
38
  import moment from 'moment';
38
39
  import GlobalHeaderCom from './Components/GlobalHeader';
@@ -347,7 +348,8 @@ class BasicLayout extends React.PureComponent {
347
348
  }
348
349
 
349
350
  if (typeof e.data === 'string') {
350
- history.push(e.data.replace(/^\/\w+\//, '/'));
351
+ let newKey = encodeUrlQuery(e.data.replace(/^\/\w+\//, '/'));
352
+ history.push(newKey);
351
353
  } else {
352
354
  const info = e.data;
353
355
  if (info.type === 'remove') {
@@ -638,7 +640,8 @@ class BasicLayout extends React.PureComponent {
638
640
  activeKey: key,
639
641
  });
640
642
  localStorage.setItem('isTabChange', '1');
641
- history.push(key);
643
+ let newKey = encodeUrlQuery(key);
644
+ history.push(newKey);
642
645
  }
643
646
  };
644
647
 
@@ -718,8 +721,9 @@ class BasicLayout extends React.PureComponent {
718
721
  listenRouterKey: newListenRouterKey,
719
722
  },
720
723
  () => {
724
+ let newKey = encodeUrlQuery(newActiveKey);
721
725
  history.push({
722
- pathname: newActiveKey,
726
+ pathname: newKey,
723
727
  });
724
728
  this.checkisNavSlide();
725
729
  },
@@ -754,8 +758,9 @@ class BasicLayout extends React.PureComponent {
754
758
 
755
759
  handleMenuClick = (item: any) => {
756
760
  if (item.children || !item.component) return;
761
+ let newKey = encodeUrlQuery(item.path);
757
762
  history.push({
758
- pathname: item.path,
763
+ pathname: newKey,
759
764
  });
760
765
  this.setShowMenu(false);
761
766
  };
@@ -868,8 +873,9 @@ class BasicLayout extends React.PureComponent {
868
873
  newlistenRouterKey = listenRouterKey.filter((d) => d !== key);
869
874
  this.updateState(newlistenRouterState, newlistenRouterKey, () => {
870
875
  if (deleteKey === activeKey) {
876
+ let newKey = encodeUrlQuery(newActiveKey);
871
877
  history.push({
872
- pathname: newActiveKey,
878
+ pathname: newKey,
873
879
  });
874
880
  }
875
881
  });
@@ -886,8 +892,9 @@ class BasicLayout extends React.PureComponent {
886
892
  if (newlistenRouterKey.find((item) => item === activeKey)) {
887
893
  return;
888
894
  } else {
895
+ let newKey = encodeUrlQuery(key);
889
896
  history.push({
890
- pathname: key,
897
+ pathname: newKey,
891
898
  });
892
899
  }
893
900
  });
@@ -909,8 +916,9 @@ class BasicLayout extends React.PureComponent {
909
916
  if (newlistenRouterKey.find((item) => item === activeKey)) {
910
917
  return;
911
918
  } else {
919
+ let newKey = encodeUrlQuery(key);
912
920
  history.push({
913
- pathname: key,
921
+ pathname: newKey,
914
922
  });
915
923
  }
916
924
  },
@@ -935,8 +943,9 @@ class BasicLayout extends React.PureComponent {
935
943
  listenRouterKey.filter((item) => item === key || item === '/'),
936
944
  () => {
937
945
  if (key !== activeKey) {
946
+ let newKey = encodeUrlQuery(key);
938
947
  history.push({
939
- pathname: key,
948
+ pathname: newKey,
940
949
  });
941
950
  }
942
951
  },
@@ -1036,8 +1045,9 @@ class BasicLayout extends React.PureComponent {
1036
1045
  listenRouterState.filter((d) => d.key !== activeKey),
1037
1046
  listenRouterKey.filter((d) => d !== activeKey),
1038
1047
  () => {
1048
+ let newKey = encodeUrlQuery(newActiveKey);
1039
1049
  history.push({
1040
- pathname: newActiveKey,
1050
+ pathname: newKey,
1041
1051
  });
1042
1052
  },
1043
1053
  );
@@ -208,4 +208,24 @@ export const ergodicMenuRoutes = (routes) => {
208
208
  ergodicRoutes(routes);
209
209
 
210
210
  return codeArray;
211
- };
211
+ };
212
+
213
+ export const encodeUrlQuery = (pathStr: any) => {
214
+ let newPathStr='';
215
+ if (pathStr.indexOf('#') > -1) {
216
+ let index = pathStr.indexOf('?');
217
+ let str1 = pathStr.substr(0, index+1);
218
+ let str2 = pathStr.substr(index+1, pathStr.length - index -1);
219
+ let queryArr = str2.split('&');
220
+ let newArr = queryArr.map(item => {
221
+ let index = item.indexOf('=');
222
+ let s1 = item.substr(0, index);
223
+ let s2 = item.substr(index+1, item.length - index -1);
224
+ return `${s1}=${encodeURIComponent(s2)}`;
225
+ })
226
+ newPathStr = `${str1}${newArr.join('&')}`;
227
+ } else {
228
+ newPathStr = pathStr;
229
+ }
230
+ return newPathStr;
231
+ }
@@ -119,6 +119,7 @@ class SortableTable extends React.Component<SortTableProps> {
119
119
  let showColumnItem = showColumns.filter((inneritem:any) => ((inneritem.dataIndex && inneritem.dataIndex === item.dataIndex) || (inneritem.key && inneritem.key === item.key)))
120
120
  return {
121
121
  ...item,
122
+ fixed: inner.length ? inner[0]?.fixed : item?.fixed,
122
123
  key: item.key || item.dataIndex,
123
124
  width: showColumnItem[0]?.width || inner[0]?.width || item.width,
124
125
  hidden: columnConfig.length && !inner.length,