@xfe-repo/web-components 1.8.0 → 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 +524 -172
- package/dist/index.mjs +478 -134
- package/package.json +2 -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
|
},
|
|
@@ -3358,6 +3364,7 @@ var index_module_default6 = {
|
|
|
3358
3364
|
text: "index_module_text",
|
|
3359
3365
|
button: "index_module_button",
|
|
3360
3366
|
remote: "index_module_remote",
|
|
3367
|
+
paste_tip: "index_module_paste_tip",
|
|
3361
3368
|
upload_mask: "index_module_upload_mask"
|
|
3362
3369
|
};
|
|
3363
3370
|
// src/FileUpload/index.tsx
|
|
@@ -4128,16 +4135,19 @@ var FileUpload = function FileUpload(props) {
|
|
|
4128
4135
|
var renderPicCardUploadButton = (0, import_react34.useCallback)(function() {
|
|
4129
4136
|
if (max && fileList.length >= max) return null;
|
|
4130
4137
|
if (children) return children;
|
|
4131
|
-
if (disabled) return null;
|
|
4132
4138
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", {
|
|
4133
4139
|
className: index_module_default6.upload_btn,
|
|
4134
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
|
+
}),
|
|
4135
4145
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons9.PlusOutlined, {}),
|
|
4136
4146
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", {
|
|
4137
4147
|
className: index_module_default6.text,
|
|
4138
4148
|
children: "\u4E0A\u4F20"
|
|
4139
4149
|
}),
|
|
4140
|
-
remote && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RemoteUpload, {
|
|
4150
|
+
remote && !disabled && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RemoteUpload, {
|
|
4141
4151
|
max: max,
|
|
4142
4152
|
onAddFile: setBufferAddFile
|
|
4143
4153
|
})
|
|
@@ -6385,13 +6395,13 @@ function useMerchantOptions(params) {
|
|
|
6385
6395
|
params
|
|
6386
6396
|
], function() {
|
|
6387
6397
|
return _async_to_generator(function() {
|
|
6388
|
-
var _res_data, _ref, enabled,
|
|
6398
|
+
var _res_data, _ref, enabled, source, searchParams, res, options;
|
|
6389
6399
|
return _ts_generator(this, function(_state) {
|
|
6390
6400
|
switch(_state.label){
|
|
6391
6401
|
case 0:
|
|
6392
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6402
|
+
_ref = params || {}, enabled = _ref.enabled, source = _ref.source, searchParams = _object_without_properties(_ref, [
|
|
6393
6403
|
"enabled",
|
|
6394
|
-
"
|
|
6404
|
+
"source"
|
|
6395
6405
|
]);
|
|
6396
6406
|
if (enabled === false) return [
|
|
6397
6407
|
2,
|
|
@@ -6402,7 +6412,7 @@ function useMerchantOptions(params) {
|
|
|
6402
6412
|
apiService.merchantList(_object_spread({
|
|
6403
6413
|
page: 1,
|
|
6404
6414
|
pageSize: 20
|
|
6405
|
-
},
|
|
6415
|
+
}, searchParams), config)
|
|
6406
6416
|
];
|
|
6407
6417
|
case 1:
|
|
6408
6418
|
res = _state.sent();
|
|
@@ -6410,9 +6420,12 @@ function useMerchantOptions(params) {
|
|
|
6410
6420
|
throw new Error((res === null || res === void 0 ? void 0 : res.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6411
6421
|
}
|
|
6412
6422
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6413
|
-
var label = labelDisplayMode === "platformName-enterpriseNo" ? "".concat(item.platformName, " - ").concat(item.enterpriseNo) : item.platformName;
|
|
6414
6423
|
return {
|
|
6415
|
-
label:
|
|
6424
|
+
label: [
|
|
6425
|
+
item.enterpriseNo,
|
|
6426
|
+
item.platformName,
|
|
6427
|
+
item.name
|
|
6428
|
+
].filter(Boolean).join(" - "),
|
|
6416
6429
|
value: item.enterpriseNo,
|
|
6417
6430
|
originalName: item.platformName,
|
|
6418
6431
|
data: item
|
|
@@ -6447,15 +6460,34 @@ var index_module_default17 = {
|
|
|
6447
6460
|
// src/EffectMerchantSelect/index.tsx
|
|
6448
6461
|
var import_antd32 = require("antd");
|
|
6449
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
|
+
];
|
|
6450
6481
|
var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
6451
|
-
var
|
|
6452
|
-
var
|
|
6453
|
-
var _ref1 = _sliced_to_array((0, import_react45.useState)(
|
|
6454
|
-
var _ref2 = _sliced_to_array((0, import_react45.useState)(), 2),
|
|
6455
|
-
var _ref3 = _sliced_to_array((0, import_react45.useState)(
|
|
6456
|
-
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];
|
|
6457
6489
|
var state = useMerchantOptions(params);
|
|
6458
|
-
var
|
|
6490
|
+
var _ref6 = _sliced_to_array((0, import_react45.useState)(state.data || []), 2), options = _ref6[0], setOptions = _ref6[1];
|
|
6459
6491
|
(0, import_react_use15.useUpdateEffect)(function() {
|
|
6460
6492
|
if (!state.data) return;
|
|
6461
6493
|
setOptions(state.data);
|
|
@@ -6465,12 +6497,11 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6465
6497
|
(0, import_react45.useEffect)(function() {
|
|
6466
6498
|
if (controlValue !== value) setValue(controlValue);
|
|
6467
6499
|
if (controlValue) setParams({
|
|
6468
|
-
|
|
6469
|
-
|
|
6500
|
+
enterpriseNo: controlValue,
|
|
6501
|
+
source: sourceControl
|
|
6470
6502
|
});
|
|
6471
6503
|
}, [
|
|
6472
|
-
controlValue
|
|
6473
|
-
labelDisplayMode
|
|
6504
|
+
controlValue
|
|
6474
6505
|
]);
|
|
6475
6506
|
(0, import_react_use15.useUpdateEffect)(function() {
|
|
6476
6507
|
var changeValue = (value !== null && value !== void 0 ? value : "") === "" ? void 0 : String(value);
|
|
@@ -6484,24 +6515,23 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6484
6515
|
setName(option === null || option === void 0 ? void 0 : option.originalName);
|
|
6485
6516
|
};
|
|
6486
6517
|
var handleOnSearch = function handleOnSearch(searchValue2) {
|
|
6518
|
+
setSearchValue(searchValue2);
|
|
6487
6519
|
var _obj;
|
|
6488
|
-
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));
|
|
6489
6521
|
};
|
|
6490
6522
|
var handleOnSearchDebounce = (0, import_react45.useCallback)((0, import_tools10.debounce)(800, handleOnSearch), [
|
|
6491
|
-
sourceControl
|
|
6492
|
-
labelDisplayMode
|
|
6523
|
+
sourceControl
|
|
6493
6524
|
]);
|
|
6494
6525
|
var handleOnClear = function handleOnClear() {
|
|
6495
6526
|
setSearchValue(void 0);
|
|
6496
6527
|
setOptions([]);
|
|
6497
6528
|
};
|
|
6498
|
-
var
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
var
|
|
6504
|
-
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) {
|
|
6505
6535
|
setSourceControl(value2);
|
|
6506
6536
|
setValue(void 0);
|
|
6507
6537
|
setSearchValue(void 0);
|
|
@@ -6519,13 +6549,7 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6519
6549
|
popupMatchSelectWidth: false,
|
|
6520
6550
|
disabled: disabled,
|
|
6521
6551
|
defaultValue: sourceControl,
|
|
6522
|
-
options:
|
|
6523
|
-
var _param = _sliced_to_array(param, 2), value2 = _param[0], label = _param[1];
|
|
6524
|
-
return {
|
|
6525
|
-
value: value2,
|
|
6526
|
-
label: label
|
|
6527
|
-
};
|
|
6528
|
-
}),
|
|
6552
|
+
options: defaultMerchantSearchSources,
|
|
6529
6553
|
onChange: handleAddonChange,
|
|
6530
6554
|
style: {
|
|
6531
6555
|
width: 140
|
|
@@ -6533,12 +6557,13 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6533
6557
|
};
|
|
6534
6558
|
var selectBrandProps = {
|
|
6535
6559
|
notFoundContent: notFoundContent,
|
|
6536
|
-
placeholder: "请输入".concat(
|
|
6560
|
+
placeholder: "请输入".concat(currentSourceLabel),
|
|
6537
6561
|
optionFilterProp: "label",
|
|
6538
6562
|
showSearch: true,
|
|
6539
6563
|
allowClear: true,
|
|
6540
6564
|
defaultActiveFirstOption: false,
|
|
6541
6565
|
filterOption: false,
|
|
6566
|
+
popupMatchSelectWidth: false,
|
|
6542
6567
|
value: value,
|
|
6543
6568
|
options: options,
|
|
6544
6569
|
disabled: disabled,
|
|
@@ -6557,15 +6582,339 @@ var EffectMerchantSelect = (0, import_react45.memo)(function(props) {
|
|
|
6557
6582
|
]
|
|
6558
6583
|
});
|
|
6559
6584
|
});
|
|
6560
|
-
// src/
|
|
6561
|
-
var
|
|
6562
|
-
var import_antd34 = require("antd");
|
|
6585
|
+
// src/EffectSearchSelect/index.tsx
|
|
6586
|
+
var import_react46 = __toESM(require("react"));
|
|
6563
6587
|
var import_react_use16 = require("react-use");
|
|
6564
|
-
|
|
6565
|
-
var import_react46 = require("react");
|
|
6588
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
6566
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
|
|
6567
6737
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
6568
|
-
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) {
|
|
6569
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;
|
|
6570
6919
|
var items = [];
|
|
6571
6920
|
if ((categoryName === null || categoryName === void 0 ? void 0 : categoryName.length) || (categoryIds === null || categoryIds === void 0 ? void 0 : categoryIds.length)) items.push({
|
|
@@ -6588,18 +6937,18 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6588
6937
|
label: "SKU",
|
|
6589
6938
|
value: skuName || String(skuId)
|
|
6590
6939
|
});
|
|
6591
|
-
if (items.length === 0) return /* @__PURE__ */ (0,
|
|
6940
|
+
if (items.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Typography.Text, {
|
|
6592
6941
|
style: {
|
|
6593
6942
|
fontSize: 14
|
|
6594
6943
|
},
|
|
6595
6944
|
type: "danger",
|
|
6596
6945
|
children: "\u8BF7\u5148\u9009\u62E9\u54C1\u7C7B\u4FE1\u606F"
|
|
6597
6946
|
});
|
|
6598
|
-
return /* @__PURE__ */ (0,
|
|
6947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Space, {
|
|
6599
6948
|
size: 4,
|
|
6600
6949
|
children: items.map(function(param) {
|
|
6601
6950
|
var label = param.label, value = param.value;
|
|
6602
|
-
return /* @__PURE__ */ (0,
|
|
6951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_antd34.Space, {
|
|
6603
6952
|
size: 4,
|
|
6604
6953
|
style: {
|
|
6605
6954
|
height: 32,
|
|
@@ -6607,7 +6956,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6607
6956
|
borderRadius: 6
|
|
6608
6957
|
},
|
|
6609
6958
|
children: [
|
|
6610
|
-
/* @__PURE__ */ (0,
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_antd34.Typography.Text, {
|
|
6611
6960
|
style: {
|
|
6612
6961
|
fontSize: 14,
|
|
6613
6962
|
paddingRight: 16
|
|
@@ -6617,7 +6966,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6617
6966
|
":"
|
|
6618
6967
|
]
|
|
6619
6968
|
}),
|
|
6620
|
-
/* @__PURE__ */ (0,
|
|
6969
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_antd34.Typography.Text, {
|
|
6621
6970
|
style: {
|
|
6622
6971
|
fontSize: 14
|
|
6623
6972
|
},
|
|
@@ -6629,7 +6978,7 @@ var ScopeViewMode = (0, import_react46.memo)(function(props) {
|
|
|
6629
6978
|
});
|
|
6630
6979
|
});
|
|
6631
6980
|
// src/EffectScopeSelect/index.tsx
|
|
6632
|
-
var
|
|
6981
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6633
6982
|
var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
6634
6983
|
ScopeLevelEnum2[ScopeLevelEnum2["CATEGORY"] = 1] = "CATEGORY";
|
|
6635
6984
|
ScopeLevelEnum2[ScopeLevelEnum2["BRAND"] = 2] = "BRAND";
|
|
@@ -6638,28 +6987,28 @@ var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
|
6638
6987
|
ScopeLevelEnum2[ScopeLevelEnum2["SKU"] = 5] = "SKU";
|
|
6639
6988
|
return ScopeLevelEnum2;
|
|
6640
6989
|
}(ScopeLevelEnum || {});
|
|
6641
|
-
var EffectScopeSelect = (0,
|
|
6990
|
+
var EffectScopeSelect = (0, import_react48.memo)(function(props) {
|
|
6642
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;
|
|
6643
|
-
var _ref = _sliced_to_array((0,
|
|
6644
|
-
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() {
|
|
6645
6994
|
var _value_categoryIds;
|
|
6646
6995
|
return (_value_categoryIds = value.categoryIds) === null || _value_categoryIds === void 0 ? void 0 : _value_categoryIds[value.categoryIds.length - 1];
|
|
6647
6996
|
}, [
|
|
6648
6997
|
value.categoryIds
|
|
6649
6998
|
]);
|
|
6650
|
-
(0,
|
|
6999
|
+
(0, import_react_use17.useUpdateEffect)(function() {
|
|
6651
7000
|
setValue(_object_spread({}, controlledValue));
|
|
6652
7001
|
}, [
|
|
6653
7002
|
controlledValue
|
|
6654
7003
|
]);
|
|
6655
|
-
var handleChange = (0,
|
|
7004
|
+
var handleChange = (0, import_react48.useCallback)(function(newValue) {
|
|
6656
7005
|
setTimeout(function() {
|
|
6657
7006
|
return onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
6658
7007
|
}, 0);
|
|
6659
7008
|
}, [
|
|
6660
7009
|
onChange
|
|
6661
7010
|
]);
|
|
6662
|
-
var handleCategoryChange = (0,
|
|
7011
|
+
var handleCategoryChange = (0, import_react48.useCallback)(function(_values, selectedList) {
|
|
6663
7012
|
if (!selectedList || !isSingleTreeSelected(selectedList)) {
|
|
6664
7013
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange();
|
|
6665
7014
|
return;
|
|
@@ -6678,7 +7027,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6678
7027
|
handleChange,
|
|
6679
7028
|
requireLevel
|
|
6680
7029
|
]);
|
|
6681
|
-
var handleBrandChange = (0,
|
|
7030
|
+
var handleBrandChange = (0, import_react48.useCallback)(function(brandValue) {
|
|
6682
7031
|
var brandId = brandValue === void 0 ? void 0 : Number(brandValue);
|
|
6683
7032
|
setValue(function(prev) {
|
|
6684
7033
|
var newScope = {
|
|
@@ -6694,7 +7043,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6694
7043
|
handleChange,
|
|
6695
7044
|
requireLevel
|
|
6696
7045
|
]);
|
|
6697
|
-
var handleSeriesChange = (0,
|
|
7046
|
+
var handleSeriesChange = (0, import_react48.useCallback)(function(seriesValue) {
|
|
6698
7047
|
var seriesId = seriesValue === void 0 ? void 0 : Number(seriesValue);
|
|
6699
7048
|
setValue(function(prev) {
|
|
6700
7049
|
var newScope = {
|
|
@@ -6711,7 +7060,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6711
7060
|
handleChange,
|
|
6712
7061
|
requireLevel
|
|
6713
7062
|
]);
|
|
6714
|
-
var handleSpuChange = (0,
|
|
7063
|
+
var handleSpuChange = (0, import_react48.useCallback)(function(spuValue) {
|
|
6715
7064
|
var spuId = spuValue === void 0 ? void 0 : Number(spuValue);
|
|
6716
7065
|
setValue(function(prev) {
|
|
6717
7066
|
var newScope = {
|
|
@@ -6729,7 +7078,7 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6729
7078
|
handleChange,
|
|
6730
7079
|
requireLevel
|
|
6731
7080
|
]);
|
|
6732
|
-
var handleSkuChange = (0,
|
|
7081
|
+
var handleSkuChange = (0, import_react48.useCallback)(function(skuValue) {
|
|
6733
7082
|
var skuId = skuValue === void 0 ? void 0 : Number(skuValue);
|
|
6734
7083
|
setValue(function(prev) {
|
|
6735
7084
|
var newScope = _object_spread_props(_object_spread({}, prev), {
|
|
@@ -6744,18 +7093,18 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6744
7093
|
handleChange,
|
|
6745
7094
|
requireLevel
|
|
6746
7095
|
]);
|
|
6747
|
-
var renderLabel = (0,
|
|
6748
|
-
return /* @__PURE__ */ (0,
|
|
7096
|
+
var renderLabel = (0, import_react48.useCallback)(function(label, required) {
|
|
7097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_antd35.Flex, {
|
|
6749
7098
|
flex: "0 0 auto",
|
|
6750
|
-
children: /* @__PURE__ */ (0,
|
|
7099
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Space, {
|
|
6751
7100
|
children: [
|
|
6752
|
-
required && /* @__PURE__ */ (0,
|
|
7101
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", {
|
|
6753
7102
|
style: {
|
|
6754
7103
|
color: "var(--ant-color-error)"
|
|
6755
7104
|
},
|
|
6756
7105
|
children: "*"
|
|
6757
7106
|
}),
|
|
6758
|
-
/* @__PURE__ */ (0,
|
|
7107
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", {
|
|
6759
7108
|
children: [
|
|
6760
7109
|
label,
|
|
6761
7110
|
":"
|
|
@@ -6766,34 +7115,34 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6766
7115
|
});
|
|
6767
7116
|
}, []);
|
|
6768
7117
|
if (mode === "view") {
|
|
6769
|
-
return /* @__PURE__ */ (0,
|
|
7118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ScopeViewMode, _object_spread({}, value));
|
|
6770
7119
|
}
|
|
6771
|
-
return /* @__PURE__ */ (0,
|
|
7120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6772
7121
|
justify: "flex-start",
|
|
6773
7122
|
align: "center",
|
|
6774
7123
|
wrap: "nowrap",
|
|
6775
7124
|
gap: "15px",
|
|
6776
7125
|
children: [
|
|
6777
|
-
/* @__PURE__ */ (0,
|
|
7126
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6778
7127
|
align: "center",
|
|
6779
7128
|
gap: "5px",
|
|
6780
7129
|
flex: "0 0 auto",
|
|
6781
7130
|
children: [
|
|
6782
7131
|
renderLabel("\u5206\u7C7B", requireLevel >= 1 /* CATEGORY */ ),
|
|
6783
|
-
/* @__PURE__ */ (0,
|
|
7132
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectCategoryCascade, {
|
|
6784
7133
|
onChange: handleCategoryChange,
|
|
6785
7134
|
changeOnSelect: categoryChangeOnSelect,
|
|
6786
7135
|
value: value.categoryIds
|
|
6787
7136
|
})
|
|
6788
7137
|
]
|
|
6789
7138
|
}),
|
|
6790
|
-
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ (0,
|
|
7139
|
+
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6791
7140
|
align: "center",
|
|
6792
7141
|
gap: "5px",
|
|
6793
7142
|
flex: "0 0 auto",
|
|
6794
7143
|
children: [
|
|
6795
7144
|
renderLabel("\u54C1\u724C", requireLevel >= 2 /* BRAND */ ),
|
|
6796
|
-
/* @__PURE__ */ (0,
|
|
7145
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectBrandSelect, _object_spread_props(_object_spread({
|
|
6797
7146
|
categoryId: lastLevelCategoryId
|
|
6798
7147
|
}, value), {
|
|
6799
7148
|
onChange: handleBrandChange,
|
|
@@ -6801,13 +7150,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6801
7150
|
}))
|
|
6802
7151
|
]
|
|
6803
7152
|
}),
|
|
6804
|
-
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ (0,
|
|
7153
|
+
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6805
7154
|
align: "center",
|
|
6806
7155
|
gap: "5px",
|
|
6807
7156
|
flex: "0 0 auto",
|
|
6808
7157
|
children: [
|
|
6809
7158
|
renderLabel("\u7CFB\u5217", requireLevel >= 3 /* SERIES */ ),
|
|
6810
|
-
/* @__PURE__ */ (0,
|
|
7159
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSeriesSelect, _object_spread_props(_object_spread({
|
|
6811
7160
|
categoryId: lastLevelCategoryId
|
|
6812
7161
|
}, value), {
|
|
6813
7162
|
onChange: handleSeriesChange,
|
|
@@ -6815,13 +7164,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6815
7164
|
}))
|
|
6816
7165
|
]
|
|
6817
7166
|
}),
|
|
6818
|
-
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ (0,
|
|
7167
|
+
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6819
7168
|
align: "center",
|
|
6820
7169
|
gap: "5px",
|
|
6821
7170
|
flex: "0 0 auto",
|
|
6822
7171
|
children: [
|
|
6823
7172
|
renderLabel("SPU", requireLevel >= 4 /* SPU */ ),
|
|
6824
|
-
/* @__PURE__ */ (0,
|
|
7173
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSpuSelect, _object_spread_props(_object_spread({
|
|
6825
7174
|
categoryId: lastLevelCategoryId
|
|
6826
7175
|
}, value), {
|
|
6827
7176
|
onChange: handleSpuChange,
|
|
@@ -6829,13 +7178,13 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6829
7178
|
}))
|
|
6830
7179
|
]
|
|
6831
7180
|
}),
|
|
6832
|
-
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ (0,
|
|
7181
|
+
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_antd35.Flex, {
|
|
6833
7182
|
align: "center",
|
|
6834
7183
|
gap: "5px",
|
|
6835
7184
|
flex: "0 0 auto",
|
|
6836
7185
|
children: [
|
|
6837
7186
|
renderLabel("SKU", requireLevel >= 5 /* SKU */ ),
|
|
6838
|
-
/* @__PURE__ */ (0,
|
|
7187
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EffectSkuSelect, _object_spread_props(_object_spread({
|
|
6839
7188
|
categoryId: lastLevelCategoryId
|
|
6840
7189
|
}, value), {
|
|
6841
7190
|
onChange: handleSkuChange,
|
|
@@ -6847,22 +7196,22 @@ var EffectScopeSelect = (0, import_react47.memo)(function(props) {
|
|
|
6847
7196
|
});
|
|
6848
7197
|
});
|
|
6849
7198
|
// src/EffectStaffSelect/index.tsx
|
|
6850
|
-
var
|
|
6851
|
-
var
|
|
6852
|
-
var
|
|
6853
|
-
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");
|
|
6854
7203
|
var import_tools11 = require("@xfe-repo/web-utils/tools");
|
|
6855
7204
|
// src/EffectStaffSelect/index.module.less
|
|
6856
|
-
var
|
|
7205
|
+
var index_module_default19 = {
|
|
6857
7206
|
select: "index_module_select4"
|
|
6858
7207
|
};
|
|
6859
7208
|
// src/EffectStaffSelect/index.tsx
|
|
6860
|
-
var
|
|
6861
|
-
var EffectStaffSelect = (0,
|
|
7209
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7210
|
+
var EffectStaffSelect = (0, import_react49.memo)(function(props) {
|
|
6862
7211
|
var _state_value_data, _state_value;
|
|
6863
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;
|
|
6864
|
-
var _ref = _sliced_to_array((0,
|
|
6865
|
-
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];
|
|
6866
7215
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6867
7216
|
var getBusinessOptions = function getBusinessOptions(businessName, currentDeptId) {
|
|
6868
7217
|
return _async_to_generator(function() {
|
|
@@ -6892,14 +7241,14 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6892
7241
|
});
|
|
6893
7242
|
})();
|
|
6894
7243
|
};
|
|
6895
|
-
var _ref2 = _sliced_to_array((0,
|
|
7244
|
+
var _ref2 = _sliced_to_array((0, import_react_use18.useAsyncFn)(getBusinessOptions, [
|
|
6896
7245
|
deptId,
|
|
6897
7246
|
config
|
|
6898
7247
|
]), 2), state = _ref2[0], searchFetch = _ref2[1];
|
|
6899
|
-
var debounceSearchFetch = (0,
|
|
7248
|
+
var debounceSearchFetch = (0, import_react49.useCallback)((0, import_tools11.debounce)(600, searchFetch), [
|
|
6900
7249
|
searchFetch
|
|
6901
7250
|
]);
|
|
6902
|
-
(0,
|
|
7251
|
+
(0, import_react49.useEffect)(function() {
|
|
6903
7252
|
var _state_value_data, _state_value;
|
|
6904
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)) {
|
|
6905
7254
|
return;
|
|
@@ -6915,12 +7264,12 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6915
7264
|
}, [
|
|
6916
7265
|
state
|
|
6917
7266
|
]);
|
|
6918
|
-
(0,
|
|
7267
|
+
(0, import_react_use18.useMount)(function() {
|
|
6919
7268
|
if (deptId) {
|
|
6920
7269
|
void searchFetch("", deptId);
|
|
6921
7270
|
}
|
|
6922
7271
|
});
|
|
6923
|
-
(0,
|
|
7272
|
+
(0, import_react_use18.useUpdateEffect)(function() {
|
|
6924
7273
|
setValue(controlValue);
|
|
6925
7274
|
if (!controlValue && deptId) {
|
|
6926
7275
|
void searchFetch("", deptId);
|
|
@@ -6929,7 +7278,7 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6929
7278
|
controlValue,
|
|
6930
7279
|
deptId
|
|
6931
7280
|
]);
|
|
6932
|
-
(0,
|
|
7281
|
+
(0, import_react_use18.useUpdateEffect)(function() {
|
|
6933
7282
|
setOptions([]);
|
|
6934
7283
|
if (deptId) {
|
|
6935
7284
|
void searchFetch("", deptId);
|
|
@@ -6954,8 +7303,8 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6954
7303
|
}
|
|
6955
7304
|
};
|
|
6956
7305
|
var defaultPlaceholder = deptId ? "\u8BF7\u9009\u62E9\u5458\u5DE5\u59D3\u540D" : "\u8BF7\u5148\u8F93\u5165\u5458\u5DE5\u59D3\u540D";
|
|
6957
|
-
return /* @__PURE__ */ (0,
|
|
6958
|
-
className: (0,
|
|
7306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_antd36.Select, {
|
|
7307
|
+
className: (0, import_classnames14.default)(index_module_default19.select, className),
|
|
6959
7308
|
style: style,
|
|
6960
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,
|
|
6961
7310
|
placeholder: placeholder || defaultPlaceholder,
|
|
@@ -6973,15 +7322,15 @@ var EffectStaffSelect = (0, import_react48.memo)(function(props) {
|
|
|
6973
7322
|
});
|
|
6974
7323
|
});
|
|
6975
7324
|
// src/EffectReservoirSelect/EffectReservoirSelect.tsx
|
|
6976
|
-
var
|
|
6977
|
-
var
|
|
6978
|
-
var
|
|
6979
|
-
var
|
|
6980
|
-
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) {
|
|
6981
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;
|
|
6982
|
-
var _ref = _sliced_to_array((0,
|
|
6983
|
-
var _ref1 = _sliced_to_array((0,
|
|
6984
|
-
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);
|
|
6985
7334
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6986
7335
|
var get_reservoir_options = function get_reservoir_options() {
|
|
6987
7336
|
return _async_to_generator(function() {
|
|
@@ -7010,10 +7359,10 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7010
7359
|
});
|
|
7011
7360
|
})();
|
|
7012
7361
|
};
|
|
7013
|
-
var _ref2 = _sliced_to_array((0,
|
|
7362
|
+
var _ref2 = _sliced_to_array((0, import_react_use19.useAsyncFn)(get_reservoir_options, [
|
|
7014
7363
|
warehouseId
|
|
7015
7364
|
]), 2), state = _ref2[0], fetch = _ref2[1];
|
|
7016
|
-
(0,
|
|
7365
|
+
(0, import_react50.useEffect)(function() {
|
|
7017
7366
|
var _state_value;
|
|
7018
7367
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7019
7368
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -7028,10 +7377,10 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7028
7377
|
}, [
|
|
7029
7378
|
state
|
|
7030
7379
|
]);
|
|
7031
|
-
(0,
|
|
7380
|
+
(0, import_react_use19.useMount)(function() {
|
|
7032
7381
|
return void fetch();
|
|
7033
7382
|
});
|
|
7034
|
-
(0,
|
|
7383
|
+
(0, import_react_use19.useUpdateEffect)(function() {
|
|
7035
7384
|
if (controlValue && controlValue === prevControlValue) {
|
|
7036
7385
|
setValue(void 0);
|
|
7037
7386
|
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
@@ -7040,7 +7389,7 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7040
7389
|
}, [
|
|
7041
7390
|
warehouseId
|
|
7042
7391
|
]);
|
|
7043
|
-
(0,
|
|
7392
|
+
(0, import_react_use19.useUpdateEffect)(function() {
|
|
7044
7393
|
if (value === controlValue) return;
|
|
7045
7394
|
setValue(controlValue);
|
|
7046
7395
|
}, [
|
|
@@ -7064,21 +7413,21 @@ var EffectReservoirSelect = (0, import_react49.memo)(function(props) {
|
|
|
7064
7413
|
onChange: handleOnChange,
|
|
7065
7414
|
loading: state.loading
|
|
7066
7415
|
};
|
|
7067
|
-
return /* @__PURE__ */ (0,
|
|
7416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_antd37.Select, _object_spread({
|
|
7068
7417
|
className: className
|
|
7069
7418
|
}, selectBrandProps));
|
|
7070
7419
|
});
|
|
7071
7420
|
// src/EffectReservoirSelect/EffectShelveSelect.tsx
|
|
7072
|
-
var
|
|
7073
|
-
var
|
|
7074
|
-
var
|
|
7075
|
-
var
|
|
7076
|
-
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) {
|
|
7077
7426
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, reservoirId = props.reservoirId;
|
|
7078
7427
|
var _props_valueType = props.valueType, valueType = _props_valueType === void 0 ? "code" : _props_valueType;
|
|
7079
|
-
var _ref = _sliced_to_array((0,
|
|
7080
|
-
var _ref1 = _sliced_to_array((0,
|
|
7081
|
-
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);
|
|
7082
7431
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7083
7432
|
var get_shelve_options = function get_shelve_options() {
|
|
7084
7433
|
return _async_to_generator(function() {
|
|
@@ -7107,11 +7456,11 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7107
7456
|
});
|
|
7108
7457
|
})();
|
|
7109
7458
|
};
|
|
7110
|
-
var _ref2 = _sliced_to_array((0,
|
|
7459
|
+
var _ref2 = _sliced_to_array((0, import_react_use20.useAsyncFn)(get_shelve_options, [
|
|
7111
7460
|
reservoirId,
|
|
7112
7461
|
warehouseId
|
|
7113
7462
|
]), 2), state = _ref2[0], fetch = _ref2[1];
|
|
7114
|
-
(0,
|
|
7463
|
+
(0, import_react51.useEffect)(function() {
|
|
7115
7464
|
var _state_value;
|
|
7116
7465
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7117
7466
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -7127,10 +7476,10 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7127
7476
|
}, [
|
|
7128
7477
|
state
|
|
7129
7478
|
]);
|
|
7130
|
-
(0,
|
|
7479
|
+
(0, import_react_use20.useMount)(function() {
|
|
7131
7480
|
return void fetch();
|
|
7132
7481
|
});
|
|
7133
|
-
(0,
|
|
7482
|
+
(0, import_react_use20.useUpdateEffect)(function() {
|
|
7134
7483
|
if (controlValue && controlValue === prevControlValue) {
|
|
7135
7484
|
setValue(void 0);
|
|
7136
7485
|
onChange === null || onChange === void 0 ? void 0 : onChange();
|
|
@@ -7140,7 +7489,7 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7140
7489
|
reservoirId,
|
|
7141
7490
|
warehouseId
|
|
7142
7491
|
]);
|
|
7143
|
-
(0,
|
|
7492
|
+
(0, import_react_use20.useUpdateEffect)(function() {
|
|
7144
7493
|
if (value === controlValue) return;
|
|
7145
7494
|
setValue(controlValue);
|
|
7146
7495
|
}, [
|
|
@@ -7164,16 +7513,16 @@ var EffectShelveSelect = (0, import_react50.memo)(function(props) {
|
|
|
7164
7513
|
onChange: handleOnChange,
|
|
7165
7514
|
loading: state.loading
|
|
7166
7515
|
};
|
|
7167
|
-
return /* @__PURE__ */ (0,
|
|
7516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_antd38.Select, _object_spread({
|
|
7168
7517
|
className: className
|
|
7169
7518
|
}, selectBrandProps));
|
|
7170
7519
|
});
|
|
7171
7520
|
// src/EffectWarehouseSelect/index.tsx
|
|
7172
|
-
var
|
|
7173
|
-
var
|
|
7174
|
-
var
|
|
7521
|
+
var import_antd39 = require("antd");
|
|
7522
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
7523
|
+
var import_react52 = require("react");
|
|
7175
7524
|
// src/EffectWarehouseSelect/useStoreOptions.ts
|
|
7176
|
-
var
|
|
7525
|
+
var import_immutable8 = __toESM(require("swr/immutable"));
|
|
7177
7526
|
var transformStoreData = function transformStoreData() {
|
|
7178
7527
|
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
7179
7528
|
return list.map(function(item) {
|
|
@@ -7186,7 +7535,7 @@ var transformStoreData = function transformStoreData() {
|
|
|
7186
7535
|
function useStoreOptions() {
|
|
7187
7536
|
var currentMerchantOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, warehouseType = arguments.length > 1 ? arguments[1] : void 0;
|
|
7188
7537
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7189
|
-
var _ref = (0,
|
|
7538
|
+
var _ref = (0, import_immutable8.default)([
|
|
7190
7539
|
"warehouse/store/combo-box",
|
|
7191
7540
|
currentMerchantOnly,
|
|
7192
7541
|
warehouseType
|
|
@@ -7230,12 +7579,12 @@ function useStoreOptions() {
|
|
|
7230
7579
|
};
|
|
7231
7580
|
}
|
|
7232
7581
|
// src/EffectWarehouseSelect/index.module.less
|
|
7233
|
-
var
|
|
7582
|
+
var index_module_default20 = {
|
|
7234
7583
|
select: "index_module_select5"
|
|
7235
7584
|
};
|
|
7236
7585
|
// src/EffectWarehouseSelect/index.tsx
|
|
7237
|
-
var
|
|
7238
|
-
var EffectWarehouseSelect = (0,
|
|
7586
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
7587
|
+
var EffectWarehouseSelect = (0, import_react52.memo)(function(props) {
|
|
7239
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;
|
|
7240
7589
|
var state = useStoreOptions(currentMerchantOnly, warehouseType);
|
|
7241
7590
|
var handleChange = function handleChange(selectedValue, option) {
|
|
@@ -7245,8 +7594,8 @@ var EffectWarehouseSelect = (0, import_react51.memo)(function(props) {
|
|
|
7245
7594
|
var handleClear = function handleClear() {
|
|
7246
7595
|
onChange === null || onChange === void 0 ? void 0 : onChange(void 0, void 0);
|
|
7247
7596
|
};
|
|
7248
|
-
return /* @__PURE__ */ (0,
|
|
7249
|
-
className: (0,
|
|
7597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_antd39.Select, {
|
|
7598
|
+
className: (0, import_classnames15.default)(index_module_default20.select, className),
|
|
7250
7599
|
placeholder: "\u8BF7\u9009\u62E9\u4ED3\u5E93",
|
|
7251
7600
|
notFoundContent: state.isLoading ? "\u52A0\u8F7D\u4E2D..." : "\u6682\u65E0\u4ED3\u5E93\u6570\u636E",
|
|
7252
7601
|
loading: state.isLoading,
|
|
@@ -7258,22 +7607,22 @@ var EffectWarehouseSelect = (0, import_react51.memo)(function(props) {
|
|
|
7258
7607
|
});
|
|
7259
7608
|
});
|
|
7260
7609
|
// src/EffectAddressCascade/index.tsx
|
|
7261
|
-
var
|
|
7262
|
-
var
|
|
7263
|
-
var
|
|
7610
|
+
var import_react53 = require("react");
|
|
7611
|
+
var import_react_use21 = require("react-use");
|
|
7612
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
7264
7613
|
// src/EffectAddressCascade/index.module.less
|
|
7265
|
-
var
|
|
7614
|
+
var index_module_default21 = {
|
|
7266
7615
|
input: "index_module_input7",
|
|
7267
7616
|
select: "index_module_select6"
|
|
7268
7617
|
};
|
|
7269
7618
|
// src/EffectAddressCascade/index.tsx
|
|
7270
|
-
var
|
|
7271
|
-
var
|
|
7272
|
-
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) {
|
|
7273
7622
|
var _selectedList_;
|
|
7274
7623
|
var className = props.className, disabled = props.disabled, defaultValue = props.defaultValue, onChange = props.onChange;
|
|
7275
|
-
var _ref = _sliced_to_array((0,
|
|
7276
|
-
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];
|
|
7277
7626
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
7278
7627
|
var params = {
|
|
7279
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) || ""
|
|
@@ -7296,10 +7645,10 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7296
7645
|
});
|
|
7297
7646
|
})();
|
|
7298
7647
|
};
|
|
7299
|
-
var _ref2 = _sliced_to_array((0,
|
|
7648
|
+
var _ref2 = _sliced_to_array((0, import_react_use21.useAsyncFn)(getAddress, [
|
|
7300
7649
|
selectedList
|
|
7301
7650
|
]), 2), state = _ref2[0], getAddressFetch = _ref2[1];
|
|
7302
|
-
(0,
|
|
7651
|
+
(0, import_react53.useEffect)(function() {
|
|
7303
7652
|
var _state_value;
|
|
7304
7653
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7305
7654
|
var list = state.value.data.list;
|
|
@@ -7337,7 +7686,7 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7337
7686
|
}, [
|
|
7338
7687
|
state
|
|
7339
7688
|
]);
|
|
7340
|
-
(0,
|
|
7689
|
+
(0, import_react53.useEffect)(function() {
|
|
7341
7690
|
if (!state.loading || !customTree || !selectedList) return;
|
|
7342
7691
|
var target = findTargetLeaf(selectedList, customTree);
|
|
7343
7692
|
if (!target) return;
|
|
@@ -7346,10 +7695,10 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7346
7695
|
}, [
|
|
7347
7696
|
state
|
|
7348
7697
|
]);
|
|
7349
|
-
(0,
|
|
7698
|
+
(0, import_react_use21.useMount)(function() {
|
|
7350
7699
|
void getAddressFetch();
|
|
7351
7700
|
});
|
|
7352
|
-
(0,
|
|
7701
|
+
(0, import_react53.useEffect)(function() {
|
|
7353
7702
|
var target = findTargetLeaf(selectedList || [], customTree || []);
|
|
7354
7703
|
if ((target === null || target === void 0 ? void 0 : target.isLeaf) || !(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length)) return;
|
|
7355
7704
|
void getAddressFetch();
|
|
@@ -7365,8 +7714,8 @@ var EffectAddressCascade = (0, import_react52.memo)(function(props) {
|
|
|
7365
7714
|
setSelectedList(_selectedList);
|
|
7366
7715
|
if (onChange) onChange(_selectedList);
|
|
7367
7716
|
};
|
|
7368
|
-
return /* @__PURE__ */ (0,
|
|
7369
|
-
className: (0,
|
|
7717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_antd40.Cascader, {
|
|
7718
|
+
className: (0, import_classnames16.default)(index_module_default21.input, className),
|
|
7370
7719
|
disabled: disabled,
|
|
7371
7720
|
defaultValue: defaultValue,
|
|
7372
7721
|
multiple: false,
|
|
@@ -7400,11 +7749,11 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7400
7749
|
});
|
|
7401
7750
|
};
|
|
7402
7751
|
// src/EffectLabelSelect/index.tsx
|
|
7403
|
-
var
|
|
7404
|
-
var
|
|
7405
|
-
var
|
|
7752
|
+
var import_react54 = require("react");
|
|
7753
|
+
var import_react_use23 = require("react-use");
|
|
7754
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
7406
7755
|
// src/EffectLabelSelect/hooks.ts
|
|
7407
|
-
var
|
|
7756
|
+
var import_react_use22 = require("react-use");
|
|
7408
7757
|
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7409
7758
|
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7410
7759
|
var reqDataFn = function reqDataFn() {
|
|
@@ -7425,10 +7774,10 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7425
7774
|
});
|
|
7426
7775
|
})();
|
|
7427
7776
|
};
|
|
7428
|
-
var _ref = _sliced_to_array((0,
|
|
7777
|
+
var _ref = _sliced_to_array((0, import_react_use22.useAsyncFn)(reqDataFn, [
|
|
7429
7778
|
dependency
|
|
7430
7779
|
]), 2), resState = _ref[0], fetchData = _ref[1];
|
|
7431
|
-
(0,
|
|
7780
|
+
(0, import_react_use22.useDebounce)(function() {
|
|
7432
7781
|
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7433
7782
|
if (shouldFetchData) {
|
|
7434
7783
|
void fetchData();
|
|
@@ -7442,43 +7791,44 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7442
7791
|
];
|
|
7443
7792
|
};
|
|
7444
7793
|
// src/EffectLabelSelect/index.module.less
|
|
7445
|
-
var
|
|
7794
|
+
var index_module_default22 = {
|
|
7446
7795
|
select_wrap: "index_module_select_wrap",
|
|
7447
7796
|
select_label: "index_module_select_label",
|
|
7448
|
-
value_select: "
|
|
7797
|
+
value_select: "index_module_value_select2",
|
|
7449
7798
|
select: "index_module_select7"
|
|
7450
7799
|
};
|
|
7451
7800
|
// src/EffectLabelSelect/index.tsx
|
|
7452
|
-
var
|
|
7453
|
-
var
|
|
7454
|
-
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) {
|
|
7455
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;
|
|
7456
7805
|
var apiService = useRequestConfig().apiService;
|
|
7457
|
-
var _ref = _sliced_to_array((0,
|
|
7806
|
+
var _ref = _sliced_to_array((0, import_react54.useState)(function() {
|
|
7458
7807
|
var _transformObj2Options_, _transformObj2Options;
|
|
7459
7808
|
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7460
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;
|
|
7461
7810
|
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7462
7811
|
}), 2), curSelectLabel = _ref[0], setCurSelectLabel = _ref[1];
|
|
7463
|
-
var _ref1 = _sliced_to_array((0,
|
|
7464
|
-
var _ref2 = _sliced_to_array((0,
|
|
7465
|
-
var _ref3 = _sliced_to_array((0,
|
|
7466
|
-
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];
|
|
7467
7816
|
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7468
7817
|
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7469
7818
|
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7470
7819
|
page: 1,
|
|
7471
7820
|
pageSize: 20
|
|
7472
7821
|
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7473
|
-
(0,
|
|
7822
|
+
(0, import_react54.useEffect)(function() {
|
|
7474
7823
|
var _resState_value;
|
|
7475
7824
|
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7476
7825
|
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7477
7826
|
setOptionsData(optionsData2);
|
|
7478
7827
|
}, [
|
|
7479
|
-
resState
|
|
7828
|
+
resState.loading,
|
|
7829
|
+
resState.value
|
|
7480
7830
|
]);
|
|
7481
|
-
(0,
|
|
7831
|
+
(0, import_react_use23.useUpdateEffect)(function() {
|
|
7482
7832
|
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
7483
7833
|
onChange === null || onChange === void 0 ? void 0 : onChange(changedValue, curSelectItem);
|
|
7484
7834
|
}, [
|
|
@@ -7507,7 +7857,7 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7507
7857
|
setOptionsData([]);
|
|
7508
7858
|
};
|
|
7509
7859
|
var selectLabelProps = {
|
|
7510
|
-
className:
|
|
7860
|
+
className: index_module_default22.select_label,
|
|
7511
7861
|
disabled: disabled,
|
|
7512
7862
|
defaultValue: curSelectLabel,
|
|
7513
7863
|
options: transformObj2Options(labelDic),
|
|
@@ -7523,7 +7873,7 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7523
7873
|
});
|
|
7524
7874
|
}) : optionsData;
|
|
7525
7875
|
var selectValueProps = {
|
|
7526
|
-
className: (0,
|
|
7876
|
+
className: (0, import_classnames17.default)(index_module_default22.value_select, className),
|
|
7527
7877
|
notFoundContent: notFoundContent,
|
|
7528
7878
|
value: mergedValue,
|
|
7529
7879
|
options: mergedOptionsData,
|
|
@@ -7540,12 +7890,12 @@ var EffectLabelSelect = (0, import_react53.memo)(function(props) {
|
|
|
7540
7890
|
filterOption: false,
|
|
7541
7891
|
popupMatchSelectWidth: false
|
|
7542
7892
|
};
|
|
7543
|
-
return /* @__PURE__ */ (0,
|
|
7544
|
-
className:
|
|
7893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd41.Space.Compact, {
|
|
7894
|
+
className: index_module_default22.select_wrap,
|
|
7545
7895
|
style: style,
|
|
7546
7896
|
children: [
|
|
7547
|
-
/* @__PURE__ */ (0,
|
|
7548
|
-
/* @__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))
|
|
7549
7899
|
]
|
|
7550
7900
|
});
|
|
7551
7901
|
});
|
|
@@ -7648,6 +7998,7 @@ var getSecondValue = function getSecondValue() {
|
|
|
7648
7998
|
EffectMerchantSelect: EffectMerchantSelect,
|
|
7649
7999
|
EffectReservoirSelect: EffectReservoirSelect,
|
|
7650
8000
|
EffectScopeSelect: EffectScopeSelect,
|
|
8001
|
+
EffectSearchSelect: EffectSearchSelect,
|
|
7651
8002
|
EffectSeriesSelect: EffectSeriesSelect,
|
|
7652
8003
|
EffectSeriesSelectV2: EffectSeriesSelectV2,
|
|
7653
8004
|
EffectShelveSelect: EffectShelveSelect,
|
|
@@ -7684,6 +8035,7 @@ var getSecondValue = function getSecondValue() {
|
|
|
7684
8035
|
commonStatusSelectOptions: commonStatusSelectOptions,
|
|
7685
8036
|
commonYesOrNoSelectOptions: commonYesOrNoSelectOptions,
|
|
7686
8037
|
commonYesOrNoSelectOptionsMap: commonYesOrNoSelectOptionsMap,
|
|
8038
|
+
defaultMerchantSearchSources: defaultMerchantSearchSources,
|
|
7687
8039
|
formatClock: formatClock,
|
|
7688
8040
|
formatDate: formatDate,
|
|
7689
8041
|
getCTable: getCTable,
|