@kmkf-fe-packages/basic-components 0.22.0-alpha.0 → 0.22.0-alpha.2
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 +46 -19
- package/dist/index.js +46 -19
- package/dist/src/common/Goods/goodModel.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -357,6 +357,15 @@ function _regeneratorRuntime() {
|
|
|
357
357
|
}
|
|
358
358
|
}, exports;
|
|
359
359
|
}
|
|
360
|
+
function _typeof(obj) {
|
|
361
|
+
"@babel/helpers - typeof";
|
|
362
|
+
|
|
363
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
364
|
+
return typeof obj;
|
|
365
|
+
} : function (obj) {
|
|
366
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
367
|
+
}, _typeof(obj);
|
|
368
|
+
}
|
|
360
369
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
361
370
|
try {
|
|
362
371
|
var info = gen[key](arg);
|
|
@@ -7924,7 +7933,9 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
7924
7933
|
maxLength = props.maxLength,
|
|
7925
7934
|
shopList = props.shopList,
|
|
7926
7935
|
changeSku = props.changeSku,
|
|
7927
|
-
width = props.width
|
|
7936
|
+
width = props.width,
|
|
7937
|
+
_props$numIidType = props.numIidType,
|
|
7938
|
+
numIidType = _props$numIidType === void 0 ? 'string' : _props$numIidType;
|
|
7928
7939
|
var _useState = useState([]),
|
|
7929
7940
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7930
7941
|
selectList = _useState2[0],
|
|
@@ -7941,6 +7952,25 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
7941
7952
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
7942
7953
|
loading = _useState8[0],
|
|
7943
7954
|
setLoading = _useState8[1];
|
|
7955
|
+
var transformIdType = function transformIdType(id) {
|
|
7956
|
+
if (!['string', 'number'].includes(_typeof(id))) return id;
|
|
7957
|
+
return numIidType === 'string' ? id + '' : +id;
|
|
7958
|
+
};
|
|
7959
|
+
var transformType = function transformType(item) {
|
|
7960
|
+
if (!(item === null || item === void 0 ? void 0 : item.numIid)) return item;
|
|
7961
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
7962
|
+
numIid: transformIdType(item.numIid)
|
|
7963
|
+
});
|
|
7964
|
+
};
|
|
7965
|
+
var handleSetSelect = function handleSetSelect(list) {
|
|
7966
|
+
return setSelect(list.map(transformType));
|
|
7967
|
+
};
|
|
7968
|
+
var handleSelectIds = function handleSelectIds(list) {
|
|
7969
|
+
return setSelectIds(list.map(transformIdType));
|
|
7970
|
+
};
|
|
7971
|
+
var handleSetGoodList = function handleSetGoodList(list) {
|
|
7972
|
+
return setGoodList(list.map(transformType));
|
|
7973
|
+
};
|
|
7944
7974
|
var _useState9 = useState({
|
|
7945
7975
|
apiName: 'queryItems',
|
|
7946
7976
|
desc: true,
|
|
@@ -8034,15 +8064,15 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8034
8064
|
var newSelect = selectList.filter(function (item) {
|
|
8035
8065
|
return item.numIid !== good.numIid;
|
|
8036
8066
|
});
|
|
8037
|
-
|
|
8067
|
+
handleSetSelect(_toConsumableArray(newSelect));
|
|
8038
8068
|
var ids = newSelect.map(function (item) {
|
|
8039
8069
|
return item.numIid;
|
|
8040
8070
|
});
|
|
8041
|
-
|
|
8071
|
+
handleSelectIds(ids);
|
|
8042
8072
|
} else {
|
|
8043
8073
|
if (type === 4 || changeSku) {
|
|
8044
|
-
|
|
8045
|
-
|
|
8074
|
+
handleSetSelect([good]);
|
|
8075
|
+
handleSelectIds([good.numIid]);
|
|
8046
8076
|
} else {
|
|
8047
8077
|
if (selectList.length >= maxLength) {
|
|
8048
8078
|
message.error("\u6700\u591A\u6DFB\u52A0".concat(maxLength, "\u5F20"));
|
|
@@ -8055,14 +8085,14 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8055
8085
|
var newSelectList = selectList.filter(function (item) {
|
|
8056
8086
|
return item.numIid !== good.numIid;
|
|
8057
8087
|
});
|
|
8058
|
-
|
|
8088
|
+
handleSetSelect(newSelectList);
|
|
8059
8089
|
var _ids = newSelectList.map(function (item) {
|
|
8060
8090
|
return item.numIid;
|
|
8061
8091
|
});
|
|
8062
|
-
|
|
8092
|
+
handleSelectIds(_ids);
|
|
8063
8093
|
} else {
|
|
8064
|
-
|
|
8065
|
-
|
|
8094
|
+
handleSetSelect([].concat(_toConsumableArray(selectList), [good]));
|
|
8095
|
+
handleSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
|
|
8066
8096
|
}
|
|
8067
8097
|
}
|
|
8068
8098
|
}
|
|
@@ -8154,7 +8184,7 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8154
8184
|
items.forEach(function (item) {
|
|
8155
8185
|
item.platform = platform;
|
|
8156
8186
|
});
|
|
8157
|
-
|
|
8187
|
+
handleSetGoodList(_toConsumableArray(items));
|
|
8158
8188
|
setTotal(totalCount);
|
|
8159
8189
|
_context.next = 26;
|
|
8160
8190
|
break;
|
|
@@ -8182,7 +8212,7 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8182
8212
|
item.title = item.productName;
|
|
8183
8213
|
item.platform = platform;
|
|
8184
8214
|
});
|
|
8185
|
-
|
|
8215
|
+
handleSetGoodList(_toConsumableArray(newList));
|
|
8186
8216
|
setTotal(_total);
|
|
8187
8217
|
if (platform === 'sph' && nextKey && !nextKeyList.includes(nextKey)) {
|
|
8188
8218
|
setNextKeyList([].concat(_toConsumableArray(nextKeyList), [nextKey]));
|
|
@@ -8268,12 +8298,12 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8268
8298
|
useEffect(function () {
|
|
8269
8299
|
setPlatformHandle(platform);
|
|
8270
8300
|
if (imgList.length) {
|
|
8271
|
-
|
|
8301
|
+
handleSetSelect(imgList);
|
|
8272
8302
|
var ids = imgList === null || imgList === void 0 ? void 0 : imgList.map(function (item) {
|
|
8273
8303
|
return item.numIid;
|
|
8274
8304
|
});
|
|
8275
8305
|
if (!(changeSku || type === 4)) {
|
|
8276
|
-
|
|
8306
|
+
handleSelectIds(ids);
|
|
8277
8307
|
}
|
|
8278
8308
|
}
|
|
8279
8309
|
}, [platform]);
|
|
@@ -8904,7 +8934,6 @@ var GoodItem = function GoodItem(props) {
|
|
|
8904
8934
|
disabled = props.disabled,
|
|
8905
8935
|
changeSku = props.changeSku,
|
|
8906
8936
|
width = props.width;
|
|
8907
|
-
console.log('value', value);
|
|
8908
8937
|
var shopId = value.shopId,
|
|
8909
8938
|
imgList = value.imgList;
|
|
8910
8939
|
var _useState = useState(false),
|
|
@@ -9118,7 +9147,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
9118
9147
|
}];
|
|
9119
9148
|
};
|
|
9120
9149
|
var headerList = showHeader || {
|
|
9121
|
-
1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId' // sku
|
|
9150
|
+
1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId', 'propertiesName' // sku 信息
|
|
9122
9151
|
]
|
|
9123
9152
|
}[type] || [];
|
|
9124
9153
|
var newColumns = useMemo(function () {
|
|
@@ -9142,12 +9171,12 @@ var GoodItem = function GoodItem(props) {
|
|
|
9142
9171
|
ellipsis: true,
|
|
9143
9172
|
width: 100,
|
|
9144
9173
|
render: function render(val, record, index) {
|
|
9145
|
-
return
|
|
9174
|
+
return /*#__PURE__*/React.createElement(Button, {
|
|
9146
9175
|
type: "link",
|
|
9147
9176
|
onClick: function onClick() {
|
|
9148
9177
|
return handleDelete(record, index);
|
|
9149
9178
|
}
|
|
9150
|
-
}, "\u5220\u9664")
|
|
9179
|
+
}, "\u5220\u9664");
|
|
9151
9180
|
}
|
|
9152
9181
|
});
|
|
9153
9182
|
}
|
|
@@ -9155,14 +9184,12 @@ var GoodItem = function GoodItem(props) {
|
|
|
9155
9184
|
}, [headerList, value, disabled]);
|
|
9156
9185
|
var handleChangeGoods = function handleChangeGoods() {
|
|
9157
9186
|
var _props$value2;
|
|
9158
|
-
console.log('shopId', shopId, props.value);
|
|
9159
9187
|
if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.shopId)) {
|
|
9160
9188
|
message.error('请选择店铺');
|
|
9161
9189
|
return;
|
|
9162
9190
|
}
|
|
9163
9191
|
setVisible(true);
|
|
9164
9192
|
};
|
|
9165
|
-
window.handleChangeGoods = handleChangeGoods;
|
|
9166
9193
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React.createElement("div", {
|
|
9167
9194
|
style: {
|
|
9168
9195
|
float: 'right'
|
package/dist/index.js
CHANGED
|
@@ -368,6 +368,15 @@ function _regeneratorRuntime() {
|
|
|
368
368
|
}
|
|
369
369
|
}, exports;
|
|
370
370
|
}
|
|
371
|
+
function _typeof(obj) {
|
|
372
|
+
"@babel/helpers - typeof";
|
|
373
|
+
|
|
374
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
375
|
+
return typeof obj;
|
|
376
|
+
} : function (obj) {
|
|
377
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
378
|
+
}, _typeof(obj);
|
|
379
|
+
}
|
|
371
380
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
372
381
|
try {
|
|
373
382
|
var info = gen[key](arg);
|
|
@@ -7935,7 +7944,9 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
7935
7944
|
maxLength = props.maxLength,
|
|
7936
7945
|
shopList = props.shopList,
|
|
7937
7946
|
changeSku = props.changeSku,
|
|
7938
|
-
width = props.width
|
|
7947
|
+
width = props.width,
|
|
7948
|
+
_props$numIidType = props.numIidType,
|
|
7949
|
+
numIidType = _props$numIidType === void 0 ? 'string' : _props$numIidType;
|
|
7939
7950
|
var _useState = React.useState([]),
|
|
7940
7951
|
_useState2 = _slicedToArray(_useState, 2),
|
|
7941
7952
|
selectList = _useState2[0],
|
|
@@ -7952,6 +7963,25 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
7952
7963
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
7953
7964
|
loading = _useState8[0],
|
|
7954
7965
|
setLoading = _useState8[1];
|
|
7966
|
+
var transformIdType = function transformIdType(id) {
|
|
7967
|
+
if (!['string', 'number'].includes(_typeof(id))) return id;
|
|
7968
|
+
return numIidType === 'string' ? id + '' : +id;
|
|
7969
|
+
};
|
|
7970
|
+
var transformType = function transformType(item) {
|
|
7971
|
+
if (!(item === null || item === void 0 ? void 0 : item.numIid)) return item;
|
|
7972
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
7973
|
+
numIid: transformIdType(item.numIid)
|
|
7974
|
+
});
|
|
7975
|
+
};
|
|
7976
|
+
var handleSetSelect = function handleSetSelect(list) {
|
|
7977
|
+
return setSelect(list.map(transformType));
|
|
7978
|
+
};
|
|
7979
|
+
var handleSelectIds = function handleSelectIds(list) {
|
|
7980
|
+
return setSelectIds(list.map(transformIdType));
|
|
7981
|
+
};
|
|
7982
|
+
var handleSetGoodList = function handleSetGoodList(list) {
|
|
7983
|
+
return setGoodList(list.map(transformType));
|
|
7984
|
+
};
|
|
7955
7985
|
var _useState9 = React.useState({
|
|
7956
7986
|
apiName: 'queryItems',
|
|
7957
7987
|
desc: true,
|
|
@@ -8045,15 +8075,15 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8045
8075
|
var newSelect = selectList.filter(function (item) {
|
|
8046
8076
|
return item.numIid !== good.numIid;
|
|
8047
8077
|
});
|
|
8048
|
-
|
|
8078
|
+
handleSetSelect(_toConsumableArray(newSelect));
|
|
8049
8079
|
var ids = newSelect.map(function (item) {
|
|
8050
8080
|
return item.numIid;
|
|
8051
8081
|
});
|
|
8052
|
-
|
|
8082
|
+
handleSelectIds(ids);
|
|
8053
8083
|
} else {
|
|
8054
8084
|
if (type === 4 || changeSku) {
|
|
8055
|
-
|
|
8056
|
-
|
|
8085
|
+
handleSetSelect([good]);
|
|
8086
|
+
handleSelectIds([good.numIid]);
|
|
8057
8087
|
} else {
|
|
8058
8088
|
if (selectList.length >= maxLength) {
|
|
8059
8089
|
antd.message.error("\u6700\u591A\u6DFB\u52A0".concat(maxLength, "\u5F20"));
|
|
@@ -8066,14 +8096,14 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8066
8096
|
var newSelectList = selectList.filter(function (item) {
|
|
8067
8097
|
return item.numIid !== good.numIid;
|
|
8068
8098
|
});
|
|
8069
|
-
|
|
8099
|
+
handleSetSelect(newSelectList);
|
|
8070
8100
|
var _ids = newSelectList.map(function (item) {
|
|
8071
8101
|
return item.numIid;
|
|
8072
8102
|
});
|
|
8073
|
-
|
|
8103
|
+
handleSelectIds(_ids);
|
|
8074
8104
|
} else {
|
|
8075
|
-
|
|
8076
|
-
|
|
8105
|
+
handleSetSelect([].concat(_toConsumableArray(selectList), [good]));
|
|
8106
|
+
handleSelectIds([].concat(_toConsumableArray(selectIds), [good.numIid]));
|
|
8077
8107
|
}
|
|
8078
8108
|
}
|
|
8079
8109
|
}
|
|
@@ -8165,7 +8195,7 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8165
8195
|
items.forEach(function (item) {
|
|
8166
8196
|
item.platform = platform;
|
|
8167
8197
|
});
|
|
8168
|
-
|
|
8198
|
+
handleSetGoodList(_toConsumableArray(items));
|
|
8169
8199
|
setTotal(totalCount);
|
|
8170
8200
|
_context.next = 26;
|
|
8171
8201
|
break;
|
|
@@ -8193,7 +8223,7 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8193
8223
|
item.title = item.productName;
|
|
8194
8224
|
item.platform = platform;
|
|
8195
8225
|
});
|
|
8196
|
-
|
|
8226
|
+
handleSetGoodList(_toConsumableArray(newList));
|
|
8197
8227
|
setTotal(_total);
|
|
8198
8228
|
if (platform === 'sph' && nextKey && !nextKeyList.includes(nextKey)) {
|
|
8199
8229
|
setNextKeyList([].concat(_toConsumableArray(nextKeyList), [nextKey]));
|
|
@@ -8279,12 +8309,12 @@ var GoodsModal = function GoodsModal(props) {
|
|
|
8279
8309
|
React.useEffect(function () {
|
|
8280
8310
|
setPlatformHandle(platform);
|
|
8281
8311
|
if (imgList.length) {
|
|
8282
|
-
|
|
8312
|
+
handleSetSelect(imgList);
|
|
8283
8313
|
var ids = imgList === null || imgList === void 0 ? void 0 : imgList.map(function (item) {
|
|
8284
8314
|
return item.numIid;
|
|
8285
8315
|
});
|
|
8286
8316
|
if (!(changeSku || type === 4)) {
|
|
8287
|
-
|
|
8317
|
+
handleSelectIds(ids);
|
|
8288
8318
|
}
|
|
8289
8319
|
}
|
|
8290
8320
|
}, [platform]);
|
|
@@ -8915,7 +8945,6 @@ var GoodItem = function GoodItem(props) {
|
|
|
8915
8945
|
disabled = props.disabled,
|
|
8916
8946
|
changeSku = props.changeSku,
|
|
8917
8947
|
width = props.width;
|
|
8918
|
-
console.log('value', value);
|
|
8919
8948
|
var shopId = value.shopId,
|
|
8920
8949
|
imgList = value.imgList;
|
|
8921
8950
|
var _useState = React.useState(false),
|
|
@@ -9129,7 +9158,7 @@ var GoodItem = function GoodItem(props) {
|
|
|
9129
9158
|
}];
|
|
9130
9159
|
};
|
|
9131
9160
|
var headerList = showHeader || {
|
|
9132
|
-
1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId' // sku
|
|
9161
|
+
1: ['title', 'outerId', 'picUrl', 'numIid', 'skuId', 'outerSkuId', 'propertiesName' // sku 信息
|
|
9133
9162
|
]
|
|
9134
9163
|
}[type] || [];
|
|
9135
9164
|
var newColumns = React.useMemo(function () {
|
|
@@ -9153,12 +9182,12 @@ var GoodItem = function GoodItem(props) {
|
|
|
9153
9182
|
ellipsis: true,
|
|
9154
9183
|
width: 100,
|
|
9155
9184
|
render: function render(val, record, index) {
|
|
9156
|
-
return
|
|
9185
|
+
return /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
9157
9186
|
type: "link",
|
|
9158
9187
|
onClick: function onClick() {
|
|
9159
9188
|
return handleDelete(record, index);
|
|
9160
9189
|
}
|
|
9161
|
-
}, "\u5220\u9664")
|
|
9190
|
+
}, "\u5220\u9664");
|
|
9162
9191
|
}
|
|
9163
9192
|
});
|
|
9164
9193
|
}
|
|
@@ -9166,14 +9195,12 @@ var GoodItem = function GoodItem(props) {
|
|
|
9166
9195
|
}, [headerList, value, disabled]);
|
|
9167
9196
|
var handleChangeGoods = function handleChangeGoods() {
|
|
9168
9197
|
var _props$value2;
|
|
9169
|
-
console.log('shopId', shopId, props.value);
|
|
9170
9198
|
if (!((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.shopId)) {
|
|
9171
9199
|
antd.message.error('请选择店铺');
|
|
9172
9200
|
return;
|
|
9173
9201
|
}
|
|
9174
9202
|
setVisible(true);
|
|
9175
9203
|
};
|
|
9176
|
-
window.handleChangeGoods = handleChangeGoods;
|
|
9177
9204
|
return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, !disabled && showChangeBtn && /*#__PURE__*/React__default['default'].createElement("div", {
|
|
9178
9205
|
style: {
|
|
9179
9206
|
float: 'right'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "0.22.0-alpha.
|
|
3
|
+
"version": "0.22.0-alpha.2",
|
|
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.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.22.0-alpha.2",
|
|
24
24
|
"lodash": "^4.17.21",
|
|
25
25
|
"pubsub-js": "^1.9.4",
|
|
26
26
|
"react-copy-to-clipboard": "^5.1.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "4d837d058d55c1d265bc34262f9bcb9d44807cba"
|
|
65
65
|
}
|