@kmkf-fe-packages/basic-components 2.0.19-beta.57 → 2.0.19-beta.59

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/dist/index.esm.js CHANGED
@@ -16005,11 +16005,12 @@ var BsGoods = function BsGoods(props) {
16005
16005
  setTableSelect = _useState2[1];
16006
16006
  var withInfo = useRef(null);
16007
16007
  var valueRef = useRef(null);
16008
+ var tokens = useRef([]);
16008
16009
  useEffect(function () {
16009
16010
  valueRef.current = value;
16010
16011
  }, [value]);
16011
16012
  useEffect(function () {
16012
- pubsub.subscribe('type', function (type, data) {
16013
+ tokens.current = [pubsub.subscribe('type', function (type, data) {
16013
16014
  if (disabled) return;
16014
16015
  // console.log(type, data);
16015
16016
  withInfo.current = {
@@ -16026,9 +16027,7 @@ var BsGoods = function BsGoods(props) {
16026
16027
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16027
16028
  });
16028
16029
  }
16029
- });
16030
- //补发
16031
- pubsub.subscribe('reissueType', function (type, data) {
16030
+ }), pubsub.subscribe('reissueType', function (type, data) {
16032
16031
  if (disabled) return;
16033
16032
  withInfo.current = {
16034
16033
  type: type,
@@ -16048,9 +16047,7 @@ var BsGoods = function BsGoods(props) {
16048
16047
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16049
16048
  });
16050
16049
  }
16051
- });
16052
- //退货
16053
- pubsub.subscribe('returnType', function (type, data) {
16050
+ }), pubsub.subscribe('returnType', function (type, data) {
16054
16051
  if (disabled) return;
16055
16052
  withInfo.current = {
16056
16053
  type: type,
@@ -16066,15 +16063,18 @@ var BsGoods = function BsGoods(props) {
16066
16063
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16067
16064
  });
16068
16065
  }
16069
- });
16070
- pubsub.subscribeOnce('changeShopCode', function (type, data) {
16066
+ }), pubsub.subscribeOnce('changeShopCode', function (type, data) {
16071
16067
  // console.log(data);
16072
16068
  onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
16073
16069
  shopCode: data.shopCode
16074
16070
  }));
16075
- });
16071
+ })];
16076
16072
  return function () {
16077
- pubsub.clearAllSubscriptions();
16073
+ // 清除当前组件所有订阅
16074
+ tokens.current.forEach(function (token) {
16075
+ return pubsub.unsubscribe(token);
16076
+ });
16077
+ tokens.current = [];
16078
16078
  };
16079
16079
  }, [disabled]);
16080
16080
  var _onSelect = function onSelect(list) {
@@ -17316,6 +17316,7 @@ var CommonGoods = function CommonGoods(props) {
17316
17316
  setTableSelect = _useState2[1];
17317
17317
  var withInfo = useRef(null);
17318
17318
  var valueRef = useRef(null);
17319
+ var tokens = useRef([]);
17319
17320
  useEffect(function () {
17320
17321
  var _value$orders;
17321
17322
  valueRef.current = value;
@@ -17349,7 +17350,7 @@ var CommonGoods = function CommonGoods(props) {
17349
17350
  };
17350
17351
  }();
17351
17352
  useEffect(function () {
17352
- pubsub.subscribe(componentMap$1[compType].eventNameMap.type, function (type, data) {
17353
+ tokens.current = [pubsub.subscribe(componentMap$1[compType].eventNameMap.type, function (type, data) {
17353
17354
  if (disabled) return;
17354
17355
  // console.log(type, data);
17355
17356
  withInfo.current = {
@@ -17366,9 +17367,7 @@ var CommonGoods = function CommonGoods(props) {
17366
17367
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17367
17368
  });
17368
17369
  }
17369
- });
17370
- //补发
17371
- pubsub.subscribe(componentMap$1[compType].eventNameMap.reissueType, function (type, data) {
17370
+ }), pubsub.subscribe(componentMap$1[compType].eventNameMap.reissueType, function (type, data) {
17372
17371
  if (disabled) return;
17373
17372
  withInfo.current = {
17374
17373
  type: type,
@@ -17384,9 +17383,7 @@ var CommonGoods = function CommonGoods(props) {
17384
17383
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17385
17384
  });
17386
17385
  }
17387
- });
17388
- //退货
17389
- pubsub.subscribe(componentMap$1[compType].eventNameMap.returnType, function (type, data) {
17386
+ }), pubsub.subscribe(componentMap$1[compType].eventNameMap.returnType, function (type, data) {
17390
17387
  if (disabled) return;
17391
17388
  withInfo.current = {
17392
17389
  type: type,
@@ -17402,15 +17399,18 @@ var CommonGoods = function CommonGoods(props) {
17402
17399
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17403
17400
  });
17404
17401
  }
17405
- });
17406
- pubsub.subscribeOnce(componentMap$1[compType].eventNameMap.changeShopCode, function (type, data) {
17402
+ }), pubsub.subscribeOnce(componentMap$1[compType].eventNameMap.changeShopCode, function (type, data) {
17407
17403
  // console.log(data);
17408
17404
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
17409
17405
  shopCode: data.shopCode
17410
17406
  }));
17411
- });
17407
+ })];
17412
17408
  return function () {
17413
- pubsub.clearAllSubscriptions();
17409
+ // 清除当前组件所有订阅
17410
+ tokens.current.forEach(function (token) {
17411
+ return pubsub.unsubscribe(token);
17412
+ });
17413
+ tokens.current = [];
17414
17414
  };
17415
17415
  }, [disabled]);
