@kmkf-fe-packages/basic-components 0.7.15-alpha.65 → 0.7.15-alpha.69

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
@@ -9473,7 +9473,12 @@ var jstGoods = function jstGoods(props) {
9473
9473
  setChangeIndex(0);
9474
9474
  }, []);
9475
9475
  var content = function content(item, index) {
9476
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
9476
+ return /*#__PURE__*/React.createElement("div", {
9477
+ style: {
9478
+ maxHeight: '300px',
9479
+ overflowY: 'auto'
9480
+ }
9481
+ }, /*#__PURE__*/React.createElement("div", {
9477
9482
  style: {
9478
9483
  textAlign: 'center'
9479
9484
  }
@@ -10156,38 +10161,45 @@ var BsGoods = function BsGoods(props) {
10156
10161
  _useState2 = _slicedToArray(_useState, 2),
10157
10162
  tableSelect = _useState2[0],
10158
10163
  setTableSelect = _useState2[1];
10159
- // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10160
- // const [withType, setWithType] = useState('');
10161
- // const [withValue, setWithValue] = useState('');
10162
10164
  var withInfo = useRef(null);
10165
+ var valueRef = useRef(null);
10163
10166
  useEffect(function () {
10167
+ valueRef.current = value;
10164
10168
  pubsub.subscribe('type', function (type, val) {
10165
10169
  if (disabled) return;
10166
- console.log('type', type, val);
10167
10170
  withInfo.current = {
10168
10171
  type: type,
10169
10172
  val: val
10170
10173
  };
10171
10174
  setTableSelect(['2', '4'].includes(val));
10175
+ if (['1', '3'].includes(val)) {
10176
+ pubsub.publish('selectList', {
10177
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10178
+ });
10179
+ }
10172
10180
  });
10173
10181
  //补发
10174
10182
  pubsub.subscribe('reissueType', function (type, val) {
10175
10183
  if (disabled) return;
10176
- console.log('reissueType', type, val);
10177
10184
  withInfo.current = {
10178
10185
  type: type,
10179
10186
  val: val
10180
10187
  };
10181
10188
  setTableSelect(['2', '4'].includes(val));
10189
+ if (['1', '3'].includes(val)) {
10190
+ pubsub.publish('reissueSelectList', {
10191
+ list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10192
+ });
10193
+ }
10182
10194
  });
10183
- }, [disabled]);
10184
- useEffect(function () {
10185
- if (!disabled) {
10186
- pubsub.publish('goodList', {
10187
- list: cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10188
- });
10189
- }
10190
- }, [value, disabled]);
10195
+ }, [disabled, value]);
10196
+ // useEffect(() => {
10197
+ // if (!disabled) {
10198
+ // pubsub.publish('goodList', {
10199
+ // list: cloneDeep(value?.bsGoods || []),
10200
+ // });
10201
+ // }
10202
+ // }, [value, disabled]);
10191
10203
  var _onSelect = function onSelect(list) {
10192
10204
  var _withInfo$current, _withInfo$current2;
10193
10205
  if (disabled) return;
@@ -10244,12 +10256,14 @@ var BsExchange = function BsExchange(props) {
10244
10256
  _useState2 = _slicedToArray(_useState, 2),
10245
10257
  bsGoods = _useState2[0],
10246
10258
  setBsGoods = _useState2[1];
10259
+ var valueRef = useRef({});
10260
+ // useEffect(() => {
10261
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10262
+ // setBsGoods(data.list);
10263
+ // });
10264
+ // }, []);
10247
10265
  useEffect(function () {
10248
- pubsub.subscribe('goodList', function (_, data) {
10249
- setBsGoods(data.list);
10250
- });
10251
- }, []);
10252
- useEffect(function () {
10266
+ valueRef.current = value;
10253
10267
  pubsub.subscribeOnce('deleteGood', function (_, data) {
10254
10268
  if (disabled) return;
10255
10269
  if (value) {
@@ -10270,17 +10284,29 @@ var BsExchange = function BsExchange(props) {
10270
10284
  onChange(newValue);
10271
10285
  }
10272
10286
  });
10273
- pubsub.subscribeOnce('selectList', function (_, data) {
10287
+ // pubsub.subscribeOnce('selectList', (_: any, data: any) => {
10288
+ // if (disabled) return;
10289
+ // if (value) {
10290
+ // const newData = cloneDeep(data);
10291
+ // onChange({
10292
+ // ...value,
10293
+ // bsExchangeReturnGoods: getListHandle([...newData.list], value),
10294
+ // });
10295
+ // }
10296
+ // });
10297
+ }, [value]);
10298
+ useEffect(function () {
10299
+ pubsub.subscribe('selectList', function (_, data) {
10274
10300
  if (disabled) return;
10275
- if (value) {
10276
- var newData = cloneDeep(data);
10277
- console.log(getListHandle(_toConsumableArray(newData.list), value));
10278
- onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10279
- bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10301
+ // console.log('selectList', valueRef.current, data);
10302
+ if (valueRef.current) {
10303
+ var newDataList = cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10304
+ onChange(_objectSpread2(_objectSpread2({}, valueRef.current), {}, {
10305
+ bsExchangeReturnGoods: getListHandle(newDataList, valueRef.current)
10280
10306
  }));
10281
10307
  }
10282
10308
  });
10283
- }, [value]);
10309
+ }, []);
10284
10310
  var getListHandle = function getListHandle(list, val) {
10285
10311
  var _val$bsExchangeType, _val$bsExchangeType2;
10286
10312
  //如果是原单换
@@ -10335,9 +10361,9 @@ var BsExchange = function BsExchange(props) {
10335
10361
  newValue.bsExchangeType = val;
10336
10362
  newValue.bsExchangeReturnGoods = [];
10337
10363
  newValue.bsExchangeGiftGoods = [];
10338
- if (['1', '3'].includes(val[0])) {
10339
- newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10340
- }
10364
+ // if (['1', '3'].includes(val[0])) {
10365
+ // newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10366
+ // }
10341
10367
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10342
10368
  pubsub.publish('type', val[0]);
10343
10369
  };
@@ -10463,12 +10489,29 @@ var BsReissue = function BsReissue(props) {
10463
10489
  _useState2 = _slicedToArray(_useState, 2),
10464
10490
  bsGoods = _useState2[0],
10465
10491
  setBsGoods = _useState2[1];
10492
+ var valueRef = useRef({});
10493
+ // useEffect(() => {
10494
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10495
+ // setBsGoods(data.list);
10496
+ // });
10497
+ // }, []);
10466
10498
  useEffect(function () {
10467
- pubsub.subscribe('goodList', function (_, data) {
10468
- setBsGoods(data.list);
10499
+ pubsub.subscribe('reissueSelectList', function (_, data) {
10500
+ if (disabled) return;
10501
+ if (valueRef.current) {
10502
+ var newValue = _objectSpread2({}, valueRef.current);
10503
+ newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10504
+ item.money = 0;
10505
+ item.share = 0;
10506
+ item.canUpdateNumber = true;
10507
+ return item;
10508
+ });
10509
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10510
+ }
10469
10511
  });
10470
10512
  }, []);
10471
10513
  useEffect(function () {
10514
+ valueRef.current = value;
10472
10515
  pubsub.subscribeOnce('reissueDeleteGood', function (_, data) {
10473
10516
  if (disabled) return;
10474
10517
  if (value) {
@@ -10479,19 +10522,19 @@ var BsReissue = function BsReissue(props) {
10479
10522
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10480
10523
  }
10481
10524
  });
10482
- pubsub.subscribeOnce('reissueSelectList', function (_, data) {
10483
- if (disabled) return;
10484
- if (value) {
10485
- var newValue = _objectSpread2({}, value);
10486
- newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10487
- item.money = 0;
10488
- item.share = 0;
10489
- item.canUpdateNumber = true;
10490
- return item;
10491
- });
10492
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10493
- }
10494
- });
10525
+ // pubsub.subscribeOnce('reissueSelectList', (_: any, data: any) => {
10526
+ // if (disabled) return;
10527
+ // if (value) {
10528
+ // const newValue = { ...value };
10529
+ // newValue.bsReissueGoods = data?.list.map((item: any) => {
10530
+ // item.money = 0;
10531
+ // item.share = 0;
10532
+ // item.canUpdateNumber = true;
10533
+ // return item;
10534
+ // });
10535
+ // onChange?.(newValue);
10536
+ // }
10537
+ // });
10495
10538
  }, [value, disabled]);
10496
10539
  var changeHandle = function changeHandle(val, key) {
10497
10540
  var newValue = _objectSpread2({}, value);
@@ -10503,17 +10546,17 @@ var BsReissue = function BsReissue(props) {
10503
10546
  });
10504
10547
  }
10505
10548
  newValue[key] = val;
10506
- if (key === 'bsReissueType') {
10507
- newValue.bsReissueGoods = [];
10508
- if (['1', '3'].includes(val[0])) {
10509
- newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10510
- item.money = 0;
10511
- item.share = 0;
10512
- item.canUpdateNumber = false;
10513
- return item;
10514
- });
10515
- }
10516
- }
10549
+ // if (key === 'bsReissueType') {
10550
+ // newValue.bsReissueGoods = [];
10551
+ // if (['1', '3'].includes(val[0])) {
10552
+ // newValue.bsReissueGoods = (bsGoods || []).map((item: any) => {
10553
+ // item.money = 0;
10554
+ // item.share = 0;
10555
+ // item.canUpdateNumber = false;
10556
+ // return item;
10557
+ // });
10558
+ // }
10559
+ // }
10517
10560
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10518
10561
  pubsub.publish('reissueType', val[0]);
10519
10562
  };
package/dist/index.js CHANGED
@@ -9484,7 +9484,12 @@ var jstGoods = function jstGoods(props) {
9484
9484
  setChangeIndex(0);
9485
9485
  }, []);
9486
9486
  var content = function content(item, index) {
9487
- return /*#__PURE__*/React__default['default'].createElement("div", null, /*#__PURE__*/React__default['default'].createElement("div", {
9487
+ return /*#__PURE__*/React__default['default'].createElement("div", {
9488
+ style: {
9489
+ maxHeight: '300px',
9490
+ overflowY: 'auto'
9491
+ }
9492
+ }, /*#__PURE__*/React__default['default'].createElement("div", {
9488
9493
  style: {
9489
9494
  textAlign: 'center'
9490
9495
  }
@@ -10167,38 +10172,45 @@ var BsGoods = function BsGoods(props) {
10167
10172
  _useState2 = _slicedToArray(_useState, 2),
10168
10173
  tableSelect = _useState2[0],
10169
10174
  setTableSelect = _useState2[1];
10170
- // const [withInfo, setWithInfo] = useState({ type: '', val: '' });
10171
- // const [withType, setWithType] = useState('');
10172
- // const [withValue, setWithValue] = useState('');
10173
10175
  var withInfo = React.useRef(null);
10176
+ var valueRef = React.useRef(null);
10174
10177
  React.useEffect(function () {
10178
+ valueRef.current = value;
10175
10179
  pubsub__default['default'].subscribe('type', function (type, val) {
10176
10180
  if (disabled) return;
10177
- console.log('type', type, val);
10178
10181
  withInfo.current = {
10179
10182
  type: type,
10180
10183
  val: val
10181
10184
  };
10182
10185
  setTableSelect(['2', '4'].includes(val));
10186
+ if (['1', '3'].includes(val)) {
10187
+ pubsub__default['default'].publish('selectList', {
10188
+ list: lodash.cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10189
+ });
10190
+ }
10183
10191
  });
10184
10192
  //补发
10185
10193
  pubsub__default['default'].subscribe('reissueType', function (type, val) {
10186
10194
  if (disabled) return;
10187
- console.log('reissueType', type, val);
10188
10195
  withInfo.current = {
10189
10196
  type: type,
10190
10197
  val: val
10191
10198
  };
10192
10199
  setTableSelect(['2', '4'].includes(val));
10200
+ if (['1', '3'].includes(val)) {
10201
+ pubsub__default['default'].publish('reissueSelectList', {
10202
+ list: lodash.cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10203
+ });
10204
+ }
10193
10205
  });
10194
- }, [disabled]);
10195
- React.useEffect(function () {
10196
- if (!disabled) {
10197
- pubsub__default['default'].publish('goodList', {
10198
- list: lodash.cloneDeep((value === null || value === void 0 ? void 0 : value.bsGoods) || [])
10199
- });
10200
- }
10201
- }, [value, disabled]);
10206
+ }, [disabled, value]);
10207
+ // useEffect(() => {
10208
+ // if (!disabled) {
10209
+ // pubsub.publish('goodList', {
10210
+ // list: cloneDeep(value?.bsGoods || []),
10211
+ // });
10212
+ // }
10213
+ // }, [value, disabled]);
10202
10214
  var _onSelect = function onSelect(list) {
10203
10215
  var _withInfo$current, _withInfo$current2;
10204
10216
  if (disabled) return;
@@ -10255,12 +10267,14 @@ var BsExchange = function BsExchange(props) {
10255
10267
  _useState2 = _slicedToArray(_useState, 2),
10256
10268
  bsGoods = _useState2[0],
10257
10269
  setBsGoods = _useState2[1];
10270
+ var valueRef = React.useRef({});
10271
+ // useEffect(() => {
10272
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10273
+ // setBsGoods(data.list);
10274
+ // });
10275
+ // }, []);
10258
10276
  React.useEffect(function () {
10259
- pubsub__default['default'].subscribe('goodList', function (_, data) {
10260
- setBsGoods(data.list);
10261
- });
10262
- }, []);
10263
- React.useEffect(function () {
10277
+ valueRef.current = value;
10264
10278
  pubsub__default['default'].subscribeOnce('deleteGood', function (_, data) {
10265
10279
  if (disabled) return;
10266
10280
  if (value) {
@@ -10281,17 +10295,29 @@ var BsExchange = function BsExchange(props) {
10281
10295
  onChange(newValue);
10282
10296
  }
10283
10297
  });
10284
- pubsub__default['default'].subscribeOnce('selectList', function (_, data) {
10298
+ // pubsub.subscribeOnce('selectList', (_: any, data: any) => {
10299
+ // if (disabled) return;
10300
+ // if (value) {
10301
+ // const newData = cloneDeep(data);
10302
+ // onChange({
10303
+ // ...value,
10304
+ // bsExchangeReturnGoods: getListHandle([...newData.list], value),
10305
+ // });
10306
+ // }
10307
+ // });
10308
+ }, [value]);
10309
+ React.useEffect(function () {
10310
+ pubsub__default['default'].subscribe('selectList', function (_, data) {
10285
10311
  if (disabled) return;
10286
- if (value) {
10287
- var newData = lodash.cloneDeep(data);
10288
- console.log(getListHandle(_toConsumableArray(newData.list), value));
10289
- onChange(_objectSpread2(_objectSpread2({}, value), {}, {
10290
- bsExchangeReturnGoods: getListHandle(_toConsumableArray(newData.list), value)
10312
+ // console.log('selectList', valueRef.current, data);
10313
+ if (valueRef.current) {
10314
+ var newDataList = lodash.cloneDeep((data === null || data === void 0 ? void 0 : data.list) || []);
10315
+ onChange(_objectSpread2(_objectSpread2({}, valueRef.current), {}, {
10316
+ bsExchangeReturnGoods: getListHandle(newDataList, valueRef.current)
10291
10317
  }));
10292
10318
  }
10293
10319
  });
10294
- }, [value]);
10320
+ }, []);
10295
10321
  var getListHandle = function getListHandle(list, val) {
10296
10322
  var _val$bsExchangeType, _val$bsExchangeType2;
10297
10323
  //如果是原单换
@@ -10346,9 +10372,9 @@ var BsExchange = function BsExchange(props) {
10346
10372
  newValue.bsExchangeType = val;
10347
10373
  newValue.bsExchangeReturnGoods = [];
10348
10374
  newValue.bsExchangeGiftGoods = [];
10349
- if (['1', '3'].includes(val[0])) {
10350
- newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10351
- }
10375
+ // if (['1', '3'].includes(val[0])) {
10376
+ // newValue.bsExchangeReturnGoods = getListHandle(bsGoods, newValue);
10377
+ // }
10352
10378
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10353
10379
  pubsub__default['default'].publish('type', val[0]);
10354
10380
  };
@@ -10474,12 +10500,29 @@ var BsReissue = function BsReissue(props) {
10474
10500
  _useState2 = _slicedToArray(_useState, 2),
10475
10501
  bsGoods = _useState2[0],
10476
10502
  setBsGoods = _useState2[1];
10503
+ var valueRef = React.useRef({});
10504
+ // useEffect(() => {
10505
+ // pubsub.subscribe('goodList', (_: any, data: any) => {
10506
+ // setBsGoods(data.list);
10507
+ // });
10508
+ // }, []);
10477
10509
  React.useEffect(function () {
10478
- pubsub__default['default'].subscribe('goodList', function (_, data) {
10479
- setBsGoods(data.list);
10510
+ pubsub__default['default'].subscribe('reissueSelectList', function (_, data) {
10511
+ if (disabled) return;
10512
+ if (valueRef.current) {
10513
+ var newValue = _objectSpread2({}, valueRef.current);
10514
+ newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10515
+ item.money = 0;
10516
+ item.share = 0;
10517
+ item.canUpdateNumber = true;
10518
+ return item;
10519
+ });
10520
+ onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10521
+ }
10480
10522
  });
10481
10523
  }, []);
10482
10524
  React.useEffect(function () {
10525
+ valueRef.current = value;
10483
10526
  pubsub__default['default'].subscribeOnce('reissueDeleteGood', function (_, data) {
10484
10527
  if (disabled) return;
10485
10528
  if (value) {
@@ -10490,19 +10533,19 @@ var BsReissue = function BsReissue(props) {
10490
10533
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10491
10534
  }
10492
10535
  });
10493
- pubsub__default['default'].subscribeOnce('reissueSelectList', function (_, data) {
10494
- if (disabled) return;
10495
- if (value) {
10496
- var newValue = _objectSpread2({}, value);
10497
- newValue.bsReissueGoods = data === null || data === void 0 ? void 0 : data.list.map(function (item) {
10498
- item.money = 0;
10499
- item.share = 0;
10500
- item.canUpdateNumber = true;
10501
- return item;
10502
- });
10503
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
10504
- }
10505
- });
10536
+ // pubsub.subscribeOnce('reissueSelectList', (_: any, data: any) => {
10537
+ // if (disabled) return;
10538
+ // if (value) {
10539
+ // const newValue = { ...value };
10540
+ // newValue.bsReissueGoods = data?.list.map((item: any) => {
10541
+ // item.money = 0;
10542
+ // item.share = 0;
10543
+ // item.canUpdateNumber = true;
10544
+ // return item;
10545
+ // });
10546
+ // onChange?.(newValue);
10547
+ // }
10548
+ // });
10506
10549
  }, [value, disabled]);
10507
10550
  var changeHandle = function changeHandle(val, key) {
10508
10551
  var newValue = _objectSpread2({}, value);
@@ -10514,17 +10557,17 @@ var BsReissue = function BsReissue(props) {
10514
10557
  });
10515
10558
  }
10516
10559
  newValue[key] = val;
10517
- if (key === 'bsReissueType') {
10518
- newValue.bsReissueGoods = [];
10519
- if (['1', '3'].includes(val[0])) {
10520
- newValue.bsReissueGoods = (bsGoods || []).map(function (item) {
10521
- item.money = 0;
10522
- item.share = 0;
10523
- item.canUpdateNumber = false;
10524
- return item;
10525
- });
10526
- }
10527
- }
10560
+ // if (key === 'bsReissueType') {
10561
+ // newValue.bsReissueGoods = [];
10562
+ // if (['1', '3'].includes(val[0])) {
10563
+ // newValue.bsReissueGoods = (bsGoods || []).map((item: any) => {
10564
+ // item.money = 0;
10565
+ // item.share = 0;
10566
+ // item.canUpdateNumber = false;
10567
+ // return item;
10568
+ // });
10569
+ // }
10570
+ // }
10528
10571
  onChange === null || onChange === void 0 ? void 0 : onChange(_objectSpread2({}, newValue));
10529
10572
  pubsub__default['default'].publish('reissueType', val[0]);
10530
10573
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kmkf-fe-packages/basic-components",
3
- "version": "0.7.15-alpha.65",
3
+ "version": "0.7.15-alpha.69",
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.65",
23
+ "@kmkf-fe-packages/kmkf-utils": "^0.7.15-alpha.69",
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": "0f431208a98f7579499d0803badf695085888ec9"
61
+ "gitHead": "10f0ff0eb8ca3abf9895f3489db3cde4ffbfa05e"
62
62
  }