@fonixtree/magic-design 1.0.40 → 1.0.42

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.
@@ -179,7 +179,7 @@ var BundleCampaign = function BundleCampaign(props) {
179
179
  campaignName = _b[0],
180
180
  setCampaignName = _b[1];
181
181
 
182
- var _c = (0, _react.useState)(window.magicDesign.storeId ? window.magicDesign.storeId : ''),
182
+ var _c = (0, _react.useState)(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''),
183
183
  storeId = _c[0],
184
184
  setStoreId = _c[1];
185
185
 
@@ -241,7 +241,7 @@ var BundleCampaign = function BundleCampaign(props) {
241
241
 
242
242
  var reset = function reset() {
243
243
  setCampaignName('');
244
- setStoreId(window.magicDesign.storeId ? window.magicDesign.storeId : '');
244
+ setStoreId(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : '');
245
245
  setCmpState('A,B');
246
246
  };
247
247
 
@@ -257,7 +257,7 @@ function CouponTable(props) {
257
257
  state: 'A',
258
258
  couponLocation: 'Promotion',
259
259
  pageTotal: false,
260
- storeId: window.magicDesign.storeId ? window.magicDesign.storeId : ''
260
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
261
261
  });
262
262
  return [4
263
263
  /*yield*/
@@ -213,7 +213,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
213
213
  labelData = _f[0],
214
214
  setLabelData = _f[1];
215
215
 
216
- var _g = (0, _react.useState)(window.magicDesign.storeId || ''),
216
+ var _g = (0, _react.useState)(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''),
217
217
  storeId = _g[0],
218
218
  setStoreId = _g[1];
219
219
 
@@ -277,7 +277,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
277
277
  settVal([]);
278
278
  settBrandId([]);
279
279
  settLabelId({});
280
- setStoreId(window.magicDesign.storeId || '');
280
+ setStoreId(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : '');
281
281
  setProductName('');
282
282
  setMinimum('');
283
283
  setMaximum('');
@@ -17,8 +17,6 @@ var _commonUtil = require("../../../utils/commonUtil");
17
17
 
18
18
  var _businessUtil = require("../../../utils/businessUtil");
19
19
 
20
- var _ProductModal = require("../../ProductModal");
21
-
22
20
  require("./index.less");
23
21
 
24
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -187,7 +185,7 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
187
185
  var Option = _antd.Select.Option;
188
186
 
189
187
  var ProductDetailPage = function ProductDetailPage(props) {
190
- var _onChange = props.onChange;
188
+ var onChange = props.onChange;
191
189
 
192
190
  var _a = (0, _react.useState)([]),
193
191
  productList = _a[0],
@@ -229,13 +227,17 @@ var ProductDetailPage = function ProductDetailPage(props) {
229
227
  flag = _k[0],
230
228
  setFlag = _k[1];
231
229
 
232
- var _l = (0, _react.useState)({
230
+ var _l = (0, _react.useState)({}),
231
+ selectedPro = _l[0],
232
+ setSelectedPro = _l[1];
233
+
234
+ var _m = (0, _react.useState)({
233
235
  pageSize: 20,
234
236
  current: 1,
235
237
  total: 0
236
238
  }),
237
- paginationParams = _l[0],
238
- setPaginationParams = _l[1];
239
+ paginationParams = _m[0],
240
+ setPaginationParams = _m[1];
239
241
 
240
242
  var columns = [{
241
243
  title: 'Image',
@@ -264,12 +266,14 @@ var ProductDetailPage = function ProductDetailPage(props) {
264
266
  ellipsis: true
265
267
  }];
266
268
  var rowSelection = {
269
+ selectedRowKeys: [(selectedPro === null || selectedPro === void 0 ? void 0 : selectedPro.productId) || ''],
267
270
  onChange: function onChange(selectedRowKeys, selectedRows) {
268
- _onChange({
271
+ var selected = {
269
272
  offerId: selectedRows[0].offerId,
270
273
  productId: selectedRows[0].productId,
271
274
  name: selectedRows[0].productName
272
- });
275
+ };
276
+ setSelectedPro(selected);
273
277
  },
274
278
  type: 'radio'
275
279
  };
@@ -307,11 +311,11 @@ var ProductDetailPage = function ProductDetailPage(props) {
307
311
 
308
312
  case 1:
309
313
  res_1 = _a.sent();
310
- _list = (0, _ProductModal.formatData)((0, _commonUtil.ensure)(function () {
314
+ _list = (0, _commonUtil.ensure)(function () {
311
315
  return res_1.list.map(function (m) {
312
316
  return __assign(__assign({}, m.products[0]), m);
313
317
  });
314
- }, []), proType);
318
+ }, []);
315
319
  total = res_1.total;
316
320
  return [3
317
321
  /*break*/
@@ -327,7 +331,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
327
331
 
328
332
  case 3:
329
333
  res = _a.sent();
330
- _list = (0, _ProductModal.formatData)(res.list || []);
334
+ _list = res.list || [];
331
335
  total = res.total;
332
336
  _a.label = 4;
333
337
 
@@ -412,9 +416,13 @@ var ProductDetailPage = function ProductDetailPage(props) {
412
416
  queryStore();
413
417
  }
414
418
  }, []);
419
+ (0, _react.useEffect)(function () {
420
+ onChange(selectedPro);
421
+ }, [selectedPro]);
415
422
  (0, _react.useEffect)(function () {
416
423
  setLoading(true);
417
424
  reset();
425
+ setSelectedPro({});
418
426
  paginationParams.current = 1;
419
427
  setFlag(!flag);
420
428
  }, [proType]);
@@ -539,7 +547,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
539
547
  },
540
548
  showSizeChanger: false
541
549
  }),
542
- rowKey: "id",
550
+ rowKey: "productId",
543
551
  rowSelection: rowSelection,
544
552
  scroll: {
545
553
  y: 300
@@ -388,7 +388,7 @@ function (_super) {
388
388
  intelligentType: intelligentType,
389
389
  intelligentValue: intelligentValue.join(','),
390
390
  aggregation: false,
391
- storeId: window.magicDesign.storeId || ''
391
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
392
392
  }, 'POST')];
393
393
 
394
394
  case 4:
@@ -380,7 +380,7 @@ function (_super) {
380
380
  intelligentType: intelligentType,
381
381
  intelligentValue: intelligentValue.join(','),
382
382
  aggregation: false,
383
- storeId: window.magicDesign.storeId || ''
383
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
384
384
  }, 'POST')];
385
385
 
386
386
  case 4:
@@ -179,7 +179,7 @@ var BundleCampaign = function BundleCampaign(props) {
179
179
  campaignName = _b[0],
180
180
  setCampaignName = _b[1];
181
181
 
182
- var _c = (0, _react.useState)(window.magicDesign.storeId ? window.magicDesign.storeId : ''),
182
+ var _c = (0, _react.useState)(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''),
183
183
  storeId = _c[0],
184
184
  setStoreId = _c[1];
185
185
 
@@ -241,7 +241,7 @@ var BundleCampaign = function BundleCampaign(props) {
241
241
 
242
242
  var reset = function reset() {
243
243
  setCampaignName('');
244
- setStoreId(window.magicDesign.storeId ? window.magicDesign.storeId : '');
244
+ setStoreId(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : '');
245
245
  setCmpState('A,B');
246
246
  };
247
247
 
@@ -257,7 +257,7 @@ function CouponTable(props) {
257
257
  state: 'A',
258
258
  couponLocation: 'Promotion',
259
259
  pageTotal: false,
260
- storeId: window.magicDesign.storeId ? window.magicDesign.storeId : ''
260
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
261
261
  });
262
262
  return [4
263
263
  /*yield*/
@@ -213,7 +213,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
213
213
  labelData = _f[0],
214
214
  setLabelData = _f[1];
215
215
 
216
- var _g = (0, _react.useState)(window.magicDesign.storeId || ''),
216
+ var _g = (0, _react.useState)(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''),
217
217
  storeId = _g[0],
218
218
  setStoreId = _g[1];
219
219
 
@@ -277,7 +277,7 @@ var FilteredProductModal = function FilteredProductModal(props) {
277
277
  settVal([]);
278
278
  settBrandId([]);
279
279
  settLabelId({});
280
- setStoreId(window.magicDesign.storeId || '');
280
+ setStoreId(window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : '');
281
281
  setProductName('');
282
282
  setMinimum('');
283
283
  setMaximum('');
@@ -17,8 +17,6 @@ var _commonUtil = require("../../../utils/commonUtil");
17
17
 
18
18
  var _businessUtil = require("../../../utils/businessUtil");
19
19
 
20
- var _ProductModal = require("../../ProductModal");
21
-
22
20
  require("./index.less");
23
21
 
24
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -187,7 +185,7 @@ var __generator = void 0 && (void 0).__generator || function (thisArg, body) {
187
185
  var Option = _antd.Select.Option;
188
186
 
189
187
  var ProductDetailPage = function ProductDetailPage(props) {
190
- var _onChange = props.onChange;
188
+ var onChange = props.onChange;
191
189
 
192
190
  var _a = (0, _react.useState)([]),
193
191
  productList = _a[0],
@@ -229,13 +227,17 @@ var ProductDetailPage = function ProductDetailPage(props) {
229
227
  flag = _k[0],
230
228
  setFlag = _k[1];
231
229
 
232
- var _l = (0, _react.useState)({
230
+ var _l = (0, _react.useState)({}),
231
+ selectedPro = _l[0],
232
+ setSelectedPro = _l[1];
233
+
234
+ var _m = (0, _react.useState)({
233
235
  pageSize: 20,
234
236
  current: 1,
235
237
  total: 0
236
238
  }),
237
- paginationParams = _l[0],
238
- setPaginationParams = _l[1];
239
+ paginationParams = _m[0],
240
+ setPaginationParams = _m[1];
239
241
 
240
242
  var columns = [{
241
243
  title: 'Image',
@@ -264,12 +266,14 @@ var ProductDetailPage = function ProductDetailPage(props) {
264
266
  ellipsis: true
265
267
  }];
266
268
  var rowSelection = {
269
+ selectedRowKeys: [(selectedPro === null || selectedPro === void 0 ? void 0 : selectedPro.productId) || ''],
267
270
  onChange: function onChange(selectedRowKeys, selectedRows) {
268
- _onChange({
271
+ var selected = {
269
272
  offerId: selectedRows[0].offerId,
270
273
  productId: selectedRows[0].productId,
271
274
  name: selectedRows[0].productName
272
- });
275
+ };
276
+ setSelectedPro(selected);
273
277
  },
274
278
  type: 'radio'
275
279
  };
@@ -307,11 +311,11 @@ var ProductDetailPage = function ProductDetailPage(props) {
307
311
 
308
312
  case 1:
309
313
  res_1 = _a.sent();
310
- _list = (0, _ProductModal.formatData)((0, _commonUtil.ensure)(function () {
314
+ _list = (0, _commonUtil.ensure)(function () {
311
315
  return res_1.list.map(function (m) {
312
316
  return __assign(__assign({}, m.products[0]), m);
313
317
  });
314
- }, []), proType);
318
+ }, []);
315
319
  total = res_1.total;
316
320
  return [3
317
321
  /*break*/
@@ -327,7 +331,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
327
331
 
328
332
  case 3:
329
333
  res = _a.sent();
330
- _list = (0, _ProductModal.formatData)(res.list || []);
334
+ _list = res.list || [];
331
335
  total = res.total;
332
336
  _a.label = 4;
333
337
 
@@ -412,9 +416,13 @@ var ProductDetailPage = function ProductDetailPage(props) {
412
416
  queryStore();
413
417
  }
414
418
  }, []);
419
+ (0, _react.useEffect)(function () {
420
+ onChange(selectedPro);
421
+ }, [selectedPro]);
415
422
  (0, _react.useEffect)(function () {
416
423
  setLoading(true);
417
424
  reset();
425
+ setSelectedPro({});
418
426
  paginationParams.current = 1;
419
427
  setFlag(!flag);
420
428
  }, [proType]);
@@ -539,7 +547,7 @@ var ProductDetailPage = function ProductDetailPage(props) {
539
547
  },
540
548
  showSizeChanger: false
541
549
  }),
542
- rowKey: "id",
550
+ rowKey: "productId",
543
551
  rowSelection: rowSelection,
544
552
  scroll: {
545
553
  y: 300
@@ -388,7 +388,7 @@ function (_super) {
388
388
  intelligentType: intelligentType,
389
389
  intelligentValue: intelligentValue.join(','),
390
390
  aggregation: false,
391
- storeId: window.magicDesign.storeId || ''
391
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
392
392
  }, 'POST')];
393
393
 
394
394
  case 4:
@@ -380,7 +380,7 @@ function (_super) {
380
380
  intelligentType: intelligentType,
381
381
  intelligentValue: intelligentValue.join(','),
382
382
  aggregation: false,
383
- storeId: window.magicDesign.storeId || ''
383
+ storeId: window.magicDesign.storeId >= 0 ? window.magicDesign.storeId : ''
384
384
  }, 'POST')];
385
385
 
386
386
  case 4:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fonixtree/magic-design",
3
3
  "author": "Cylon Team",
4
- "version": "1.0.40",
4
+ "version": "1.0.42",
5
5
  "description": "Magic Design",
6
6
  "license": "MIT",
7
7
  "module": "es/index.js",