17416
17416
  var _onSelect = function onSelect(list) {
package/dist/index.js CHANGED
@@ -16017,11 +16017,12 @@ var BsGoods = function BsGoods(props) {
16017
16017
  setTableSelect = _useState2[1];
16018
16018
  var withInfo = React.useRef(null);
16019
16019
  var valueRef = React.useRef(null);
16020
+ var tokens = React.useRef([]);
16020
16021
  React.useEffect(function () {
16021
16022
  valueRef.current = value;
16022
16023
  }, [value]);
16023
16024
  React.useEffect(function () {
16024
- pubsub__default['default'].subscribe('type', function (type, data) {
16025
+ tokens.current = [pubsub__default['default'].subscribe('type', function (type, data) {
16025
16026
  if (disabled) return;
16026
16027
  // console.log(type, data);
16027
16028
  withInfo.current = {
@@ -16038,9 +16039,7 @@ var BsGoods = function BsGoods(props) {
16038
16039
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16039
16040
  });
16040
16041
  }
16041
- });
16042
- //补发
16043
- pubsub__default['default'].subscribe('reissueType', function (type, data) {
16042
+ }), pubsub__default['default'].subscribe('reissueType', function (type, data) {
16044
16043
  if (disabled) return;
16045
16044
  withInfo.current = {
16046
16045
  type: type,
@@ -16060,9 +16059,7 @@ var BsGoods = function BsGoods(props) {
16060
16059
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16061
16060
  });
16062
16061
  }
16063
- });
16064
- //退货
16065
- pubsub__default['default'].subscribe('returnType', function (type, data) {
16062
+ }), pubsub__default['default'].subscribe('returnType', function (type, data) {
16066
16063
  if (disabled) return;
16067
16064
  withInfo.current = {
16068
16065
  type: type,
@@ -16078,15 +16075,18 @@ var BsGoods = function BsGoods(props) {
16078
16075
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
16079
16076
  });
16080
16077
  }
16081
- });
16082
- pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
16078
+ }), pubsub__default['default'].subscribeOnce('changeShopCode', function (type, data) {
16083
16079
  // console.log(data);
16084
16080
  onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
16085
16081
  shopCode: data.shopCode
16086
16082
  }));
16087
- });
16083
+ })];
16088
16084
  return function () {
16089
- pubsub__default['default'].clearAllSubscriptions();
16085
+ // 清除当前组件所有订阅
16086
+ tokens.current.forEach(function (token) {
16087
+ return pubsub__default['default'].unsubscribe(token);
16088
+ });
16089
+ tokens.current = [];
16090
16090
  };
16091
16091
  }, [disabled]);
16092
16092
  var _onSelect = function onSelect(list) {
@@ -17328,6 +17328,7 @@ var CommonGoods = function CommonGoods(props) {
17328
17328
  setTableSelect = _useState2[1];
17329
17329
  var withInfo = React.useRef(null);
17330
17330
  var valueRef = React.useRef(null);
17331
+ var tokens = React.useRef([]);
17331
17332
  React.useEffect(function () {
17332
17333
  var _value$orders;
17333
17334
  valueRef.current = value;
@@ -17361,7 +17362,7 @@ var CommonGoods = function CommonGoods(props) {
17361
17362
  };
17362
17363
  }();
17363
17364
  React.useEffect(function () {
17364
- pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.type, function (type, data) {
17365
+ tokens.current = [pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.type, function (type, data) {
17365
17366
  if (disabled) return;
17366
17367
  // console.log(type, data);
17367
17368
  withInfo.current = {
@@ -17378,9 +17379,7 @@ var CommonGoods = function CommonGoods(props) {
17378
17379
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17379
17380
  });
17380
17381
  }
17381
- });
17382
- //补发
17383
- pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.reissueType, function (type, data) {
17382
+ }), pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.reissueType, function (type, data) {
17384
17383
  if (disabled) return;
17385
17384
  withInfo.current = {
17386
17385
  type: type,
@@ -17396,9 +17395,7 @@ var CommonGoods = function CommonGoods(props) {
17396
17395
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17397
17396
  });
17398
17397
  }
17399
- });
17400
- //退货
17401
- pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.returnType, function (type, data) {
17398
+ }), pubsub__default['default'].subscribe(componentMap$1[compType].eventNameMap.returnType, function (type, data) {
17402
17399
  if (disabled) return;
17403
17400
  withInfo.current = {
17404
17401
  type: type,
@@ -17414,15 +17411,18 @@ var CommonGoods = function CommonGoods(props) {
17414
17411
  goodValue: data === null || data === void 0 ? void 0 : data.goodValue
17415
17412
  });
17416
17413
  }
17417
- });
17418
- pubsub__default['default'].subscribeOnce(componentMap$1[compType].eventNameMap.changeShopCode, function (type, data) {
17414
+ }), pubsub__default['default'].subscribeOnce(componentMap$1[compType].eventNameMap.changeShopCode, function (type, data) {
17419
17415
  // console.log(data);
17420
17416
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2(_objectSpread2({}, valueRef === null || valueRef === void 0 ? void 0 : valueRef.current), {}, {
17421
17417
  shopCode: data.shopCode
17422
17418
  }));
17423
- });
17419
+ })];
17424
17420
  return function () {
17425
- pubsub__default['default'].clearAllSubscriptions();
17421
+ // 清除当前组件所有订阅
17422
+ tokens.current.forEach(function (token) {
17423
+ return pubsub__default['default'].unsubscribe(token);
17424
+ });
17425
+ tokens.current = [];
17426
17426
  };
17427
17427
  }, [disabled]);
17428
17428
  var _onSelect = function onSelect(list) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "2.0.19-beta.57",
3
+ "version": "2.0.19-beta.59",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "920a9949d8a22b607bfec6bba8c1692f0a7966f9"
68
+ "gitHead": "d53f9a80719ce775726f8658e138ab311ea3312f"
69
69
  }