@xfe-repo/web-components 1.7.6 → 1.8.1
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.css +34 -1
- package/dist/index.d.mts +46 -12
- package/dist/index.d.ts +46 -12
- package/dist/index.js +549 -176
- package/dist/index.mjs +503 -138
- package/package.json +4 -2
- package/skills/xfe-web-components/GUIDE.md +3 -2
- package/skills/xfe-web-components/SKILL.md +3 -2
- package/skills/xfe-web-components/references/EffectLabelSelect.md +6 -5
- package/skills/xfe-web-components/references/EffectMerchantSelect.md +13 -28
- package/skills/xfe-web-components/references/EffectSearchSelect.md +262 -0
- package/skills/xfe-web-components/references/EffectStaffSelect.md +4 -4
- package/skills/xfe-web-components/references/commonFn.md +3 -1
package/dist/index.js
CHANGED
|
@@ -472,6 +472,9 @@ __export(index_exports, {
|
|
|
472
472
|
EffectScopeSelect: function EffectScopeSelect1() {
|
|
473
473
|
return EffectScopeSelect;
|
|
474
474
|
},
|
|
475
|
+
EffectSearchSelect: function EffectSearchSelect1() {
|
|
476
|
+
return EffectSearchSelect;
|
|
477
|
+
},
|
|
475
478
|
EffectSeriesSelect: function EffectSeriesSelect1() {
|
|
476
479
|
return EffectSeriesSelect;
|
|
477
480
|
},
|
|
@@ -580,6 +583,9 @@ __export(index_exports, {
|
|
|
580
583
|
commonYesOrNoSelectOptionsMap: function commonYesOrNoSelectOptionsMap1() {
|
|
581
584
|
return commonYesOrNoSelectOptionsMap;
|
|
582
585
|
},
|
|
586
|
+
defaultMerchantSearchSources: function defaultMerchantSearchSources1() {
|
|
587
|
+
return defaultMerchantSearchSources;
|
|
588
|
+
},
|
|
583
589
|
formatClock: function formatClock1() {
|
|
584
590
|
return formatClock;
|
|
585
591
|
},
|
|
@@ -947,6 +953,11 @@ var import_modifiers = require("@dnd-kit/modifiers");
|
|
|
947
953
|
var import_utilities = require("@dnd-kit/utilities");
|
|
948
954
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
949
955
|
var import_react5 = require("react");
|
|
956
|
+
var getMiddleClickCloseTargetKey = function getMiddleClickCloseTargetKey(event, data) {
|
|
957
|
+
if (event.button !== 1) return void 0;
|
|
958
|
+
if (!data || data.disabled || data.closable === false) return void 0;
|
|
959
|
+
return data.key;
|
|
960
|
+
};
|
|
950
961
|
var MultiWindowTabs = (0, import_react4.memo)(function(props) {
|
|
951
962
|
var pathKey = props.pathKey, pagePaths = props.pagePaths, className = props.className, onChange = props.onChange, onClose = props.onClose, onSort = props.onSort, onCollectionChange = props.onCollectionChange, sortAutoActive = props.sortAutoActive;
|
|
952
963
|
var sensor = (0, import_core.useSensor)(import_core.PointerSensor, {
|
|
@@ -1022,6 +1033,7 @@ var MultiWindowTabs = (0, import_react4.memo)(function(props) {
|
|
|
1022
1033
|
key: node.key,
|
|
1023
1034
|
data: pagePathsHelperData.map.get(String(node.key)),
|
|
1024
1035
|
onCollectionChange: onCollectionChange,
|
|
1036
|
+
onClose: onClose,
|
|
1025
1037
|
isActivated: pathKey === String(node.key)
|
|
1026
1038
|
}), node);
|
|
1027
1039
|
}
|
|
@@ -1033,6 +1045,8 @@ var MultiWindowTabs = (0, import_react4.memo)(function(props) {
|
|
|
1033
1045
|
onDragStart,
|
|
1034
1046
|
onDragEnd,
|
|
1035
1047
|
onCollectionChange,
|
|
1048
|
+
onClose,
|
|
1049
|
+
pathKey,
|
|
1036
1050
|
sensor
|
|
1037
1051
|
]);
|
|
1038
1052
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_antd4.Tabs, {
|
|
@@ -1048,15 +1062,26 @@ var MultiWindowTabs = (0, import_react4.memo)(function(props) {
|
|
|
1048
1062
|
});
|
|
1049
1063
|
});
|
|
1050
1064
|
var TabItem = (0, import_react4.memo)(function(props) {
|
|
1051
|
-
var data = props.data, children = props.children, style = props.style, isActivated = props.isActivated, onCollectionChange = props.onCollectionChange;
|
|
1065
|
+
var data = props.data, children = props.children, style = props.style, isActivated = props.isActivated, onCollectionChange = props.onCollectionChange, onClose = props.onClose;
|
|
1052
1066
|
var _ref = (0, import_sortable.useSortable)({
|
|
1053
1067
|
id: props["data-node-key"]
|
|
1054
1068
|
}), attributes = _ref.attributes, listeners = _ref.listeners, setNodeRef = _ref.setNodeRef, transform = _ref.transform, transition = _ref.transition, isDragging = _ref.isDragging;
|
|
1069
|
+
var handleAuxClick = (0, import_react4.useCallback)(function(event) {
|
|
1070
|
+
var targetKey = getMiddleClickCloseTargetKey(event, data);
|
|
1071
|
+
if (!targetKey) return;
|
|
1072
|
+
event.preventDefault();
|
|
1073
|
+
event.stopPropagation();
|
|
1074
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(targetKey);
|
|
1075
|
+
}, [
|
|
1076
|
+
data,
|
|
1077
|
+
onClose
|
|
1078
|
+
]);
|
|
1055
1079
|
var handleCollectionChange = (0, import_react4.useCallback)(function(collectionKey) {
|
|
1056
1080
|
if (!data) return;
|
|
1057
1081
|
onCollectionChange === null || onCollectionChange === void 0 ? void 0 : onCollectionChange(data.key, collectionKey);
|
|
1058
1082
|
}, [
|
|
1059
|
-
data
|
|
1083
|
+
data,
|
|
1084
|
+
onCollectionChange
|
|
1060
1085
|
]);
|
|
1061
1086
|
var collectionSelect = (0, import_react4.useMemo)(function() {
|
|
1062
1087
|
var _data_searchCollection;
|
|
@@ -1093,7 +1118,7 @@ var TabItem = (0, import_react4.memo)(function(props) {
|
|
|
1093
1118
|
children,
|
|
1094
1119
|
collectionSelect
|
|
1095
1120
|
]);
|
|
1096
|
-
return import_react4.default.cloneElement(children, _object_spread({
|
|
1121
|
+
return import_react4.default.cloneElement(children, _object_spread_props(_object_spread({
|
|
1097
1122
|
ref: setNodeRef,
|
|
1098
1123
|
style: _object_spread_props(_object_spread({}, style), {
|
|
1099
1124
|
transform: import_utilities.CSS.Translate.toString(transform && _object_spread_props(_object_spread({}, transform), {
|
|
@@ -1104,7 +1129,9 @@ var TabItem = (0, import_react4.memo)(function(props) {
|
|
|
1104
1129
|
cursor: "pointer"
|
|
1105
1130
|
}),
|
|
1106
1131
|
children: childrenWithCollectionSelect
|
|
1107
|
-
}, attributes, listeners)
|
|
1132
|
+
}, attributes, listeners), {
|
|
1133
|
+
onAuxClick: handleAuxClick
|
|
1134
|
+
}));
|
|
1108
1135
|
});
|
|
1109
1136
|
// src/MultiWindow/MultiWindow.tsx
|
|
1110
1137
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -3337,6 +3364,7 @@ var index_module_default6 = {
|
|
|
3337
3364
|
text: "index_module_text",
|
|
3338
3365
|
button: "index_module_button",
|
|
3339
3366
|
remote: "index_module_remote",
|
|
3367
|
+
paste_tip: "index_module_paste_tip",
|
|
3340
3368
|
upload_mask: "index_module_upload_mask"
|
|
3341
3369
|
};
|
|
3342
3370
|
// src/FileUpload/index.tsx
|
|
@@ -4107,16 +4135,19 @@ var FileUpload = function FileUpload(props) {
|
|
|
4107
4135
|
var renderPicCardUploadButton = (0, import_react34.useCallback)(function() {
|
|
4108
4136
|
if (max && fileList.length >= max) return null;
|
|
4109
4137
|
if (children) return children;
|
|
4110
|
-
if (disabled) return null;
|
|
4111
4138
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", {
|
|
4112
4139
|
className: index_module_default6.upload_btn,
|
|
4113
4140
|
children: [
|
|
4141
|
+
pastable && !disabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", {
|
|
4142
|
+
className: index_module_default6.paste_tip,
|
|
4143
|
+
children: "\u53EF\u7C98\u8D34\u4E0A\u4F20"
|
|
4144
|
+
}),
|
|
4114
4145
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons9.PlusOutlined, {}),
|
|
4115
4146
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", {
|
|
4116
4147
|
className: index_module_default6.text,
|
|
4117
4148
|
children: "\u4E0A\u4F20"
|
|
4118
4149
|
}),
|
|
4119
|
-
remote && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RemoteUpload, {
|
|
4150
|
+
remote && !disabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RemoteUpload, {
|
|
4120
4151
|
max: max,
|
|
4121
4152
|
onAddFile: setBufferAddFile
|
|
4122
4153
|
})
|
|
@@ -6364,13 +6395,13 @@ function useMerchantOptions(params) {
|
|
|
6364
6395
|
params
|
|
6365
6396
|
], function() {
|
|
6366
6397
|
return _async_to_generator(function() {
|
|
6367
|
-
var _res_data, _ref, enabled,
|
|
6398
|
+
var _res_data, _ref, enabled, source, searchParams, res, options;
|
|
6368
6399
|
return _ts_generator(this, function(_state) {
|
|
6369
6400
|
switch(_state.label){
|
|
6370
6401
|
case 0:
|
|
6371
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6402
|
+
_ref = params || {}, enabled = _ref.enabled, source = _ref.source, searchParams = _object_without_properties(_ref, [
|
|
6372
6403
|
"enabled",
|
|
6373
|
-
"
|
|
6404
|
+
"source"
|
|
6374
6405
|
]);
|
|
6375
6406
|
if (enabled === false) return [
|
|
6376
6407
|
2,
|
|
@@ -6381,7 +6412,7 @@ function useMerchantOptions(params) {
|
|
|
6381
6412
|
apiService.merchantList(_object_spread({
|
|
6382
6413
|
page: 1,
|
|
6383
6414
|
pageSize: 20
|
|
6384
|
-
},
|
|
6415
|
+
}, searchParams), config)
|
|
6385
6416
|
];
|
|
6386
6417
|
case 1:
|
|
6387
6418
|
res = _state.sent();
|
|
@@ -6389,9 +6420,12 @@ function useMerchantOptions(params) {
|
|
|
6389
6420
|
throw new Error((res === null || res === void 0 ? void 0 : res.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6390
6421
|
}
|
|
6391
6422
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6392
|
-
var label = labelDisplayMode === "platformName-enterpriseNo" ? "".concat(item.platformName, " - ").concat(item.enterpriseNo) : item.platformName;
|
|
6393
6423
|
return {
|
|
6394
|
-
label:
|
|
6424
|
+
label: [
|
|
6425
|
+
item.enterpriseNo,
|
|
6426
|
+
item.platformName,
|
|
6427
|
+
item.name
|
|
6428
|
+
].filter(Boolean).join(" - "),
|
|
6395
6429
|
value: item.enterpriseNo,
|
|
6396
6430
|
originalName: item.platformName,
|
|
6397
6431
|
data: item
|
|
@@ -6426,15 +6460,34 @@ var index_module_default17 = {
|
|
|
6426
6460
|
// src/EffectMerchantSelect/index.tsx
|
|
6427
6461
|
var import_antd32 = require("antd");
|
|
6428
6462
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
6463
|
+
var defaultMerchantSearchSources = [
|
|
6464
|
+
{
|
|
6465
|
+
label: "\u5546\u6237\u53F7",
|
|
6466
|
+
value: "enterpriseNo"
|
|
6467
|
+
},
|
|
6468
|
+
{
|
|
6469
|
+
label: "\u5E73\u53F0\u540D",
|
|
6470
|
+
value: "platformName"
|
|
6471
|
+
},
|
|
6472
|
+
{
|
|
6473
|
+
label: "\u5546\u6237\u540D",
|
|
6474
|
+
value: "name"
|
|
6475
|
+
},
|
|
6476
|
+
{
|
|
6477
|
+
label: "\u6CE8\u518C\u624B\u673A\u53F7",
|
|
6478
|
+
value: "phone"
|
|
6479
|
+
}
|
|
6480
|
+
];
|
|
6429
6481
|
var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
6430
|
-
var
|
|
6431
|
-
var
|
|
6432
|
-
var _ref1 = _sliced_to_array((0, import_react45.useState)(
|
|
6433
|
-
var _ref2 = _sliced_to_array((0, import_react45.useState)(), 2),
|
|
6434
|
-
var _ref3 = _sliced_to_array((0, import_react45.useState)(
|
|
6435
|
-
var _ref4 = _sliced_to_array((0, import_react45.useState)(), 2),
|
|
6482
|
+
var _ref;
|
|
6483
|
+
var onChange = props.onChange, className = props.className, controlValue = props.value, disabled = props.disabled, _props_source = props.source, source = _props_source === void 0 ? "enterpriseNo" : _props_source;
|
|
6484
|
+
var _ref1 = _sliced_to_array((0, import_react45.useState)(), 2), searchValue = _ref1[0], setSearchValue = _ref1[1];
|
|
6485
|
+
var _ref2 = _sliced_to_array((0, import_react45.useState)(controlValue), 2), value = _ref2[0], setValue = _ref2[1];
|
|
6486
|
+
var _ref3 = _sliced_to_array((0, import_react45.useState)(), 2), name = _ref3[0], setName = _ref3[1];
|
|
6487
|
+
var _ref4 = _sliced_to_array((0, import_react45.useState)(source), 2), sourceControl = _ref4[0], setSourceControl = _ref4[1];
|
|
6488
|
+
var _ref5 = _sliced_to_array((0, import_react45.useState)(), 2), params = _ref5[0], setParams = _ref5[1];
|
|
6436
6489
|
var state = useMerchantOptions(params);
|
|
6437
|
-
var
|
|
6490
|
+
var _ref6 = _sliced_to_array((0, import_react45.useState)(state.data || []), 2), options = _ref6[0], setOptions = _ref6[1];
|
|
6438
6491
|
(0, import_react_use15.useUpdateEffect)(function() {
|
|
6439
6492
|
if (!state.data) return;
|
|
6440
6493
|
setOptions(state.data);
|
|
@@ -6444,12 +6497,11 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6444
6497
|
(0, import_react45.useEffect)(function() {
|
|
6445
6498
|
if (controlValue !== value) setValue(controlValue);
|
|
6446
6499
|
if (controlValue) setParams({
|
|
6447
|
-
|
|
6448
|
-
|
|
6500
|
+
enterpriseNo: controlValue,
|
|
6501
|
+
source: sourceControl
|
|
6449
6502
|
});
|
|
6450
6503
|
}, [
|
|
6451
|
-
controlValue
|
|
6452
|
-
labelDisplayMode
|
|
6504
|
+
controlValue
|
|
6453
6505
|
]);
|
|
6454
6506
|
(0, import_react_use15.useUpdateEffect)(function() {
|
|
6455
6507
|
var changeValue = (value !== null && value !== void 0 ? value : "") === "" ? void 0 : String(value);
|
|
@@ -6463,24 +6515,23 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6463
6515
|
setName(option === null || option === void 0 ? void 0 : option.originalName);
|
|
6464
6516
|
};
|
|
6465
6517
|
var handleOnSearch = function handleOnSearch(searchValue2) {
|
|
6518
|
+
setSearchValue(searchValue2);
|
|
6466
6519
|
var _obj;
|
|
6467
|
-
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "
|
|
6520
|
+
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "source", sourceControl), _obj));
|
|
6468
6521
|
};
|
|
6469
6522
|
var handleOnSearchDebounce = (0, import_react45.useCallback)((0, import_tools10.debounce)(800, handleOnSearch), [
|
|
6470
|
-
sourceControl
|
|
6471
|
-
labelDisplayMode
|
|
6523
|
+
sourceControl
|
|
6472
6524
|
]);
|
|
6473
6525
|
var handleOnClear = function handleOnClear() {
|
|
6474
6526
|
setSearchValue(void 0);
|
|
6475
6527
|
setOptions([]);
|
|
6476
6528
|
};
|
|
6477
|
-
var
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
var
|
|
6483
|
-
var handleAddonChange = function handleAddonChange(value2, _option) {
|
|
6529
|
+
var currentSource = defaultMerchantSearchSources.find(function(s) {
|
|
6530
|
+
return s.value === sourceControl;
|
|
6531
|
+
});
|
|
6532
|
+
var currentSourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6533
|
+
var notFoundContent = state.isLoading ? "\u641C\u7D22\u4E2D" : searchValue ? "输入的".concat(currentSourceLabel, "未查询到商户信息") : "请输入".concat(currentSourceLabel);
|
|
6534
|
+
var handleAddonChange = function handleAddonChange(value2) {
|
|
6484
6535
|
setSourceControl(value2);
|
|
6485
6536
|
setValue(void 0);
|
|
6486
6537
|
setSearchValue(void 0);
|
|
@@ -6498,13 +6549,7 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6498
6549
|
popupMatchSelectWidth: false,
|
|
6499
6550
|
disabled: disabled,
|
|
6500
6551
|
defaultValue: sourceControl,
|
|
6501
|
-
options:
|
|
6502
|
-
var _param = _sliced_to_array(param, 2), value2 = _param[0], label = _param[1];
|
|
6503
|
-
return {
|
|
6504
|
-
value: value2,
|
|
6505
|
-
label: label
|
|
6506
|
-
};
|
|
6507
|
-
}),
|
|
6552
|
+
options: defaultMerchantSearchSources,
|
|
6508
6553
|
onChange: handleAddonChange,
|
|
6509
6554
|
style: {
|
|
6510
6555
|
width: 140
|
|
@@ -6512,12 +6557,13 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6512
6557
|
};
|
|
6513
6558
|
var selectBrandProps = {
|
|
6514
6559
|
notFoundContent: notFoundContent,
|
|
6515
|
-
placeholder: "请输入".concat(
|
|
6560
|
+
placeholder: "请输入".concat(currentSourceLabel),
|
|
6516
6561
|
optionFilterProp: "label",
|
|
6517
6562
|
showSearch: true,
|
|
6518
6563
|
allowClear: true,
|
|
6519
6564
|
defaultActiveFirstOption: false,
|
|
6520
6565
|
filterOption: false,
|
|
6566
|
+
popupMatchSelectWidth: false,
|
|
6521
6567
|
value: value,
|
|
6522
6568
|
options: options,
|
|
6523
6569
|
disabled: disabled,
|
|
@@ -6536,15 +6582,339 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6536
6582
|
]
|
|
6537
6583
|
});
|
|
6538
6584
|
});
|
|
6539
|
-
// src/
|
|
6540
|
-
var
|
|
6541
|
-
var import_antd34 = require("antd");
|
|
6585
|
+
// src/EffectSearchSelect/index.tsx
|
|
6586
|
+
var import_react46 = __toESM(require("react"));
|
|
6542
6587
|
var import_react_use16 = require("react-use");
|
|
6543
|
-
|
|
6544
|
-
var import_react46 = require("react");
|
|
6588
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
6545
6589
|
var import_antd33 = require("antd");
|
|
6590
|
+
// src/EffectSearchSelect/index.module.less
|
|
6591
|
+
var index_module_default18 = {
|
|
6592
|
+
search_select_wrap: "index_module_search_select_wrap",
|
|
6593
|
+
source_select: "index_module_source_select",
|
|
6594
|
+
value_select: "index_module_value_select"
|
|
6595
|
+
};
|
|
6596
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6597
|
+
var import_immutable7 = __toESM(require("swr/immutable"));
|
|
6598
|
+
// src/EffectSearchSelect/utils.ts
|
|
6599
|
+
var DEFAULT_SEARCH_PAGE_SIZE = 20;
|
|
6600
|
+
var DEFAULT_SEARCH_MIN_LENGTH = 1;
|
|
6601
|
+
var DEFAULT_MERCHANT_SEARCH_CACHE_KEY = "merchant/list";
|
|
6602
|
+
var DEFAULT_MERCHANT_SOURCE_VALUE = "enterpriseNo";
|
|
6603
|
+
var defaultMerchantSearchSources2 = [
|
|
6604
|
+
{
|
|
6605
|
+
label: "\u5546\u6237\u53F7",
|
|
6606
|
+
value: "enterpriseNo"
|
|
6607
|
+
},
|
|
6608
|
+
{
|
|
6609
|
+
label: "\u5E73\u53F0\u540D",
|
|
6610
|
+
value: "platformName"
|
|
6611
|
+
},
|
|
6612
|
+
{
|
|
6613
|
+
label: "\u5546\u6237\u540D",
|
|
6614
|
+
value: "name"
|
|
6615
|
+
},
|
|
6616
|
+
{
|
|
6617
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6618
|
+
value: "phone"
|
|
6619
|
+
}
|
|
6620
|
+
];
|
|
6621
|
+
var defaultTransformMerchantOptions = function defaultTransformMerchantOptions(data, context) {
|
|
6622
|
+
return (data.list || []).map(function(item) {
|
|
6623
|
+
return {
|
|
6624
|
+
label: getMerchantSourceLabel(item, context.source.value),
|
|
6625
|
+
value: item.enterpriseNo,
|
|
6626
|
+
raw: item
|
|
6627
|
+
};
|
|
6628
|
+
});
|
|
6629
|
+
};
|
|
6630
|
+
var getMerchantSourceLabel = function getMerchantSourceLabel(item, sourceValue) {
|
|
6631
|
+
var sourceLabelMap = {
|
|
6632
|
+
enterpriseNo: item.enterpriseNo,
|
|
6633
|
+
platformName: item.platformName,
|
|
6634
|
+
name: item.name,
|
|
6635
|
+
// 目前接口没有手机号,先放空字符串,后续如果接口增加了手机号字段再修改这里
|
|
6636
|
+
phone: ""
|
|
6637
|
+
};
|
|
6638
|
+
return sourceLabelMap[sourceValue] || [
|
|
6639
|
+
item.enterpriseNo,
|
|
6640
|
+
item.platformName,
|
|
6641
|
+
item.name
|
|
6642
|
+
].filter(Boolean).join(" - ");
|
|
6643
|
+
};
|
|
6644
|
+
var getDefaultSourceValue = function getDefaultSourceValue(sources, defaultSourceValue) {
|
|
6645
|
+
var _sources_;
|
|
6646
|
+
if (defaultSourceValue && sources.some(function(source) {
|
|
6647
|
+
return source.value === defaultSourceValue;
|
|
6648
|
+
})) {
|
|
6649
|
+
return defaultSourceValue;
|
|
6650
|
+
}
|
|
6651
|
+
return (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value;
|
|
6652
|
+
};
|
|
6653
|
+
var getCurrentSource = function getCurrentSource(sources, selectedSourceValue) {
|
|
6654
|
+
return sources.find(function(source) {
|
|
6655
|
+
return source.value === selectedSourceValue;
|
|
6656
|
+
}) || sources[0];
|
|
6657
|
+
};
|
|
6658
|
+
var buildDefaultSearchParams = function buildDefaultSearchParams(keyword, source, baseParams, pageSize) {
|
|
6659
|
+
return _object_spread_props(_object_spread({
|
|
6660
|
+
page: 1,
|
|
6661
|
+
pageSize: pageSize
|
|
6662
|
+
}, baseParams), _define_property({}, source.value, keyword));
|
|
6663
|
+
};
|
|
6664
|
+
var normalizeSelectValue = function normalizeSelectValue(value) {
|
|
6665
|
+
return value === null ? void 0 : value;
|
|
6666
|
+
};
|
|
6667
|
+
var normalizeSelectedOption = function normalizeSelectedOption(option) {
|
|
6668
|
+
var selectedOption = Array.isArray(option) ? option[0] : option;
|
|
6669
|
+
return selectedOption ? selectedOption : void 0;
|
|
6670
|
+
};
|
|
6671
|
+
var resolveMergedDefaultSourceValue = function resolveMergedDefaultSourceValue(sources, defaultSourceValue, hasCustomSources) {
|
|
6672
|
+
var _sources_;
|
|
6673
|
+
if (defaultSourceValue) return defaultSourceValue;
|
|
6674
|
+
return hasCustomSources ? (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value : DEFAULT_MERCHANT_SOURCE_VALUE;
|
|
6675
|
+
};
|
|
6676
|
+
var resolveNotFoundContent = function resolveNotFoundContent(params) {
|
|
6677
|
+
var error = params.error, isLoading = params.isLoading, keyword = params.keyword, sourceLabel = params.sourceLabel, defaultPlaceholder = params.defaultPlaceholder;
|
|
6678
|
+
if (error) return error.message || "\u67E5\u8BE2\u5931\u8D25";
|
|
6679
|
+
if (isLoading) return "\u641C\u7D22\u4E2D";
|
|
6680
|
+
if (keyword) return "输入的".concat(sourceLabel, "未查询到信息");
|
|
6681
|
+
return defaultPlaceholder;
|
|
6682
|
+
};
|
|
6683
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6684
|
+
function useEffectSearchOptions(params) {
|
|
6685
|
+
var config = useRequestConfig().config;
|
|
6686
|
+
var cacheKey = params.cacheKey, keyword = params.keyword, source = params.source, enabled = params.enabled, fetchParams = params.fetchParams, pageSize = params.pageSize, request = params.request, buildParams = params.buildParams, transformOptions = params.transformOptions;
|
|
6687
|
+
var swrKey = enabled && source ? [
|
|
6688
|
+
"EffectSearchSelect",
|
|
6689
|
+
cacheKey,
|
|
6690
|
+
source.value,
|
|
6691
|
+
keyword,
|
|
6692
|
+
fetchParams,
|
|
6693
|
+
pageSize
|
|
6694
|
+
] : null;
|
|
6695
|
+
var _ref = (0, import_immutable7.default)(swrKey, function() {
|
|
6696
|
+
return _async_to_generator(function() {
|
|
6697
|
+
var requestParams, response;
|
|
6698
|
+
return _ts_generator(this, function(_state) {
|
|
6699
|
+
switch(_state.label){
|
|
6700
|
+
case 0:
|
|
6701
|
+
if (!source) return [
|
|
6702
|
+
2,
|
|
6703
|
+
[]
|
|
6704
|
+
];
|
|
6705
|
+
requestParams = buildParams ? buildParams(keyword, source, fetchParams) : buildDefaultSearchParams(keyword, source, fetchParams, pageSize);
|
|
6706
|
+
return [
|
|
6707
|
+
4,
|
|
6708
|
+
request(requestParams, config)
|
|
6709
|
+
];
|
|
6710
|
+
case 1:
|
|
6711
|
+
response = _state.sent();
|
|
6712
|
+
if ((response === null || response === void 0 ? void 0 : response.code) !== 200) {
|
|
6713
|
+
throw new Error((response === null || response === void 0 ? void 0 : response.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6714
|
+
}
|
|
6715
|
+
return [
|
|
6716
|
+
2,
|
|
6717
|
+
transformOptions(response.data, {
|
|
6718
|
+
source: source,
|
|
6719
|
+
keyword: keyword
|
|
6720
|
+
})
|
|
6721
|
+
];
|
|
6722
|
+
}
|
|
6723
|
+
});
|
|
6724
|
+
})();
|
|
6725
|
+
}, {
|
|
6726
|
+
errorRetryCount: 0,
|
|
6727
|
+
shouldRetryOnError: false
|
|
6728
|
+
}), data = _ref.data, error = _ref.error, isLoading = _ref.isLoading, mutate = _ref.mutate;
|
|
6729
|
+
return {
|
|
6730
|
+
options: data || [],
|
|
6731
|
+
error: error,
|
|
6732
|
+
isLoading: isLoading,
|
|
6733
|
+
mutate: mutate
|
|
6734
|
+
};
|
|
6735
|
+
}
|
|
6736
|
+
// src/EffectSearchSelect/index.tsx
|
|
6546
6737
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6547
|
-
var
|
|
6738
|
+
var EMPTY_FETCH_PARAMS = {};
|
|
6739
|
+
var EffectSearchSelectBase = function EffectSearchSelectBase(props) {
|
|
6740
|
+
var _ref;
|
|
6741
|
+
var className = props.className, style = props.style, value = props.value, defaultValue = props.defaultValue, disabled = props.disabled, placeholder = props.placeholder, notFoundContent = props.notFoundContent, sources = props.sources, defaultSourceValue = props.defaultSourceValue, _props_fetchParams = props.fetchParams, fetchParams = _props_fetchParams === void 0 ? EMPTY_FETCH_PARAMS : _props_fetchParams, _props_pageSize = props.pageSize, pageSize = _props_pageSize === void 0 ? DEFAULT_SEARCH_PAGE_SIZE : _props_pageSize, request = props.request, buildParams = props.buildParams, transformOptions = props.transformOptions, onChange = props.onChange, onClear = props.onClear, selectProps = _object_without_properties(props, [
|
|
6742
|
+
"className",
|
|
6743
|
+
"style",
|
|
6744
|
+
"value",
|
|
6745
|
+
"defaultValue",
|
|
6746
|
+
"disabled",
|
|
6747
|
+
"placeholder",
|
|
6748
|
+
"notFoundContent",
|
|
6749
|
+
"sources",
|
|
6750
|
+
"defaultSourceValue",
|
|
6751
|
+
"fetchParams",
|
|
6752
|
+
"pageSize",
|
|
6753
|
+
"request",
|
|
6754
|
+
"buildParams",
|
|
6755
|
+
"transformOptions",
|
|
6756
|
+
"onChange",
|
|
6757
|
+
"onClear"
|
|
6758
|
+
]);
|
|
6759
|
+
var apiService = useRequestConfig().apiService;
|
|
6760
|
+
var valueControlledRef = (0, import_react46.useRef)(Object.prototype.hasOwnProperty.call(props, "value"));
|
|
6761
|
+
var valueControlled = valueControlledRef.current;
|
|
6762
|
+
var hasCustomSources = Boolean(sources === null || sources === void 0 ? void 0 : sources.length);
|
|
6763
|
+
var mergedSources = (0, import_react46.useMemo)(function() {
|
|
6764
|
+
return hasCustomSources ? sources : defaultMerchantSearchSources2;
|
|
6765
|
+
}, [
|
|
6766
|
+
hasCustomSources,
|
|
6767
|
+
sources
|
|
6768
|
+
]);
|
|
6769
|
+
var mergedDefaultSourceValue = (0, import_react46.useMemo)(function() {
|
|
6770
|
+
return resolveMergedDefaultSourceValue(mergedSources, defaultSourceValue, hasCustomSources);
|
|
6771
|
+
}, [
|
|
6772
|
+
defaultSourceValue,
|
|
6773
|
+
hasCustomSources,
|
|
6774
|
+
mergedSources
|
|
6775
|
+
]);
|
|
6776
|
+
var _ref1 = _sliced_to_array((0, import_react46.useState)(function() {
|
|
6777
|
+
return getDefaultSourceValue(mergedSources, mergedDefaultSourceValue);
|
|
6778
|
+
}), 2), innerSourceValue = _ref1[0], setInnerSourceValue = _ref1[1];
|
|
6779
|
+
var currentSource = getCurrentSource(mergedSources, innerSourceValue);
|
|
6780
|
+
var currentSourceValue = currentSource === null || currentSource === void 0 ? void 0 : currentSource.value;
|
|
6781
|
+
(0, import_react46.useEffect)(function() {
|
|
6782
|
+
var isCurrentSourceValid = mergedSources.some(function(source) {
|
|
6783
|
+
return source.value === innerSourceValue;
|
|
6784
|
+
});
|
|
6785
|
+
if (!isCurrentSourceValid) {
|
|
6786
|
+
setInnerSourceValue(getDefaultSourceValue(mergedSources, mergedDefaultSourceValue));
|
|
6787
|
+
}
|
|
6788
|
+
}, [
|
|
6789
|
+
innerSourceValue,
|
|
6790
|
+
mergedDefaultSourceValue,
|
|
6791
|
+
mergedSources
|
|
6792
|
+
]);
|
|
6793
|
+
var _ref2 = _sliced_to_array((0, import_react46.useState)(function() {
|
|
6794
|
+
return normalizeSelectValue(value !== null && value !== void 0 ? value : defaultValue);
|
|
6795
|
+
}), 2), innerValue = _ref2[0], setInnerValue = _ref2[1];
|
|
6796
|
+
var mergedValue = valueControlled ? normalizeSelectValue(value) : innerValue;
|
|
6797
|
+
var _ref3 = _sliced_to_array((0, import_react46.useState)(""), 2), searchText = _ref3[0], setSearchText = _ref3[1];
|
|
6798
|
+
var _ref4 = _sliced_to_array((0, import_react46.useState)(""), 2), keyword = _ref4[0], setKeyword = _ref4[1];
|
|
6799
|
+
(0, import_react_use16.useDebounce)(function() {
|
|
6800
|
+
setKeyword(searchText.trim());
|
|
6801
|
+
}, 600, [
|
|
6802
|
+
searchText
|
|
6803
|
+
]);
|
|
6804
|
+
var requestFn = request || apiService.merchantList;
|
|
6805
|
+
var transformOptionsFn = transformOptions || defaultTransformMerchantOptions;
|
|
6806
|
+
var searchEnabled = Boolean(currentSource && keyword.length >= DEFAULT_SEARCH_MIN_LENGTH);
|
|
6807
|
+
var searchCacheKey = request ? request.name || "custom" : DEFAULT_MERCHANT_SEARCH_CACHE_KEY;
|
|
6808
|
+
var _useEffectSearchOptions = useEffectSearchOptions({
|
|
6809
|
+
cacheKey: searchCacheKey,
|
|
6810
|
+
keyword: keyword,
|
|
6811
|
+
source: currentSource,
|
|
6812
|
+
enabled: searchEnabled,
|
|
6813
|
+
fetchParams: fetchParams,
|
|
6814
|
+
pageSize: pageSize,
|
|
6815
|
+
request: requestFn,
|
|
6816
|
+
buildParams: buildParams,
|
|
6817
|
+
transformOptions: transformOptionsFn
|
|
6818
|
+
}), options = _useEffectSearchOptions.options, isLoading = _useEffectSearchOptions.isLoading, error = _useEffectSearchOptions.error;
|
|
6819
|
+
var resetSearchAndValue = (0, import_react46.useCallback)(function() {
|
|
6820
|
+
setSearchText("");
|
|
6821
|
+
setKeyword("");
|
|
6822
|
+
if (!valueControlled) {
|
|
6823
|
+
setInnerValue(void 0);
|
|
6824
|
+
}
|
|
6825
|
+
}, [
|
|
6826
|
+
valueControlled
|
|
6827
|
+
]);
|
|
6828
|
+
var handleSourceChange = (0, import_react46.useCallback)(function(nextSourceValue) {
|
|
6829
|
+
setInnerSourceValue(nextSourceValue);
|
|
6830
|
+
resetSearchAndValue();
|
|
6831
|
+
}, [
|
|
6832
|
+
resetSearchAndValue
|
|
6833
|
+
]);
|
|
6834
|
+
var handleSearch = (0, import_react46.useCallback)(function(nextSearchText) {
|
|
6835
|
+
setSearchText(nextSearchText);
|
|
6836
|
+
}, []);
|
|
6837
|
+
var handleChange = (0, import_react46.useCallback)(function(nextValue, option) {
|
|
6838
|
+
var selectedOption = normalizeSelectedOption(option);
|
|
6839
|
+
var normalizedValue = normalizeSelectValue(nextValue);
|
|
6840
|
+
if (!valueControlled) {
|
|
6841
|
+
setInnerValue(normalizedValue);
|
|
6842
|
+
}
|
|
6843
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(normalizedValue, selectedOption);
|
|
6844
|
+
}, [
|
|
6845
|
+
onChange,
|
|
6846
|
+
valueControlled
|
|
6847
|
+
]);
|
|
6848
|
+
var handleClear = (0, import_react46.useCallback)(function() {
|
|
6849
|
+
resetSearchAndValue();
|
|
6850
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
6851
|
+
}, [
|
|
6852
|
+
onClear,
|
|
6853
|
+
resetSearchAndValue
|
|
6854
|
+
]);
|
|
6855
|
+
var sourceOptions = (0, import_react46.useMemo)(function() {
|
|
6856
|
+
return mergedSources.map(function(param) {
|
|
6857
|
+
var label = param.label, val = param.value;
|
|
6858
|
+
return {
|
|
6859
|
+
label: label,
|
|
6860
|
+
value: val
|
|
6861
|
+
};
|
|
6862
|
+
});
|
|
6863
|
+
}, [
|
|
6864
|
+
mergedSources
|
|
6865
|
+
]);
|
|
6866
|
+
var sourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6867
|
+
var defaultPlaceholder = sourceLabel ? "请输入".concat(sourceLabel) : "\u8BF7\u8F93\u5165";
|
|
6868
|
+
var defaultNotFoundContent = resolveNotFoundContent({
|
|
6869
|
+
error: error,
|
|
6870
|
+
isLoading: isLoading,
|
|
6871
|
+
keyword: keyword,
|
|
6872
|
+
sourceLabel: sourceLabel,
|
|
6873
|
+
defaultPlaceholder: defaultPlaceholder
|
|
6874
|
+
});
|
|
6875
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_antd33.Space.Compact, {
|
|
6876
|
+
className: index_module_default18.search_select_wrap,
|
|
6877
|
+
style: style,
|
|
6878
|
+
children: [
|
|
6879
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd33.Select, {
|
|
6880
|
+
className: index_module_default18.source_select,
|
|
6881
|
+
disabled: disabled,
|
|
6882
|
+
value: currentSourceValue,
|
|
6883
|
+
options: sourceOptions,
|
|
6884
|
+
popupMatchSelectWidth: false,
|
|
6885
|
+
onChange: handleSourceChange
|
|
6886
|
+
}),
|
|
6887
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_antd33.Select, _object_spread_props(_object_spread({}, selectProps), {
|
|
6888
|
+
className: (0, import_classnames13.default)(index_module_default18.value_select, className),
|
|
6889
|
+
disabled: disabled,
|
|
6890
|
+
value: mergedValue,
|
|
6891
|
+
options: options,
|
|
6892
|
+
loading: isLoading,
|
|
6893
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
|
|
6894
|
+
notFoundContent: notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : defaultNotFoundContent,
|
|
6895
|
+
showSearch: true,
|
|
6896
|
+
allowClear: true,
|
|
6897
|
+
defaultActiveFirstOption: false,
|
|
6898
|
+
filterOption: false,
|
|
6899
|
+
popupMatchSelectWidth: false,
|
|
6900
|
+
optionFilterProp: "label",
|
|
6901
|
+
onSearch: handleSearch,
|
|
6902
|
+
onChange: handleChange,
|
|
6903
|
+
onClear: handleClear
|
|
6904
|
+
}))
|
|
6905
|
+
]
|
|
6906
|
+
});
|
|
6907
|
+
};
|
|
6908
|
+
var EffectSearchSelect = import_react46.default.memo(EffectSearchSelectBase);
|
|
6909
|
+
// src/EffectScopeSelect/index.tsx
|
|
6910
|
+
var import_react48 = require("react");
|
|
6911
|
+
var import_antd35 = require("antd");
|
|
6912
|
+
var import_react_use17 = require("react-use");
|
|
6913
|
+
// src/EffectScopeSelect/ScopeViewMode.tsx
|
|
6914
|
+
var import_react47 = require("react");
|
|
6915
|
+
var import_antd34 = require("antd");
|
|
6916
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
6917
|
+
var ScopeViewMode = (0, import_react47.memo)(function(props) {
|
|
6548
6918
|
var _ref = props || {}, categoryIds = _ref.categoryIds, categoryName = _ref.categoryName, brandId = _ref.brandId, brandName = _ref.brandName, seriesId = _ref.seriesId, seriesName = _ref.seriesName, spuId = _ref.spuId, spuName = _ref.spuName, skuId = _ref.skuId, skuName = _ref.skuName;
|
|
6549
6919
|
var items = [];
|
|
6550
6920
|
if ((categoryName === null || categoryName === void 0 ? void 0 : categoryName.length) || (categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length)) items.push({
|
|
@@ -6567,18 +6937,18 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6567
6937
|
label: "SKU",
|
|
6568
6938
|
value: skuName || String(skuId)
|
|
6569
6939
|
});
|
|
6570
|
-
if (items.length === 0) return /* @__PURE__ */ (0,
|
|
6940
|
+
if (items.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Typography.Text, {
|
|
6571
6941
|
style: {
|
|
6572
6942
|
fontSize: 14
|
|
6573
6943
|
},
|
|
6574
6944
|
type: "danger",
|
|
6575
6945
|
children: "\u8BF7\u5148\u9009\u62E9\u54C1\u7C7B\u4FE1\u606F"
|
|
6576
6946
|
});
|
|
6577
|
-
return /* @__PURE__ */ (0,
|
|
6947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Space, {
|
|
6578
6948
|
size: 4,
|
|
6579
6949
|
children: items.map(function(param) {
|
|
6580
6950
|
var label = param.label, value = param.value;
|
|
6581
|
-
return /* @__PURE__ */ (0,
|
|
6951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_antd34.Space, {
|
|
6582
6952
|
size: 4,
|
|
6583
6953
|
style: {
|
|
6584
6954
|
height: 32,
|
|
@@ -6586,7 +6956,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6586
6956
|
borderRadius: 6
|
|
6587
6957
|
},
|
|
6588
6958
|
children: [
|
|
6589
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_antd34.Typography.Text, {
|
|
6590
6960
|
style: {
|
|
6591
6961
|
fontSize: 14,
|
|
6592
6962
|
paddingRight: 16
|
|
@@ -6596,7 +6966,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6596
6966
|
":"
|
|
6597
6967
|
]
|
|
6598
6968
|
}),
|
|
6599
|
-
/* @__PURE__ */ (0,
|
|
6969
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Typography.Text, {
|
|
6600
6970
|
style: {
|
|
6601
6971
|
fontSize: 14
|
|
6602
6972
|
},
|
|
@@ -6608,7 +6978,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6608
6978
|
});
|
|
6609
6979
|
});
|
|
6610
6980
|
// src/EffectScopeSelect/index.tsx
|
|
6611
|
-
var
|
|
6981
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6612
6982
|
var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
6613
6983
|
ScopeLevelEnum2[ScopeLevelEnum2["CATEGORY"] = 1] = "CATEGORY";
|
|
6614
6984
|
ScopeLevelEnum2[ScopeLevelEnum2["BRAND"] = 2] = "BRAND";
|
|
@@ -6617,28 +6987,28 @@ var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
|
6617
6987
|
ScopeLevelEnum2[ScopeLevelEnum2["SKU"] = 5] = "SKU";
|
|
6618
6988
|
return ScopeLevelEnum2;
|
|
6619
6989
|
}(ScopeLevelEnum || {});
|
|
6620
|
-
var EffectScopeSelect = (0,
|
|
6990
|
+
var EffectScopeSelect = (0, import_react48.memo)(function(props) {
|
|
6621
6991
|
var controlledValue = props.value, defaultValue = props.defaultValue, _props_scopeLevel = props.scopeLevel, scopeLevel = _props_scopeLevel === void 0 ? 5 /* SKU */ : _props_scopeLevel, _props_requireLevel = props.requireLevel, requireLevel = _props_requireLevel === void 0 ? 1 /* CATEGORY */ : _props_requireLevel, categoryChangeOnSelect = props.categoryChangeOnSelect, onChange = props.onChange, _props_mode = props.mode, mode = _props_mode === void 0 ? "edit" : _props_mode;
|
|
6622
|
-
var _ref = _sliced_to_array((0,
|
|
6623
|
-
var lastLevelCategoryId = (0,
|
|
6992
|
+
var _ref = _sliced_to_array((0, import_react48.useState)(_object_spread({}, controlledValue, defaultValue)), 2), value = _ref[0], setValue = _ref[1];
|
|
6993
|
+
var lastLevelCategoryId = (0, import_react48.useMemo)(function() {
|
|
6624
6994
|
var _value_categoryIds;
|
|
6625
6995
|
return (_value_categoryIds = value.categoryIds) === null || _value_categoryIds === void 0 ? void 0 : _value_categoryIds[value.categoryIds.length - 1];
|
|
6626
6996
|
}, [
|
|
6627
6997
|
value.categoryIds
|
|
6628
6998
|
]);
|
|
6629
|
-
(0,
|
|
6999
|
+
(0, import_react_use17.useUpdateEffect)(function() {
|
|
6630
7000
|
setValue(_object_spread({}, controlledValue));
|
|
6631
7001
|
}, [
|
|
6632
7002
|
controlledValue
|
|
6633
7003
|
]);
|
|
6634
|
-
var handleChange = (0,
|
|
7004
|
+
var handleChange = (0, import_react48.useCallback)(function(newValue) {
|
|
6635
7005
|
setTimeout(function() {
|
|
6636
7006
|
return onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
6637
7007
|
}, 0);
|
|
6638
7008
|
}, [
|
|
6639
7009
|
onChange
|
|
6640
7010
|
]);
|
|
6641
|
-
var handleCategoryChange = (0,
|
|
7011
|
+
var handleCategoryChange = (0, import_react48.useCallback)(function(_values, selectedList) {
|
|
6642
7012
|
if (!selectedList || !isSingleTreeSelected(selectedList)) {
|
|
6643
7013
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange();
|
|
6644
7014
|
return;
|
|
@@ -6657,7 +7027,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6657
7027
|
handleChange,
|
|
6658
7028
|
requireLevel
|
|
6659
7029
|
]);
|
|
6660
|
-
var handleBrandChange = (0,
|
|
7030
|
+
var handleBrandChange = (0, import_react48.useCallback)(function(brandValue) {
|
|
6661
7031
|
var brandId = brandValue === void 0 ? void 0 : Number(brandValue);
|
|
6662
7032
|
setValue(function(prev) {
|
|
6663
7033
|
var newScope = {
|
|
@@ -6673,7 +7043,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6673
7043
|
handleChange,
|
|
6674
7044
|
requireLevel
|
|
6675
7045
|
]);
|
|
6676
|
-
var handleSeriesChange = (0,
|
|
7046
|
+
var handleSeriesChange = (0, import_react48.useCallback)(function(seriesValue) {
|
|
6677
7047
|
var seriesId = seriesValue === void 0 ? void 0 : Number(seriesValue);
|
|
6678
7048
|
setValue(function(prev) {
|
|
6679
7049
|
var newScope = {
|
|
@@ -6690,7 +7060,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6690
7060
|
handleChange,
|
|
6691
7061
|
requireLevel
|
|
6692
7062
|
]);
|
|
6693
|
-
var handleSpuChange = (0,
|
|
7063
|
+
var handleSpuChange = (0, import_react48.useCallback)(function(spuValue) {
|
|
6694
7064
|
var spuId = spuValue === void 0 ? void 0 : Number(spuValue);
|
|
6695
7065
|
setValue(function(prev) {
|
|
6696
7066
|
var newScope = {
|
|
@@ -6708,7 +7078,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6708
7078
|
handleChange,
|
|
6709
7079
|
requireLevel
|
|
6710
7080
|
]);
|
|
6711
|
-
var handleSkuChange = (0,
|
|
7081
|
+
var handleSkuChange = (0, import_react48.useCallback)(function(skuValue) {
|
|
6712
7082
|
var skuId = skuValue === void 0 ? void 0 : Number(skuValue);
|
|
6713
7083
|
setValue(function(prev) {
|
|
6714
7084
|
var newScope = _object_spread_props(_object_spread({}, prev), {
|
|
@@ -6723,18 +7093,18 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6723
7093
|
handleChange,
|
|
6724
7094
|
requireLevel
|
|
6725
7095
|
]);
|
|
6726
|
-
var renderLabel = (0,
|
|
6727
|
-
return /* @__PURE__ */ (0,
|
|
7096
|
+
var renderLabel = (0, import_react48.useCallback)(function(label, required) {
|
|
7097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_antd35.Flex, {
|
|
6728
7098
|
flex: "0 0 auto",
|
|
6729
|
-
children: /* @__PURE__ */ (0,
|
|
7099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Space, {
|
|
6730
7100
|
children: [
|
|
6731
|
-
required && /* @__PURE__ */ (0,
|
|
7101
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", {
|
|
6732
7102
|
style: {
|
|
6733
7103
|
color: "var(--ant-color-error)"
|
|
6734
7104
|
},
|
|
6735
7105
|
children: "*"
|
|
6736
7106
|
}),
|
|
6737
|
-
/* @__PURE__ */ (0,
|
|
7107
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", {
|
|
6738
7108
|
children: [
|
|
6739
7109
|
label,
|
|
6740
7110
|
":"
|
|
@@ -6745,34 +7115,34 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6745
7115
|
});
|
|
6746
7116
|
}, []);
|
|
6747
7117
|
if (mode === "view") {
|
|
6748
|
-
return /* @__PURE__ */ (0,
|
|
7118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ScopeViewMode, _object_spread({}, value));
|
|
6749
7119
|
}
|
|
6750
|
-
return /* @__PURE__ */ (0,
|
|
7120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6751
7121
|
justify: "flex-start",
|
|
6752
7122
|
align: "center",
|
|
6753
7123
|
wrap: "nowrap",
|
|
6754
7124
|
gap: "15px",
|
|
6755
7125
|
children: [
|
|
6756
|
-
/* @__PURE__ */ (0,
|
|
7126
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6757
7127
|
align: "center",
|
|
6758
7128
|
gap: "5px",
|
|
6759
7129
|
flex: "0 0 auto",
|
|
6760
7130
|
children: [
|
|
6761
7131
|
renderLabel("\u5206\u7C7B", requireLevel >= 1 /* CATEGORY */ ),
|
|
6762
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectCategoryCascade, {
|
|
6763
7133
|
onChange: handleCategoryChange,
|
|
6764
7134
|
changeOnSelect: categoryChangeOnSelect,
|
|
6765
7135
|
value: value.categoryIds
|
|
6766
7136
|
})
|
|
6767
7137
|
]
|
|
6768
7138
|
}),
|
|
6769
|
-
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ (0,
|
|
7139
|
+
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6770
7140
|
align: "center",
|
|
6771
7141
|
gap: "5px",
|
|
6772
7142
|
flex: "0 0 auto",
|
|
6773
7143
|
children: [
|
|
6774
7144
|
renderLabel("\u54C1\u724C", requireLevel >= 2 /* BRAND */ ),
|
|
6775
|
-
/* @__PURE__ */ (0,
|
|
7145
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectBrandSelect, _object_spread_props(_object_spread({
|
|
6776
7146
|
categoryId: lastLevelCategoryId
|
|
6777
7147
|
}, value), {
|
|
6778
7148
|
onChange: handleBrandChange,
|
|
@@ -6780,13 +7150,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6780
7150
|
}))
|
|
6781
7151
|
]
|
|
6782
7152
|
}),
|
|
6783
|
-
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ (0,
|
|
7153
|
+
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6784
7154
|
align: "center",
|
|
6785
7155
|
gap: "5px",
|
|
6786
7156
|
flex: "0 0 auto",
|
|
6787
7157
|
children: [
|
|
6788
7158
|
renderLabel("\u7CFB\u5217", requireLevel >= 3 /* SERIES */ ),
|
|
6789
|
-
/* @__PURE__ */ (0,
|
|
7159
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSeriesSelect, _object_spread_props(_object_spread({
|
|
6790
7160
|
categoryId: lastLevelCategoryId
|
|
6791
7161
|
}, value), {
|
|
6792
7162
|
onChange: handleSeriesChange,
|
|
@@ -6794,13 +7164,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6794
7164
|
}))
|
|
6795
7165
|
]
|
|
6796
7166
|
}),
|
|
6797
|
-
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ (0,
|
|
7167
|
+
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6798
7168
|
align: "center",
|
|
6799
7169
|
gap: "5px",
|
|
6800
7170
|
flex: "0 0 auto",
|
|
6801
7171
|
children: [
|
|
6802
7172
|
renderLabel("SPU", requireLevel >= 4 /* SPU */ ),
|
|
6803
|
-
/* @__PURE__ */ (0,
|
|
7173
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSpuSelect, _object_spread_props(_object_spread({
|
|
6804
7174
|
categoryId: lastLevelCategoryId
|
|
6805
7175
|
}, value), {
|
|
6806
7176
|
onChange: handleSpuChange,
|
|
@@ -6808,13 +7178,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6808
7178
|
}))
|
|
6809
7179
|
]
|
|
6810
7180
|
}),
|
|
6811
|
-
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ (0,
|
|
7181
|
+
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6812
7182
|
align: "center",
|
|
6813
7183
|
gap: "5px",
|
|
6814
7184
|
flex: "0 0 auto",
|
|
6815
7185
|
children: [
|
|
6816
7186
|
renderLabel("SKU", requireLevel >= 5 /* SKU */ ),
|
|
6817
|
-
/* @__PURE__ */ (0,
|
|
7187
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSkuSelect, _object_spread_props(_object_spread({
|
|
6818
7188
|
categoryId: lastLevelCategoryId
|
|
6819
7189
|
}, value), {
|
|
6820
7190
|
onChange: handleSkuChange,
|
|
@@ -6826,22 +7196,22 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6826
7196
|
});
|
|
6827
7197
|
});
|
|
6828
7198
|
// src/EffectStaffSelect/index.tsx
|
|
6829
|
-
var
|
|
6830
|
-
var
|
|
6831
|
-
var
|
|
6832
|
-
var
|
|
7199
|
+
var import_react49 = require("react");
|
|
7200
|
+
var import_react_use18 = require("react-use");
|
|
7201
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
7202
|
+
var import_antd36 = require("antd");
|
|
6833
7203
|
var import_tools11 = require("@xfe-repo/web-utils/tools");
|
|
6834
7204
|
// src/EffectStaffSelect/index.module.less
|
|
6835
|
-
var
|
|
7205
|
+
var index_module_default19 = {
|
|
6836
7206
|
select: "index_module_select4"
|
|
6837
7207
|
};
|
|
6838
7208
|
// src/EffectStaffSelect/index.tsx
|
|
6839
|
-
var
|
|
6840
|
-
var EffectStaffSelect = (0,
|
|
7209
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7210
|
+
var EffectStaffSelect = (0, import_react49.memo)(function(props) {
|
|
6841
7211
|
var _state_value_data, _state_value;
|
|
6842
7212
|
var onChange = props.onChange, deptId = props.deptId, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, placeholder = props.placeholder, style = props.style;
|
|
6843
|
-
var _ref = _sliced_to_array((0,
|
|
6844
|
-
var _ref1 = _sliced_to_array((0,
|
|
7213
|
+
var _ref = _sliced_to_array((0, import_react49.useState)([]), 2), options = _ref[0], setOptions = _ref[1];
|
|
7214
|
+
var _ref1 = _sliced_to_array((0, import_react49.useState)(controlValue !== null && controlValue !== void 0 ? controlValue : defaultValue), 2), value = _ref1[0], setValue = _ref1[1];
|
|
6845
7215
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6846
7216
|
var getBusinessOptions = function getBusinessOptions(businessName, currentDeptId) {
|
|
6847
7217
|
return _async_to_generator(function() {
|
|
@@ -6871,14 +7241,14 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6871
7241
|
});
|
|
6872
7242
|
})();
|
|
6873
7243
|
};
|
|
6874
|
-
var _ref2 = _sliced_to_array((0,
|
|
7244
|
+
var _ref2 = _sliced_to_array((0, import_react_use18.useAsyncFn)(getBusinessOptions, [
|
|
6875
7245
|
deptId,
|
|
6876
7246
|
config
|
|
6877
7247
|
]), 2), state = _ref2[0], searchFetch = _ref2[1];
|
|
6878
|
-
var debounceSearchFetch = (0,
|
|
7248
|
+
var debounceSearchFetch = (0, import_react49.useCallback)((0, import_tools11.debounce)(600, searchFetch), [
|
|
6879
7249
|
searchFetch
|
|
6880
7250
|
]);
|
|
6881
|
-
(0,
|
|
7251
|
+
(0, import_react49.useEffect)(function() {
|
|
6882
7252
|
var _state_value_data, _state_value;
|
|
6883
7253
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : (_state_value_data = _state_value.data) === null || _state_value_data === void 0 ? void 0 : _state_value_data.list)) {
|
|
6884
7254
|
return;
|
|
@@ -6894,12 +7264,12 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6894
7264
|
}, [
|
|
6895
7265
|
state
|
|
6896
7266
|
]);
|
|
6897
|
-
(0,
|
|
7267
|
+
(0, import_react_use18.useMount)(function() {
|
|
6898
7268
|
if (deptId) {
|
|
6899
7269
|
void searchFetch("", deptId);
|
|
6900
7270
|
}
|
|
6901
7271
|
});
|
|
6902
|
-
(0,
|
|
7272
|
+
(0, import_react_use18.useUpdateEffect)(function() {
|
|
6903
7273
|
setValue(controlValue);
|
|
6904
7274
|
if (!controlValue && deptId) {
|
|
6905
7275
|
void searchFetch("", deptId);
|
|
@@ -6908,7 +7278,7 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6908
7278
|
controlValue,
|
|
6909
7279
|
deptId
|
|
6910
7280
|
]);
|
|
6911
|
-
(0,
|
|
7281
|
+
(0, import_react_use18.useUpdateEffect)(function() {
|
|
6912
7282
|
setOptions([]);
|
|
6913
7283
|
if (deptId) {
|
|
6914
7284
|
void searchFetch("", deptId);
|
|
@@ -6933,8 +7303,8 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6933
7303
|
}
|
|
6934
7304
|
};
|
|
6935
7305
|
var defaultPlaceholder = deptId ? "\u8BF7\u9009\u62E9\u5458\u5DE5\u59D3\u540D" : "\u8BF7\u5148\u8F93\u5165\u5458\u5DE5\u59D3\u540D";
|
|
6936
|
-
return /* @__PURE__ */ (0,
|
|
6937
|
-
className: (0,
|
|
7306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd36.Select, {
|
|
7307
|
+
className: (0, import_classnames14.default)(index_module_default19.select, className),
|
|
6938
7308
|
style: style,
|
|
6939
7309
|
notFoundContent: state.loading ? "\u641C\u7D22\u4E2D" : ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : (_state_value_data = _state_value.data) === null || _state_value_data === void 0 ? void 0 : _state_value_data.total) === 0 ? "\u6682\u65E0\u6570\u636E" : defaultPlaceholder,
|
|
6940
7310
|
placeholder: placeholder || defaultPlaceholder,
|
|
@@ -6952,15 +7322,15 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6952
7322
|
});
|
|
6953
7323
|
});
|
|
6954
7324
|
// src/EffectReservoirSelect/EffectReservoirSelect.tsx
|
|
6955
|
-
var
|
|
6956
|
-
var
|
|
6957
|
-
var
|
|
6958
|
-
var
|
|
6959
|
-
var EffectReservoirSelect = (0,
|
|
7325
|
+
var import_react50 = require("react");
|
|
7326
|
+
var import_react_use19 = require("react-use");
|
|
7327
|
+
var import_antd37 = require("antd");
|
|
7328
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7329
|
+
var EffectReservoirSelect = (0, import_react50.memo)(function(props) {
|
|
6960
7330
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, _props_reservoirType = props.reservoirType, reservoirType = _props_reservoirType === void 0 ? "normal" : _props_reservoirType;
|
|
6961
|
-
var _ref = _sliced_to_array((0,
|
|
6962
|
-
var _ref1 = _sliced_to_array((0,
|
|
6963
|
-
var prevControlValue = (0,
|
|
7331
|
+
var _ref = _sliced_to_array((0, import_react50.useState)([]), 2), options = _ref[0], setOptions = _ref[1];
|
|
7332
|
+
var _ref1 = _sliced_to_array((0, import_react50.useState)(controlValue || defaultValue), 2), value = _ref1[0], setValue = _ref1[1];
|
|
7333
|
+
var prevControlValue = (0, import_react_use19.usePrevious)(controlValue);
|
|
6964
7334
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6965
7335
|
var get_reservoir_options = function get_reservoir_options() {
|
|
6966
7336
|
return _async_to_generator(function() {
|
|
@@ -6989,10 +7359,10 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
6989
7359
|
});
|
|
6990
7360
|
})();
|
|
6991
7361
|
};
|
|
6992
|
-
var _ref2 = _sliced_to_array((0,
|
|
7362
|
+
var _ref2 = _sliced_to_array((0, import_react_use19.useAsyncFn)(get_reservoir_options, [
|
|
6993
7363
|
warehouseId
|
|
6994
7364
|
]), 2), state = _ref2[0], fetch = _ref2[1];
|
|
6995
|
-
(0,
|
|
7365
|
+
(0, import_react50.useEffect)(function() {
|
|
6996
7366
|
var _state_value;
|
|
6997
7367
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6998
7368
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -7007,10 +7377,10 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7007
7377
|
}, [
|
|
7008
7378
|
state
|
|
7009
7379
|
]);
|
|
7010
|
-
(0,
|
|
7380
|
+
(0, import_react_use19.useMount)(function() {
|
|
7011
7381
|
return void fetch();
|
|
7012
7382
|
});
|
|
7013
|
-
(0,
|
|
7383
|
+
(0, import_react_use19.useUpdateEffect)(function() {
|
|
7014
7384
|
if (controlValue && controlValue === prevControlValue) {
|
|
7015
7385
|
setValue(void 0);
|
|
7016
7386
|
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
@@ -7019,7 +7389,7 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7019
7389
|
}, [
|
|
7020
7390
|
warehouseId
|
|
7021
7391
|
]);
|
|
7022
|
-
(0,
|
|
7392
|
+
(0, import_react_use19.useUpdateEffect)(function() {
|
|
7023
7393
|
if (value === controlValue) return;
|
|
7024
7394
|
setValue(controlValue);
|
|
7025
7395
|
}, [
|
|
@@ -7043,21 +7413,21 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7043
7413
|
onChange: handleOnChange,
|
|
7044
7414
|
loading: state.loading
|
|
7045
7415
|
};
|
|
7046
|
-
return /* @__PURE__ */ (0,
|
|
7416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd37.Select, _object_spread({
|
|
7047
7417
|
className: className
|
|
7048
7418
|
}, selectBrandProps));
|
|
7049
7419
|
});
|
|
7050
7420
|
// src/EffectReservoirSelect/EffectShelveSelect.tsx
|
|
7051
|
-
var
|
|
7052
|
-
var
|
|
7053
|
-
var
|
|
7054
|
-
var
|
|
7055
|
-
var EffectShelveSelect = (0,
|
|
7421
|
+
var import_react51 = require("react");
|
|
7422
|
+
var import_react_use20 = require("react-use");
|
|
7423
|
+
var import_antd38 = require("antd");
|
|
7424
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7425
|
+
var EffectShelveSelect = (0, import_react51.memo)(function(props) {
|
|
7056
7426
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, reservoirId = props.reservoirId;
|
|
7057
7427
|
var _props_valueType = props.valueType, valueType = _props_valueType === void 0 ? "code" : _props_valueType;
|
|
7058
|
-
var _ref = _sliced_to_array((0,
|
|
7059
|
-
var _ref1 = _sliced_to_array((0,
|
|
7060
|
-
var prevControlValue = (0,
|
|
7428
|
+
var _ref = _sliced_to_array((0, import_react51.useState)([]), 2), options = _ref[0], setOptions = _ref[1];
|
|
7429
|
+
var _ref1 = _sliced_to_array((0, import_react51.useState)(controlValue || defaultValue), 2), value = _ref1[0], setValue = _ref1[1];
|
|
7430
|
+
var prevControlValue = (0, import_react_use20.usePrevious)(controlValue);
|
|
7061
7431
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7062
7432
|
var get_shelve_options = function get_shelve_options() {
|
|
7063
7433
|
return _async_to_generator(function() {
|
|
@@ -7086,11 +7456,11 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7086
7456
|
});
|
|
7087
7457
|
})();
|
|
7088
7458
|
};
|
|
7089
|
-
var _ref2 = _sliced_to_array((0,
|
|
7459
|
+
var _ref2 = _sliced_to_array((0, import_react_use20.useAsyncFn)(get_shelve_options, [
|
|
7090
7460
|
reservoirId,
|
|
7091
7461
|
warehouseId
|
|
7092
7462
|
]), 2), state = _ref2[0], fetch = _ref2[1];
|
|
7093
|
-
(0,
|
|
7463
|
+
(0, import_react51.useEffect)(function() {
|
|
7094
7464
|
var _state_value;
|
|
7095
7465
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7096
7466
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -7106,10 +7476,10 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7106
7476
|
}, [
|
|
7107
7477
|
state
|
|
7108
7478
|
]);
|
|
7109
|
-
(0,
|
|
7479
|
+
(0, import_react_use20.useMount)(function() {
|
|
7110
7480
|
return void fetch();
|
|
7111
7481
|
});
|
|
7112
|
-
(0,
|
|
7482
|
+
(0, import_react_use20.useUpdateEffect)(function() {
|
|
7113
7483
|
if (controlValue && controlValue === prevControlValue) {
|
|
7114
7484
|
setValue(void 0);
|
|
7115
7485
|
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
@@ -7119,7 +7489,7 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7119
7489
|
reservoirId,
|
|
7120
7490
|
warehouseId
|
|
7121
7491
|
]);
|
|
7122
|
-
(0,
|
|
7492
|
+
(0, import_react_use20.useUpdateEffect)(function() {
|
|
7123
7493
|
if (value === controlValue) return;
|
|
7124
7494
|
setValue(controlValue);
|
|
7125
7495
|
}, [
|
|
@@ -7143,16 +7513,16 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7143
7513
|
onChange: handleOnChange,
|
|
7144
7514
|
loading: state.loading
|
|
7145
7515
|
};
|
|
7146
|
-
return /* @__PURE__ */ (0,
|
|
7516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_antd38.Select, _object_spread({
|
|
7147
7517
|
className: className
|
|
7148
7518
|
}, selectBrandProps));
|
|
7149
7519
|
});
|
|
7150
7520
|
// src/EffectWarehouseSelect/index.tsx
|
|
7151
|
-
var
|
|
7152
|
-
var
|
|
7153
|
-
var
|
|
7521
|
+
var import_antd39 = require("antd");
|
|
7522
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
7523
|
+
var import_react52 = require("react");
|
|
7154
7524
|
// src/EffectWarehouseSelect/useStoreOptions.ts
|
|
7155
|
-
var
|
|
7525
|
+
var import_immutable8 = __toESM(require("swr/immutable"));
|
|
7156
7526
|
var transformStoreData = function transformStoreData() {
|
|
7157
7527
|
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
7158
7528
|
return list.map(function(item) {
|
|
@@ -7165,7 +7535,7 @@ var transformStoreData = function transformStoreData() {
|
|
|
7165
7535
|
function useStoreOptions() {
|
|
7166
7536
|
var currentMerchantOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, warehouseType = arguments.length > 1 ? arguments[1] : void 0;
|
|
7167
7537
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7168
|
-
var _ref = (0,
|
|
7538
|
+
var _ref = (0, import_immutable8.default)([
|
|
7169
7539
|
"warehouse/store/combo-box",
|
|
7170
7540
|
currentMerchantOnly,
|
|
7171
7541
|
warehouseType
|
|
@@ -7209,12 +7579,12 @@ function useStoreOptions() {
|
|
|
7209
7579
|
};
|
|
7210
7580
|
}
|
|
7211
7581
|
// src/EffectWarehouseSelect/index.module.less
|
|
7212
|
-
var
|
|
7582
|
+
var index_module_default20 = {
|
|
7213
7583
|
select: "index_module_select5"
|
|
7214
7584
|
};
|
|
7215
7585
|
// src/EffectWarehouseSelect/index.tsx
|
|
7216
|
-
var
|
|
7217
|
-
var EffectWarehouseSelect = (0,
|
|
7586
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7587
|
+
var EffectWarehouseSelect = (0, import_react52.memo)(function(props) {
|
|
7218
7588
|
var onChange = props.onChange, className = props.className, value = props.value, disabled = props.disabled, _props_currentMerchantOnly = props.currentMerchantOnly, currentMerchantOnly = _props_currentMerchantOnly === void 0 ? true : _props_currentMerchantOnly, warehouseType = props.warehouseType;
|
|
7219
7589
|
var state = useStoreOptions(currentMerchantOnly, warehouseType);
|
|
7220
7590
|
var handleChange = function handleChange(selectedValue, option) {
|
|
@@ -7224,8 +7594,8 @@ var EffectWarehouseSelect = (0, import_react51.memo)(function(props) {
|
|
|
7224
7594
|
var handleClear = function handleClear() {
|
|
7225
7595
|
onChange === null || onChange === void 0 ? void 0 : onChange(void 0, void 0);
|
|
7226
7596
|
};
|
|
7227
|
-
return /* @__PURE__ */ (0,
|
|
7228
|
-
className: (0,
|
|
7597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_antd39.Select, {
|
|
7598
|
+
className: (0, import_classnames15.default)(index_module_default20.select, className),
|
|
7229
7599
|
placeholder: "\u8BF7\u9009\u62E9\u4ED3\u5E93",
|
|
7230
7600
|
notFoundContent: state.isLoading ? "\u52A0\u8F7D\u4E2D..." : "\u6682\u65E0\u4ED3\u5E93\u6570\u636E",
|
|
7231
7601
|
loading: state.isLoading,
|
|
@@ -7237,22 +7607,22 @@ var EffectWarehouseSelect = (0, import_react51.memo)(function(props) {
|
|
|
7237
7607
|
});
|
|
7238
7608
|
});
|
|
7239
7609
|
// src/EffectAddressCascade/index.tsx
|
|
7240
|
-
var
|
|
7241
|
-
var
|
|
7242
|
-
var
|
|
7610
|
+
var import_react53 = require("react");
|
|
7611
|
+
var import_react_use21 = require("react-use");
|
|
7612
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
7243
7613
|
// src/EffectAddressCascade/index.module.less
|
|
7244
|
-
var
|
|
7614
|
+
var index_module_default21 = {
|
|
7245
7615
|
input: "index_module_input7",
|
|
7246
7616
|
select: "index_module_select6"
|
|
7247
7617
|
};
|
|
7248
7618
|
// src/EffectAddressCascade/index.tsx
|
|
7249
|
-
var
|
|
7250
|
-
var
|
|
7251
|
-
var EffectAddressCascade = (0,
|
|
7619
|
+
var import_antd40 = require("antd");
|
|
7620
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
7621
|
+
var EffectAddressCascade = (0, import_react53.memo)(function(props) {
|
|
7252
7622
|
var _selectedList_;
|
|
7253
7623
|
var className = props.className, disabled = props.disabled, defaultValue = props.defaultValue, onChange = props.onChange;
|
|
7254
|
-
var _ref = _sliced_to_array((0,
|
|
7255
|
-
var _ref1 = _sliced_to_array((0,
|
|
7624
|
+
var _ref = _sliced_to_array((0, import_react53.useState)(), 2), selectedList = _ref[0], setSelectedList = _ref[1];
|
|
7625
|
+
var _ref1 = _sliced_to_array((0, import_react53.useState)(), 2), customTree = _ref1[0], setCustomTree = _ref1[1];
|
|
7256
7626
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7257
7627
|
var params = {
|
|
7258
7628
|
pid: (selectedList === null || selectedList === void 0 ? void 0 : (_selectedList_ = selectedList[(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length) - 1]) === null || _selectedList_ === void 0 ? void 0 : _selectedList_.value) || ""
|
|
@@ -7275,10 +7645,10 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7275
7645
|
});
|
|
7276
7646
|
})();
|
|
7277
7647
|
};
|
|
7278
|
-
var _ref2 = _sliced_to_array((0,
|
|
7648
|
+
var _ref2 = _sliced_to_array((0, import_react_use21.useAsyncFn)(getAddress, [
|
|
7279
7649
|
selectedList
|
|
7280
7650
|
]), 2), state = _ref2[0], getAddressFetch = _ref2[1];
|
|
7281
|
-
(0,
|
|
7651
|
+
(0, import_react53.useEffect)(function() {
|
|
7282
7652
|
var _state_value;
|
|
7283
7653
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7284
7654
|
var list = state.value.data.list;
|
|
@@ -7316,7 +7686,7 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7316
7686
|
}, [
|
|
7317
7687
|
state
|
|
7318
7688
|
]);
|
|
7319
|
-
(0,
|
|
7689
|
+
(0, import_react53.useEffect)(function() {
|
|
7320
7690
|
if (!state.loading || !customTree || !selectedList) return;
|
|
7321
7691
|
var target = findTargetLeaf(selectedList, customTree);
|
|
7322
7692
|
if (!target) return;
|
|
@@ -7325,10 +7695,10 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7325
7695
|
}, [
|
|
7326
7696
|
state
|
|
7327
7697
|
]);
|
|
7328
|
-
(0,
|
|
7698
|
+
(0, import_react_use21.useMount)(function() {
|
|
7329
7699
|
void getAddressFetch();
|
|
7330
7700
|
});
|
|
7331
|
-
(0,
|
|
7701
|
+
(0, import_react53.useEffect)(function() {
|
|
7332
7702
|
var target = findTargetLeaf(selectedList || [], customTree || []);
|
|
7333
7703
|
if ((target === null || target === void 0 ? void 0 : target.isLeaf) || !(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length)) return;
|
|
7334
7704
|
void getAddressFetch();
|
|
@@ -7344,8 +7714,8 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7344
7714
|
setSelectedList(_selectedList);
|
|
7345
7715
|
if (onChange) onChange(_selectedList);
|
|
7346
7716
|
};
|
|
7347
|
-
return /* @__PURE__ */ (0,
|
|
7348
|
-
className: (0,
|
|
7717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_antd40.Cascader, {
|
|
7718
|
+
className: (0, import_classnames16.default)(index_module_default21.input, className),
|
|
7349
7719
|
disabled: disabled,
|
|
7350
7720
|
defaultValue: defaultValue,
|
|
7351
7721
|
multiple: false,
|
|
@@ -7379,11 +7749,11 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7379
7749
|
});
|
|
7380
7750
|
};
|
|
7381
7751
|
// src/EffectLabelSelect/index.tsx
|
|
7382
|
-
var
|
|
7383
|
-
var
|
|
7384
|
-
var
|
|
7752
|
+
var import_react54 = require("react");
|
|
7753
|
+
var import_react_use23 = require("react-use");
|
|
7754
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
7385
7755
|
// src/EffectLabelSelect/hooks.ts
|
|
7386
|
-
var
|
|
7756
|
+
var import_react_use22 = require("react-use");
|
|
7387
7757
|
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7388
7758
|
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7389
7759
|
var reqDataFn = function reqDataFn() {
|
|
@@ -7404,10 +7774,10 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7404
7774
|
});
|
|
7405
7775
|
})();
|
|
7406
7776
|
};
|
|
7407
|
-
var _ref = _sliced_to_array((0,
|
|
7777
|
+
var _ref = _sliced_to_array((0, import_react_use22.useAsyncFn)(reqDataFn, [
|
|
7408
7778
|
dependency
|
|
7409
7779
|
]), 2), resState = _ref[0], fetchData = _ref[1];
|
|
7410
|
-
(0,
|
|
7780
|
+
(0, import_react_use22.useDebounce)(function() {
|
|
7411
7781
|
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7412
7782
|
if (shouldFetchData) {
|
|
7413
7783
|
void fetchData();
|
|
@@ -7421,43 +7791,44 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7421
7791
|
];
|
|
7422
7792
|
};
|
|
7423
7793
|
// src/EffectLabelSelect/index.module.less
|
|
7424
|
-
var
|
|
7794
|
+
var index_module_default22 = {
|
|
7425
7795
|
select_wrap: "index_module_select_wrap",
|
|
7426
7796
|
select_label: "index_module_select_label",
|
|
7427
|
-
value_select: "
|
|
7797
|
+
value_select: "index_module_value_select2",
|
|
7428
7798
|
select: "index_module_select7"
|
|
7429
7799
|
};
|
|
7430
7800
|
// src/EffectLabelSelect/index.tsx
|
|
7431
|
-
var
|
|
7432
|
-
var
|
|
7433
|
-
var EffectLabelSelect = (0,
|
|
7801
|
+
var import_antd41 = require("antd");
|
|
7802
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7803
|
+
var EffectLabelSelect = (0, import_react54.memo)(function(props) {
|
|
7434
7804
|
var onChange = props.onChange, className = props.className, value = props.value, disabled = props.disabled, defaultLabel = props.defaultLabel, _props_labelDic = props.labelDic, labelDic = _props_labelDic === void 0 ? defaultLabelDic : _props_labelDic, onFetchData = props.onFetchData, _props_onTransformData = props.onTransformData, onTransformData = _props_onTransformData === void 0 ? defaultTransformDataFn : _props_onTransformData, _props_fetchParams = props.fetchParams, fetchParams = _props_fetchParams === void 0 ? {} : _props_fetchParams, _props_customLabelInValue = props.customLabelInValue, customLabelInValue = _props_customLabelInValue === void 0 ? false : _props_customLabelInValue, optionsDisplayType = props.optionsDisplayType, style = props.style;
|
|
7435
7805
|
var apiService = useRequestConfig().apiService;
|
|
7436
|
-
var _ref = _sliced_to_array((0,
|
|
7806
|
+
var _ref = _sliced_to_array((0, import_react54.useState)(function() {
|
|
7437
7807
|
var _transformObj2Options_, _transformObj2Options;
|
|
7438
7808
|
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7439
7809
|
var defaultLabelFromLabelDic = transformObj2Options === null || transformObj2Options === void 0 ? void 0 : (_transformObj2Options = transformObj2Options(labelDic)) === null || _transformObj2Options === void 0 ? void 0 : (_transformObj2Options_ = _transformObj2Options[0]) === null || _transformObj2Options_ === void 0 ? void 0 : _transformObj2Options_.value;
|
|
7440
7810
|
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7441
7811
|
}), 2), curSelectLabel = _ref[0], setCurSelectLabel = _ref[1];
|
|
7442
|
-
var _ref1 = _sliced_to_array((0,
|
|
7443
|
-
var _ref2 = _sliced_to_array((0,
|
|
7444
|
-
var _ref3 = _sliced_to_array((0,
|
|
7445
|
-
var _ref4 = _sliced_to_array((0,
|
|
7812
|
+
var _ref1 = _sliced_to_array((0, import_react54.useState)(value !== null && value !== void 0 ? value : void 0), 2), curSelectValue = _ref1[0], setCurSelectValue = _ref1[1];
|
|
7813
|
+
var _ref2 = _sliced_to_array((0, import_react54.useState)(), 2), curSelectItem = _ref2[0], setCurSelectItem = _ref2[1];
|
|
7814
|
+
var _ref3 = _sliced_to_array((0, import_react54.useState)(), 2), curSearchValue = _ref3[0], setCurSearchValue = _ref3[1];
|
|
7815
|
+
var _ref4 = _sliced_to_array((0, import_react54.useState)([]), 2), optionsData = _ref4[0], setOptionsData = _ref4[1];
|
|
7446
7816
|
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7447
7817
|
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7448
7818
|
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7449
7819
|
page: 1,
|
|
7450
7820
|
pageSize: 20
|
|
7451
7821
|
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7452
|
-
(0,
|
|
7822
|
+
(0, import_react54.useEffect)(function() {
|
|
7453
7823
|
var _resState_value;
|
|
7454
7824
|
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7455
7825
|
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7456
7826
|
setOptionsData(optionsData2);
|
|
7457
7827
|
}, [
|
|
7458
|
-
resState
|
|
7828
|
+
resState.loading,
|
|
7829
|
+
resState.value
|
|
7459
7830
|
]);
|
|
7460
|
-
(0,
|
|
7831
|
+
(0, import_react_use23.useUpdateEffect)(function() {
|
|
7461
7832
|
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
7462
7833
|
onChange === null || onChange === void 0 ? void 0 : onChange(changedValue, curSelectItem);
|
|
7463
7834
|
}, [
|
|
@@ -7486,7 +7857,7 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7486
7857
|
setOptionsData([]);
|
|
7487
7858
|
};
|
|
7488
7859
|
var selectLabelProps = {
|
|
7489
|
-
className:
|
|
7860
|
+
className: index_module_default22.select_label,
|
|
7490
7861
|
disabled: disabled,
|
|
7491
7862
|
defaultValue: curSelectLabel,
|
|
7492
7863
|
options: transformObj2Options(labelDic),
|
|
@@ -7502,7 +7873,7 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7502
7873
|
});
|
|
7503
7874
|
}) : optionsData;
|
|
7504
7875
|
var selectValueProps = {
|
|
7505
|
-
className: (0,
|
|
7876
|
+
className: (0, import_classnames17.default)(index_module_default22.value_select, className),
|
|
7506
7877
|
notFoundContent: notFoundContent,
|
|
7507
7878
|
value: mergedValue,
|
|
7508
7879
|
options: mergedOptionsData,
|
|
@@ -7519,12 +7890,12 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7519
7890
|
filterOption: false,
|
|
7520
7891
|
popupMatchSelectWidth: false
|
|
7521
7892
|
};
|
|
7522
|
-
return /* @__PURE__ */ (0,
|
|
7523
|
-
className:
|
|
7893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd41.Space.Compact, {
|
|
7894
|
+
className: index_module_default22.select_wrap,
|
|
7524
7895
|
style: style,
|
|
7525
7896
|
children: [
|
|
7526
|
-
/* @__PURE__ */ (0,
|
|
7527
|
-
/* @__PURE__ */ (0,
|
|
7897
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_antd41.Select, _object_spread({}, selectLabelProps)),
|
|
7898
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_antd41.Select, _object_spread({}, selectValueProps))
|
|
7528
7899
|
]
|
|
7529
7900
|
});
|
|
7530
7901
|
});
|
|
@@ -7627,6 +7998,7 @@ var getSecondValue = function getSecondValue() {
|
|
|
7627
7998
|
EffectMerchantSelect: EffectMerchantSelect,
|
|
7628
7999
|
EffectReservoirSelect: EffectReservoirSelect,
|
|
7629
8000
|
EffectScopeSelect: EffectScopeSelect,
|
|
8001
|
+
EffectSearchSelect: EffectSearchSelect,
|
|
7630
8002
|
EffectSeriesSelect: EffectSeriesSelect,
|
|
7631
8003
|
EffectSeriesSelectV2: EffectSeriesSelectV2,
|
|
7632
8004
|
EffectShelveSelect: EffectShelveSelect,
|
|
@@ -7663,6 +8035,7 @@ var getSecondValue = function getSecondValue() {
|
|
|
7663
8035
|
commonStatusSelectOptions: commonStatusSelectOptions,
|
|
7664
8036
|
commonYesOrNoSelectOptions: commonYesOrNoSelectOptions,
|
|
7665
8037
|
commonYesOrNoSelectOptionsMap: commonYesOrNoSelectOptionsMap,
|
|
8038
|
+
defaultMerchantSearchSources: defaultMerchantSearchSources,
|
|
7666
8039
|
formatClock: formatClock,
|
|
7667
8040
|
formatDate: formatDate,
|
|
7668
8041
|
getCTable: getCTable,
|