@kmkf-fe-packages/basic-components 0.7.15-alpha.57 → 0.7.15-alpha.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
@@ -10143,38 +10143,34 @@ var BsGoods = function BsGoods(props) {
10143
10143
  _useState2 = _slicedToArray(_useState, 2),
10144
10144
  tableSelect = _useState2[0],
10145
10145
  setTableSelect = _useState2[1];
10146
- var _useState3 = useState({
10147
- type: '',
10148
- val: ''
10149
- }),
10146
+ // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10147
+ var _useState3 = useState(''),
10150
10148
  _useState4 = _slicedToArray(_useState3, 2),
10151
- withInfo = _useState4[0],
10152
- setWithInfo = _useState4[1];
10153
- var ref = useRef();
10154
- var reissueRef = useRef();
10149
+ withType = _useState4[0],
10150
+ setWithType = _useState4[1];
10151
+ var _useState5 = useState(''),
10152
+ _useState6 = _slicedToArray(_useState5, 2),
10153
+ withValue = _useState6[0],
10154
+ setWithValue = _useState6[1];
10155
10155
  useEffect(function () {
10156
- ref.current = pubsub.subscribeOnce('type', function (type, val) {
10156
+ pubsub.subscribe('type', function (type, val) {
10157
10157
  if (disabled) return;
10158
- setWithInfo({
10159
- type: type,
10160
- val: val
10161
- });
10158
+ console.log('type', type, val);
10159
+ // setWithInfo({ type, val });
10160
+ setWithType(type);
10161
+ setWithValue(val);
10162
10162
  setTableSelect(['2', '4'].includes(val));
10163
10163
  });
10164
10164
  //补发
10165
- reissueRef.current = pubsub.subscribeOnce('reissueType', function (type, val) {
10165
+ pubsub.subscribe('reissueType', function (type, val) {
10166
10166
  if (disabled) return;
10167
- setWithInfo({
10168
- type: type,
10169
- val: val
10170
- });
10167
+ console.log('reissueType', type, val);
10168
+ // setWithInfo({ type, val });
10169
+ setWithType(type);
10170
+ setWithValue(val);
10171
10171
  setTableSelect(['2', '4'].includes(val));
10172
10172
  });
10173
- return function () {
10174
- pubsub.unsubscribe(ref.current);
10175
- pubsub.unsubscribe(reissueRef.current);
10176
- };
10177
- }, [value, withInfo, disabled]);
10173
+ }, [disabled, withType, withValue, setWithType, setWithValue, setTableSelect]);
10178
10174
  useEffect(function () {
10179
10175
  if (!disabled) {
10180
10176
  pubsub.publish('goodList', {
@@ -10182,17 +10178,19 @@ var BsGoods = function BsGoods(props) {
10182
10178
  });
10183
10179
  }
10184
10180
  }, [value, disabled]);
10185
- var _onSelect = useCallback(function (list) {
10181
+ var onSelect = function onSelect(list) {
10186
10182
  if (disabled) return;
10187
10183
  var newList = cloneDeep(list);
10188
- pubsub.publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10189
- type: withInfo.val,
10184
+ var type = withType === 'reissueType' ? 'reissueSelectList' : 'selectList';
10185
+ console.log(withType, withValue, type);
10186
+ pubsub.publish(type, {
10187
+ type: withValue,
10190
10188
  list: newList.map(function (item) {
10191
10189
  item.canDelete = true;
10192
10190
  return item;
10193
10191
  })
10194
10192
  });
10195
- }, [withInfo]);
10193
+ };
10196
10194
  var _onDelete = function onDelete(item) {
10197
10195
  var deleteId = item === null || item === void 0 ? void 0 : item.sku;
10198
10196
  pubsub.publish('deleteGood', deleteId);
@@ -10210,9 +10208,7 @@ var BsGoods = function BsGoods(props) {
10210
10208
  value: value === null || value === void 0 ? void 0 : value.bsGoods,
10211
10209
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10212
10210
  tableSelect: tableSelect,
10213
- onSelect: function onSelect(list) {
10214
- return _onSelect(list);
10215
- },
10211
+ onSelect: onSelect,
10216
10212
  onDelete: function onDelete(item) {
10217
10213
  return _onDelete(item);
10218
10214
  },
@@ -10261,10 +10257,11 @@ var BsExchange = function BsExchange(props) {
10261
10257
  onChange(newValue);
10262
10258
  }
10263
10259
  });
10264
- pubsub.subscribe('selectList', function (_, data) {
10260
+ pubsub.subscribeOnce('selectList', function (_, data) {
10265
10261
  if (disabled) return;
10266
10262
  if (value) {
10267
10263
  var newData = cloneDeep(data);
10264
+ console.log(getListHandle(_toConsumableArray(newData.list), value));
10268
10265
  onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10269
10266
  bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10270
10267
  }));
@@ -10279,11 +10276,12 @@ var BsExchange = function BsExchange(props) {
10279
10276
  next.canDelete = false;
10280
10277
  //数量大于1 拆开
10281
10278
  if (next.number > 1) {
10282
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10283
- t.money = t.share;
10284
- t.number = 1;
10285
- t.uuid = uuid();
10286
- return t;
10279
+ var newList = Array(next.number).fill({}).map(function () {
10280
+ var newNext = _objectSpread2({}, next);
10281
+ newNext.money = newNext.share;
10282
+ newNext.number = 1;
10283
+ newNext.uuid = uuid();
10284
+ return newNext;
10287
10285
  });
10288
10286
  prv.push.apply(prv, _toConsumableArray(newList));
10289
10287
  } else {
@@ -10298,11 +10296,12 @@ var BsExchange = function BsExchange(props) {
10298
10296
  next.index = index;
10299
10297
  //数量大于1 拆开
10300
10298
  if (next.number > 1) {
10301
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10302
- t.money = t.share;
10303
- t.number = 1;
10304
- t.uuid = uuid();
10305
- return t;
10299
+ var newList = Array(next.number).fill({}).map(function () {
10300
+ var newNext = _objectSpread2({}, next);
10301
+ newNext.money = newNext.share;
10302
+ newNext.number = 1;
10303
+ newNext.uuid = uuid();
10304
+ return newNext;
10306
10305
  });
10307
10306
  prv.push({
10308
10307
  bsExchangeReturnGoods: _toConsumableArray(newList),
@@ -10323,13 +10322,11 @@ var BsExchange = function BsExchange(props) {
10323
10322
  newValue.bsExchangeType = val;
10324
10323
  newValue.bsExchangeReturnGoods = [];
10325
10324
  newValue.bsExchangeGiftGoods = [];
10326
- if (['2', '4'].includes(val[0])) {
10327
- pubsub.publish('type', val[0]);
10328
- } else {
10329
- console.log(bsGoods, value);
10325
+ if (['1', '3'].includes(val[0])) {
10330
10326
  newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10331
10327
  }
10332
10328
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10329
+ pubsub.publish('type', val[0]);
10333
10330
  };
10334
10331
  var changeHandle = function changeHandle(val, key) {
10335
10332
  var newValue = _objectSpread2({}, value);
@@ -10495,9 +10492,7 @@ var BsReissue = function BsReissue(props) {
10495
10492
  newValue[key] = val;
10496
10493
  if (key === 'bsReissueType') {
10497
10494
  newValue.bsReissueGoods = [];
10498
- if (['2', '4'].includes(val[0])) {
10499
- pubsub.publish('reissueType', val[0]);
10500
- } else if (['1', '3'].includes(val[0])) {
10495
+ if (['1', '3'].includes(val[0])) {
10501
10496
  newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10502
10497
  item.money = 0;
10503
10498
  item.share = 0;
@@ -10507,6 +10502,7 @@ var BsReissue = function BsReissue(props) {
10507
10502
  }
10508
10503
  }
10509
10504
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10505
+ pubsub.publish('reissueType', val[0]);
10510
10506
  };
10511
10507
  //显示选择商品按钮 原单换不显示选择商品
10512
10508
  var showChangeBtn = useMemo(function () {
package/dist/index.js CHANGED
@@ -10154,38 +10154,34 @@ var BsGoods = function BsGoods(props) {
10154
10154
  _useState2 = _slicedToArray(_useState, 2),
10155
10155
  tableSelect = _useState2[0],
10156
10156
  setTableSelect = _useState2[1];
10157
- var _useState3 = React.useState({
10158
- type: '',
10159
- val: ''
10160
- }),
10157
+ // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10158
+ var _useState3 = React.useState(''),
10161
10159
  _useState4 = _slicedToArray(_useState3, 2),
10162
- withInfo = _useState4[0],
10163
- setWithInfo = _useState4[1];
10164
- var ref = React.useRef();
10165
- var reissueRef = React.useRef();
10160
+ withType = _useState4[0],
10161
+ setWithType = _useState4[1];
10162
+ var _useState5 = React.useState(''),
10163
+ _useState6 = _slicedToArray(_useState5, 2),
10164
+ withValue = _useState6[0],
10165
+ setWithValue = _useState6[1];
10166
10166
  React.useEffect(function () {
10167
- ref.current = pubsub__default['default'].subscribeOnce('type', function (type, val) {
10167
+ pubsub__default['default'].subscribe('type', function (type, val) {
10168
10168
  if (disabled) return;
10169
- setWithInfo({
10170
- type: type,
10171
- val: val
10172
- });
10169
+ console.log('type', type, val);
10170
+ // setWithInfo({ type, val });
10171
+ setWithType(type);
10172
+ setWithValue(val);
10173
10173
  setTableSelect(['2', '4'].includes(val));
10174
10174
  });
10175
10175
  //补发
10176
- reissueRef.current = pubsub__default['default'].subscribeOnce('reissueType', function (type, val) {
10176
+ pubsub__default['default'].subscribe('reissueType', function (type, val) {
10177
10177
  if (disabled) return;
10178
- setWithInfo({
10179
- type: type,
10180
- val: val
10181
- });
10178
+ console.log('reissueType', type, val);
10179
+ // setWithInfo({ type, val });
10180
+ setWithType(type);
10181
+ setWithValue(val);
10182
10182
  setTableSelect(['2', '4'].includes(val));
10183
10183
  });
10184
- return function () {
10185
- pubsub__default['default'].unsubscribe(ref.current);
10186
- pubsub__default['default'].unsubscribe(reissueRef.current);
10187
- };
10188
- }, [value, withInfo, disabled]);
10184
+ }, [disabled, withType, withValue, setWithType, setWithValue, setTableSelect]);
10189
10185
  React.useEffect(function () {
10190
10186
  if (!disabled) {
10191
10187
  pubsub__default['default'].publish('goodList', {
@@ -10193,17 +10189,19 @@ var BsGoods = function BsGoods(props) {
10193
10189
  });
10194
10190
  }
10195
10191
  }, [value, disabled]);
10196
- var _onSelect = React.useCallback(function (list) {
10192
+ var onSelect = function onSelect(list) {
10197
10193
  if (disabled) return;
10198
10194
  var newList = lodash.cloneDeep(list);
10199
- pubsub__default['default'].publish(withInfo.type === 'reissueType' ? 'reissueSelectList' : 'selectList', {
10200
- type: withInfo.val,
10195
+ var type = withType === 'reissueType' ? 'reissueSelectList' : 'selectList';
10196
+ console.log(withType, withValue, type);
10197
+ pubsub__default['default'].publish(type, {
10198
+ type: withValue,
10201
10199
  list: newList.map(function (item) {
10202
10200
  item.canDelete = true;
10203
10201
  return item;
10204
10202
  })
10205
10203
  });
10206
- }, [withInfo]);
10204
+ };
10207
10205
  var _onDelete = function onDelete(item) {
10208
10206
  var deleteId = item === null || item === void 0 ? void 0 : item.sku;
10209
10207
  pubsub__default['default'].publish('deleteGood', deleteId);
@@ -10221,9 +10219,7 @@ var BsGoods = function BsGoods(props) {
10221
10219
  value: value === null || value === void 0 ? void 0 : value.bsGoods,
10222
10220
  shopCode: value === null || value === void 0 ? void 0 : value.shopCode,
10223
10221
  tableSelect: tableSelect,
10224
- onSelect: function onSelect(list) {
10225
- return _onSelect(list);
10226
- },
10222
+ onSelect: onSelect,
10227
10223
  onDelete: function onDelete(item) {
10228
10224
  return _onDelete(item);
10229
10225
  },
@@ -10272,10 +10268,11 @@ var BsExchange = function BsExchange(props) {
10272
10268
  onChange(newValue);
10273
10269
  }
10274
10270
  });
10275
- pubsub__default['default'].subscribe('selectList', function (_, data) {
10271
+ pubsub__default['default'].subscribeOnce('selectList', function (_, data) {
10276
10272
  if (disabled) return;
10277
10273
  if (value) {
10278
10274
  var newData = lodash.cloneDeep(data);
10275
+ console.log(getListHandle(_toConsumableArray(newData.list), value));
10279
10276
  onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10280
10277
  bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10281
10278
  }));
@@ -10290,11 +10287,12 @@ var BsExchange = function BsExchange(props) {
10290
10287
  next.canDelete = false;
10291
10288
  //数量大于1 拆开
10292
10289
  if (next.number > 1) {
10293
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10294
- t.money = t.share;
10295
- t.number = 1;
10296
- t.uuid = kmkfUtils.uuid();
10297
- return t;
10290
+ var newList = Array(next.number).fill({}).map(function () {
10291
+ var newNext = _objectSpread2({}, next);
10292
+ newNext.money = newNext.share;
10293
+ newNext.number = 1;
10294
+ newNext.uuid = kmkfUtils.uuid();
10295
+ return newNext;
10298
10296
  });
10299
10297
  prv.push.apply(prv, _toConsumableArray(newList));
10300
10298
  } else {
@@ -10309,11 +10307,12 @@ var BsExchange = function BsExchange(props) {
10309
10307
  next.index = index;
10310
10308
  //数量大于1 拆开
10311
10309
  if (next.number > 1) {
10312
- var newList = Array(next.number).fill(_objectSpread2({}, next)).map(function (t) {
10313
- t.money = t.share;
10314
- t.number = 1;
10315
- t.uuid = kmkfUtils.uuid();
10316
- return t;
10310
+ var newList = Array(next.number).fill({}).map(function () {
10311
+ var newNext = _objectSpread2({}, next);
10312
+ newNext.money = newNext.share;
10313
+ newNext.number = 1;
10314
+ newNext.uuid = kmkfUtils.uuid();
10315
+ return newNext;
10317
10316
  });
10318
10317
  prv.push({
10319
10318
  bsExchangeReturnGoods: _toConsumableArray(newList),
@@ -10334,13 +10333,11 @@ var BsExchange = function BsExchange(props) {
10334
10333
  newValue.bsExchangeType = val;
10335
10334
  newValue.bsExchangeReturnGoods = [];
10336
10335
  newValue.bsExchangeGiftGoods = [];
10337
- if (['2', '4'].includes(val[0])) {
10338
- pubsub__default['default'].publish('type', val[0]);
10339
- } else {
10340
- console.log(bsGoods, value);
10336
+ if (['1', '3'].includes(val[0])) {
10341
10337
  newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10342
10338
  }
10343
10339
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10340
+ pubsub__default['default'].publish('type', val[0]);
10344
10341
  };
10345
10342
  var changeHandle = function changeHandle(val, key) {
10346
10343
  var newValue = _objectSpread2({}, value);
@@ -10506,9 +10503,7 @@ var BsReissue = function BsReissue(props) {
10506
10503
  newValue[key] = val;
10507
10504
  if (key === 'bsReissueType') {
10508
10505
  newValue.bsReissueGoods = [];
10509
- if (['2', '4'].includes(val[0])) {
10510
- pubsub__default['default'].publish('reissueType', val[0]);
10511
- } else if (['1', '3'].includes(val[0])) {
10506
+ if (['1', '3'].includes(val[0])) {
10512
10507
  newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10513
10508
  item.money = 0;
10514
10509
  item.share = 0;
@@ -10518,6 +10513,7 @@ var BsReissue = function BsReissue(props) {
10518
10513
  }
10519
10514
  }
10520
10515
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10516
+ pubsub__default['default'].publish('reissueType', val[0]);
10521
10517
  };
10522
10518
  //显示选择商品按钮 原单换不显示选择商品
10523
10519
  var showChangeBtn = React.useMemo(function () {
@@ -10,7 +10,8 @@ interface BsGoodsProps {
10
10
  shopId: string | number;
11
11
  maxLength: number;
12
12
  showChangeBtn: boolean;
13
- tableSelect: boolean;
13
+ tableSelect?: boolean;
14
+ selectType?: string;
14
15
  otherOperations: any;
15
16
  canUpdateNumber: boolean;
16
17
  shopCode: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.7.15-alpha.57",
3
+ "version": "0.7.15-alpha.59",
4
4
  "description": "> TODO: description",
5
5
  "homepage": "",
6
6
  "license": "ISC",
@@ -20,7 +20,7 @@
20
20
  "watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
21
21
  },
22
22
  "dependencies": {
23
- "@kmkf-fe-packages/kmkf-utils": "^0.7.15-alpha.57",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.15-alpha.59",
24
24
  "lodash": "^4.17.21",
25
25
  "pubsub-js": "^1.9.4",
26
26
  "umi-request": "^1.4.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "f99147791d4b1ab930c7fbc4a401cd9ce49a19e2"
61
+ "gitHead": "ef98dc4d8d95dde163615b0127589766b2d0f36a"
62
62
  }