@xfe-repo/web-components 1.8.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +34 -18
- package/dist/index.d.mts +41 -47
- package/dist/index.d.ts +41 -47
- package/dist/index.js +508 -400
- package/dist/index.mjs +465 -341
- package/package.json +1 -1
- package/skills/xfe-web-components/GUIDE.md +2 -2
- package/skills/xfe-web-components/SKILL.md +2 -2
- package/skills/xfe-web-components/references/EffectMerchantSelect.md +13 -28
- package/skills/xfe-web-components/references/EffectSearchSelect.md +260 -0
- package/skills/xfe-web-components/references/EffectStaffSelect.md +4 -4
- package/skills/xfe-web-components/references/commonFn.md +0 -82
- package/skills/xfe-web-components/references/EffectLabelSelect.md +0 -222
package/dist/index.mjs
CHANGED
|
@@ -3064,6 +3064,7 @@ var index_module_default6 = {
|
|
|
3064
3064
|
text: "index_module_text",
|
|
3065
3065
|
button: "index_module_button",
|
|
3066
3066
|
remote: "index_module_remote",
|
|
3067
|
+
paste_tip: "index_module_paste_tip",
|
|
3067
3068
|
upload_mask: "index_module_upload_mask"
|
|
3068
3069
|
};
|
|
3069
3070
|
// src/FileUpload/index.tsx
|
|
@@ -3834,16 +3835,19 @@ var FileUpload = function FileUpload(props) {
|
|
|
3834
3835
|
var renderPicCardUploadButton = useCallback14(function() {
|
|
3835
3836
|
if (max && fileList.length >= max) return null;
|
|
3836
3837
|
if (children) return children;
|
|
3837
|
-
if (disabled) return null;
|
|
3838
3838
|
return /* @__PURE__ */ jsxs12("div", {
|
|
3839
3839
|
className: index_module_default6.upload_btn,
|
|
3840
3840
|
children: [
|
|
3841
|
+
pastable && !disabled && /* @__PURE__ */ jsx30("div", {
|
|
3842
|
+
className: index_module_default6.paste_tip,
|
|
3843
|
+
children: "\u53EF\u7C98\u8D34\u4E0A\u4F20"
|
|
3844
|
+
}),
|
|
3841
3845
|
/* @__PURE__ */ jsx30(PlusOutlined, {}),
|
|
3842
3846
|
/* @__PURE__ */ jsx30("div", {
|
|
3843
3847
|
className: index_module_default6.text,
|
|
3844
3848
|
children: "\u4E0A\u4F20"
|
|
3845
3849
|
}),
|
|
3846
|
-
remote && /* @__PURE__ */ jsx30(RemoteUpload, {
|
|
3850
|
+
remote && !disabled && /* @__PURE__ */ jsx30(RemoteUpload, {
|
|
3847
3851
|
max: max,
|
|
3848
3852
|
onAddFile: setBufferAddFile
|
|
3849
3853
|
})
|
|
@@ -6091,13 +6095,13 @@ function useMerchantOptions(params) {
|
|
|
6091
6095
|
params
|
|
6092
6096
|
], function() {
|
|
6093
6097
|
return _async_to_generator(function() {
|
|
6094
|
-
var _res_data, _ref, enabled,
|
|
6098
|
+
var _res_data, _ref, enabled, _ref_source, source, searchParams, res, options;
|
|
6095
6099
|
return _ts_generator(this, function(_state) {
|
|
6096
6100
|
switch(_state.label){
|
|
6097
6101
|
case 0:
|
|
6098
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6102
|
+
_ref = params || {}, enabled = _ref.enabled, _ref_source = _ref.source, source = _ref_source === void 0 ? "enterpriseNo" : _ref_source, searchParams = _object_without_properties(_ref, [
|
|
6099
6103
|
"enabled",
|
|
6100
|
-
"
|
|
6104
|
+
"source"
|
|
6101
6105
|
]);
|
|
6102
6106
|
if (enabled === false) return [
|
|
6103
6107
|
2,
|
|
@@ -6108,7 +6112,7 @@ function useMerchantOptions(params) {
|
|
|
6108
6112
|
apiService.merchantList(_object_spread({
|
|
6109
6113
|
page: 1,
|
|
6110
6114
|
pageSize: 20
|
|
6111
|
-
},
|
|
6115
|
+
}, searchParams), config)
|
|
6112
6116
|
];
|
|
6113
6117
|
case 1:
|
|
6114
6118
|
res = _state.sent();
|
|
@@ -6116,9 +6120,8 @@ function useMerchantOptions(params) {
|
|
|
6116
6120
|
throw new Error((res === null || res === void 0 ? void 0 : res.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6117
6121
|
}
|
|
6118
6122
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6119
|
-
var label = labelDisplayMode === "platformName-enterpriseNo" ? "".concat(item.platformName, " - ").concat(item.enterpriseNo) : item.platformName;
|
|
6120
6123
|
return {
|
|
6121
|
-
label:
|
|
6124
|
+
label: getMerchantSourceLabel(item, source),
|
|
6122
6125
|
value: item.enterpriseNo,
|
|
6123
6126
|
originalName: item.platformName,
|
|
6124
6127
|
data: item
|
|
@@ -6141,6 +6144,20 @@ function useMerchantOptions(params) {
|
|
|
6141
6144
|
mutate: mutate
|
|
6142
6145
|
};
|
|
6143
6146
|
}
|
|
6147
|
+
var getMerchantSourceLabel = function getMerchantSourceLabel(item, sourceValue) {
|
|
6148
|
+
var sourceLabelMap = {
|
|
6149
|
+
enterpriseNo: item.enterpriseNo,
|
|
6150
|
+
platformName: item.platformName,
|
|
6151
|
+
name: item.name,
|
|
6152
|
+
// 目前接口没有手机号,先放空字符串,后续如果接口增加了手机号字段再修改这里
|
|
6153
|
+
phone: ""
|
|
6154
|
+
};
|
|
6155
|
+
return sourceLabelMap[sourceValue] || [
|
|
6156
|
+
item.enterpriseNo,
|
|
6157
|
+
item.platformName,
|
|
6158
|
+
item.name
|
|
6159
|
+
].filter(Boolean).join(" - ");
|
|
6160
|
+
};
|
|
6144
6161
|
// src/EffectMerchantSelect/index.tsx
|
|
6145
6162
|
import { debounce as debounce6 } from "@xfe-repo/web-utils/tools";
|
|
6146
6163
|
import classnames11 from "classnames";
|
|
@@ -6153,8 +6170,27 @@ var index_module_default17 = {
|
|
|
6153
6170
|
// src/EffectMerchantSelect/index.tsx
|
|
6154
6171
|
import { Select as Select7, Typography as Typography5 } from "antd";
|
|
6155
6172
|
import { jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6173
|
+
var defaultMerchantSearchSources = [
|
|
6174
|
+
{
|
|
6175
|
+
label: "\u5546\u6237\u53F7",
|
|
6176
|
+
value: "enterpriseNo"
|
|
6177
|
+
},
|
|
6178
|
+
{
|
|
6179
|
+
label: "\u5E73\u53F0\u540D",
|
|
6180
|
+
value: "platformName"
|
|
6181
|
+
},
|
|
6182
|
+
{
|
|
6183
|
+
label: "\u5546\u6237\u540D",
|
|
6184
|
+
value: "name"
|
|
6185
|
+
},
|
|
6186
|
+
{
|
|
6187
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6188
|
+
value: "phone"
|
|
6189
|
+
}
|
|
6190
|
+
];
|
|
6156
6191
|
var EffectMerchantSelect = memo31(function(props) {
|
|
6157
|
-
var
|
|
6192
|
+
var _ref;
|
|
6193
|
+
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;
|
|
6158
6194
|
var _useState25 = _sliced_to_array(useState25(), 2), searchValue = _useState25[0], setSearchValue = _useState25[1];
|
|
6159
6195
|
var _useState251 = _sliced_to_array(useState25(controlValue), 2), value = _useState251[0], setValue = _useState251[1];
|
|
6160
6196
|
var _useState252 = _sliced_to_array(useState25(), 2), name = _useState252[0], setName = _useState252[1];
|
|
@@ -6171,12 +6207,11 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6171
6207
|
useEffect21(function() {
|
|
6172
6208
|
if (controlValue !== value) setValue(controlValue);
|
|
6173
6209
|
if (controlValue) setParams({
|
|
6174
|
-
|
|
6175
|
-
|
|
6210
|
+
enterpriseNo: controlValue,
|
|
6211
|
+
source: sourceControl
|
|
6176
6212
|
});
|
|
6177
6213
|
}, [
|
|
6178
|
-
controlValue
|
|
6179
|
-
labelDisplayMode
|
|
6214
|
+
controlValue
|
|
6180
6215
|
]);
|
|
6181
6216
|
useUpdateEffect13(function() {
|
|
6182
6217
|
var changeValue = (value !== null && value !== void 0 ? value : "") === "" ? void 0 : String(value);
|
|
@@ -6190,24 +6225,23 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6190
6225
|
setName(option === null || option === void 0 ? void 0 : option.originalName);
|
|
6191
6226
|
};
|
|
6192
6227
|
var handleOnSearch = function handleOnSearch(searchValue2) {
|
|
6228
|
+
setSearchValue(searchValue2);
|
|
6193
6229
|
var _obj;
|
|
6194
|
-
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "
|
|
6230
|
+
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "source", sourceControl), _obj));
|
|
6195
6231
|
};
|
|
6196
6232
|
var handleOnSearchDebounce = useCallback22(debounce6(800, handleOnSearch), [
|
|
6197
|
-
sourceControl
|
|
6198
|
-
labelDisplayMode
|
|
6233
|
+
sourceControl
|
|
6199
6234
|
]);
|
|
6200
6235
|
var handleOnClear = function handleOnClear() {
|
|
6201
6236
|
setSearchValue(void 0);
|
|
6202
6237
|
setOptions([]);
|
|
6203
6238
|
};
|
|
6204
|
-
var
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
var
|
|
6210
|
-
var handleAddonChange = function handleAddonChange(value2, _option) {
|
|
6239
|
+
var currentSource = defaultMerchantSearchSources.find(function(s) {
|
|
6240
|
+
return s.value === sourceControl;
|
|
6241
|
+
});
|
|
6242
|
+
var currentSourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6243
|
+
var notFoundContent = state.isLoading ? "\u641C\u7D22\u4E2D" : searchValue ? "输入的".concat(currentSourceLabel, "未查询到商户信息") : "请输入".concat(currentSourceLabel);
|
|
6244
|
+
var handleAddonChange = function handleAddonChange(value2) {
|
|
6211
6245
|
setSourceControl(value2);
|
|
6212
6246
|
setValue(void 0);
|
|
6213
6247
|
setSearchValue(void 0);
|
|
@@ -6225,13 +6259,7 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6225
6259
|
popupMatchSelectWidth: false,
|
|
6226
6260
|
disabled: disabled,
|
|
6227
6261
|
defaultValue: sourceControl,
|
|
6228
|
-
options:
|
|
6229
|
-
var _param = _sliced_to_array(param, 2), value2 = _param[0], label = _param[1];
|
|
6230
|
-
return {
|
|
6231
|
-
value: value2,
|
|
6232
|
-
label: label
|
|
6233
|
-
};
|
|
6234
|
-
}),
|
|
6262
|
+
options: defaultMerchantSearchSources,
|
|
6235
6263
|
onChange: handleAddonChange,
|
|
6236
6264
|
style: {
|
|
6237
6265
|
width: 140
|
|
@@ -6239,12 +6267,13 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6239
6267
|
};
|
|
6240
6268
|
var selectBrandProps = {
|
|
6241
6269
|
notFoundContent: notFoundContent,
|
|
6242
|
-
placeholder: "请输入".concat(
|
|
6270
|
+
placeholder: "请输入".concat(currentSourceLabel),
|
|
6243
6271
|
optionFilterProp: "label",
|
|
6244
6272
|
showSearch: true,
|
|
6245
6273
|
allowClear: true,
|
|
6246
6274
|
defaultActiveFirstOption: false,
|
|
6247
6275
|
filterOption: false,
|
|
6276
|
+
popupMatchSelectWidth: false,
|
|
6248
6277
|
value: value,
|
|
6249
6278
|
options: options,
|
|
6250
6279
|
disabled: disabled,
|
|
@@ -6263,14 +6292,338 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6263
6292
|
]
|
|
6264
6293
|
});
|
|
6265
6294
|
});
|
|
6295
|
+
// src/EffectSearchSelect/index.tsx
|
|
6296
|
+
import React37, { useCallback as useCallback23, useEffect as useEffect22, useMemo as useMemo18, useRef as useRef13, useState as useState26 } from "react";
|
|
6297
|
+
import { useDebounce } from "react-use";
|
|
6298
|
+
import classnames12 from "classnames";
|
|
6299
|
+
import { Select as Select8, Space as Space3 } from "antd";
|
|
6300
|
+
// src/EffectSearchSelect/index.module.less
|
|
6301
|
+
var index_module_default18 = {
|
|
6302
|
+
search_select_wrap: "index_module_search_select_wrap",
|
|
6303
|
+
source_select: "index_module_source_select",
|
|
6304
|
+
value_select: "index_module_value_select"
|
|
6305
|
+
};
|
|
6306
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6307
|
+
import useSWRImmutable7 from "swr/immutable";
|
|
6308
|
+
// src/EffectSearchSelect/utils.ts
|
|
6309
|
+
var DEFAULT_SEARCH_PAGE_SIZE = 20;
|
|
6310
|
+
var DEFAULT_SEARCH_MIN_LENGTH = 1;
|
|
6311
|
+
var DEFAULT_MERCHANT_SEARCH_CACHE_KEY = "merchant/list";
|
|
6312
|
+
var DEFAULT_MERCHANT_SOURCE_VALUE = "enterpriseNo";
|
|
6313
|
+
var defaultMerchantSearchSources2 = [
|
|
6314
|
+
{
|
|
6315
|
+
label: "\u5546\u6237\u53F7",
|
|
6316
|
+
value: "enterpriseNo"
|
|
6317
|
+
},
|
|
6318
|
+
{
|
|
6319
|
+
label: "\u5E73\u53F0\u540D",
|
|
6320
|
+
value: "platformName"
|
|
6321
|
+
},
|
|
6322
|
+
{
|
|
6323
|
+
label: "\u5546\u6237\u540D",
|
|
6324
|
+
value: "name"
|
|
6325
|
+
},
|
|
6326
|
+
{
|
|
6327
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6328
|
+
value: "phone"
|
|
6329
|
+
}
|
|
6330
|
+
];
|
|
6331
|
+
var defaultTransformMerchantOptions = function defaultTransformMerchantOptions(data, context) {
|
|
6332
|
+
return (data.list || []).map(function(item) {
|
|
6333
|
+
return {
|
|
6334
|
+
label: getMerchantSourceLabel2(item, context.source.value),
|
|
6335
|
+
value: item.enterpriseNo,
|
|
6336
|
+
raw: item
|
|
6337
|
+
};
|
|
6338
|
+
});
|
|
6339
|
+
};
|
|
6340
|
+
var getMerchantSourceLabel2 = function getMerchantSourceLabel2(item, sourceValue) {
|
|
6341
|
+
var sourceLabelMap = {
|
|
6342
|
+
enterpriseNo: item.enterpriseNo,
|
|
6343
|
+
platformName: item.platformName,
|
|
6344
|
+
name: item.name,
|
|
6345
|
+
// 目前接口没有手机号,先放空字符串,后续如果接口增加了手机号字段再修改这里
|
|
6346
|
+
phone: ""
|
|
6347
|
+
};
|
|
6348
|
+
return sourceLabelMap[sourceValue] || [
|
|
6349
|
+
item.enterpriseNo,
|
|
6350
|
+
item.platformName,
|
|
6351
|
+
item.name
|
|
6352
|
+
].filter(Boolean).join(" - ");
|
|
6353
|
+
};
|
|
6354
|
+
var getDefaultSourceValue = function getDefaultSourceValue(sources, defaultSourceValue) {
|
|
6355
|
+
var _sources_;
|
|
6356
|
+
if (defaultSourceValue && sources.some(function(source) {
|
|
6357
|
+
return source.value === defaultSourceValue;
|
|
6358
|
+
})) {
|
|
6359
|
+
return defaultSourceValue;
|
|
6360
|
+
}
|
|
6361
|
+
return (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value;
|
|
6362
|
+
};
|
|
6363
|
+
var getCurrentSource = function getCurrentSource(sources, selectedSourceValue) {
|
|
6364
|
+
return sources.find(function(source) {
|
|
6365
|
+
return source.value === selectedSourceValue;
|
|
6366
|
+
}) || sources[0];
|
|
6367
|
+
};
|
|
6368
|
+
var buildDefaultSearchParams = function buildDefaultSearchParams(keyword, source, baseParams, pageSize) {
|
|
6369
|
+
return _object_spread_props(_object_spread({
|
|
6370
|
+
page: 1,
|
|
6371
|
+
pageSize: pageSize
|
|
6372
|
+
}, baseParams), _define_property({}, source.value, keyword));
|
|
6373
|
+
};
|
|
6374
|
+
var normalizeSelectValue = function normalizeSelectValue(value) {
|
|
6375
|
+
return value === null ? void 0 : value;
|
|
6376
|
+
};
|
|
6377
|
+
var normalizeSelectedOption = function normalizeSelectedOption(option) {
|
|
6378
|
+
var selectedOption = Array.isArray(option) ? option[0] : option;
|
|
6379
|
+
return selectedOption ? selectedOption : void 0;
|
|
6380
|
+
};
|
|
6381
|
+
var resolveMergedDefaultSourceValue = function resolveMergedDefaultSourceValue(sources, defaultSourceValue, hasCustomSources) {
|
|
6382
|
+
var _sources_;
|
|
6383
|
+
if (defaultSourceValue) return defaultSourceValue;
|
|
6384
|
+
return hasCustomSources ? (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value : DEFAULT_MERCHANT_SOURCE_VALUE;
|
|
6385
|
+
};
|
|
6386
|
+
var resolveNotFoundContent = function resolveNotFoundContent(params) {
|
|
6387
|
+
var error = params.error, isLoading = params.isLoading, keyword = params.keyword, sourceLabel = params.sourceLabel, defaultPlaceholder = params.defaultPlaceholder;
|
|
6388
|
+
if (error) return error.message || "\u67E5\u8BE2\u5931\u8D25";
|
|
6389
|
+
if (isLoading) return "\u641C\u7D22\u4E2D";
|
|
6390
|
+
if (keyword) return "输入的".concat(sourceLabel, "未查询到信息");
|
|
6391
|
+
return defaultPlaceholder;
|
|
6392
|
+
};
|
|
6393
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6394
|
+
function useEffectSearchOptions(params) {
|
|
6395
|
+
var config = useRequestConfig().config;
|
|
6396
|
+
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;
|
|
6397
|
+
var swrKey = enabled && source ? [
|
|
6398
|
+
"EffectSearchSelect",
|
|
6399
|
+
cacheKey,
|
|
6400
|
+
source.value,
|
|
6401
|
+
keyword,
|
|
6402
|
+
fetchParams,
|
|
6403
|
+
pageSize
|
|
6404
|
+
] : null;
|
|
6405
|
+
var _useSWRImmutable7 = useSWRImmutable7(swrKey, function() {
|
|
6406
|
+
return _async_to_generator(function() {
|
|
6407
|
+
var requestParams, response;
|
|
6408
|
+
return _ts_generator(this, function(_state) {
|
|
6409
|
+
switch(_state.label){
|
|
6410
|
+
case 0:
|
|
6411
|
+
if (!source) return [
|
|
6412
|
+
2,
|
|
6413
|
+
[]
|
|
6414
|
+
];
|
|
6415
|
+
requestParams = buildParams ? buildParams(keyword, source, fetchParams) : buildDefaultSearchParams(keyword, source, fetchParams, pageSize);
|
|
6416
|
+
return [
|
|
6417
|
+
4,
|
|
6418
|
+
request(requestParams, config)
|
|
6419
|
+
];
|
|
6420
|
+
case 1:
|
|
6421
|
+
response = _state.sent();
|
|
6422
|
+
if ((response === null || response === void 0 ? void 0 : response.code) !== 200) {
|
|
6423
|
+
throw new Error((response === null || response === void 0 ? void 0 : response.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6424
|
+
}
|
|
6425
|
+
return [
|
|
6426
|
+
2,
|
|
6427
|
+
transformOptions(response.data, {
|
|
6428
|
+
source: source,
|
|
6429
|
+
keyword: keyword
|
|
6430
|
+
})
|
|
6431
|
+
];
|
|
6432
|
+
}
|
|
6433
|
+
});
|
|
6434
|
+
})();
|
|
6435
|
+
}, {
|
|
6436
|
+
errorRetryCount: 0,
|
|
6437
|
+
shouldRetryOnError: false
|
|
6438
|
+
}), data = _useSWRImmutable7.data, error = _useSWRImmutable7.error, isLoading = _useSWRImmutable7.isLoading, mutate = _useSWRImmutable7.mutate;
|
|
6439
|
+
return {
|
|
6440
|
+
options: data || [],
|
|
6441
|
+
error: error,
|
|
6442
|
+
isLoading: isLoading,
|
|
6443
|
+
mutate: mutate
|
|
6444
|
+
};
|
|
6445
|
+
}
|
|
6446
|
+
// src/EffectSearchSelect/index.tsx
|
|
6447
|
+
import { jsx as jsx42, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6448
|
+
var EMPTY_FETCH_PARAMS = {};
|
|
6449
|
+
var EffectSearchSelectBase = function EffectSearchSelectBase(props) {
|
|
6450
|
+
var _ref;
|
|
6451
|
+
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, [
|
|
6452
|
+
"className",
|
|
6453
|
+
"style",
|
|
6454
|
+
"value",
|
|
6455
|
+
"defaultValue",
|
|
6456
|
+
"disabled",
|
|
6457
|
+
"placeholder",
|
|
6458
|
+
"notFoundContent",
|
|
6459
|
+
"sources",
|
|
6460
|
+
"defaultSourceValue",
|
|
6461
|
+
"fetchParams",
|
|
6462
|
+
"pageSize",
|
|
6463
|
+
"request",
|
|
6464
|
+
"buildParams",
|
|
6465
|
+
"transformOptions",
|
|
6466
|
+
"onChange",
|
|
6467
|
+
"onClear"
|
|
6468
|
+
]);
|
|
6469
|
+
var apiService = useRequestConfig().apiService;
|
|
6470
|
+
var valueControlledRef = useRef13(Object.prototype.hasOwnProperty.call(props, "value"));
|
|
6471
|
+
var valueControlled = valueControlledRef.current;
|
|
6472
|
+
var hasCustomSources = Boolean(sources === null || sources === void 0 ? void 0 : sources.length);
|
|
6473
|
+
var mergedSources = useMemo18(function() {
|
|
6474
|
+
return hasCustomSources ? sources : defaultMerchantSearchSources2;
|
|
6475
|
+
}, [
|
|
6476
|
+
hasCustomSources,
|
|
6477
|
+
sources
|
|
6478
|
+
]);
|
|
6479
|
+
var mergedDefaultSourceValue = useMemo18(function() {
|
|
6480
|
+
return resolveMergedDefaultSourceValue(mergedSources, defaultSourceValue, hasCustomSources);
|
|
6481
|
+
}, [
|
|
6482
|
+
defaultSourceValue,
|
|
6483
|
+
hasCustomSources,
|
|
6484
|
+
mergedSources
|
|
6485
|
+
]);
|
|
6486
|
+
var _useState26 = _sliced_to_array(useState26(function() {
|
|
6487
|
+
return getDefaultSourceValue(mergedSources, mergedDefaultSourceValue);
|
|
6488
|
+
}), 2), innerSourceValue = _useState26[0], setInnerSourceValue = _useState26[1];
|
|
6489
|
+
var currentSource = getCurrentSource(mergedSources, innerSourceValue);
|
|
6490
|
+
var currentSourceValue = currentSource === null || currentSource === void 0 ? void 0 : currentSource.value;
|
|
6491
|
+
useEffect22(function() {
|
|
6492
|
+
var isCurrentSourceValid = mergedSources.some(function(source) {
|
|
6493
|
+
return source.value === innerSourceValue;
|
|
6494
|
+
});
|
|
6495
|
+
if (!isCurrentSourceValid) {
|
|
6496
|
+
setInnerSourceValue(getDefaultSourceValue(mergedSources, mergedDefaultSourceValue));
|
|
6497
|
+
}
|
|
6498
|
+
}, [
|
|
6499
|
+
innerSourceValue,
|
|
6500
|
+
mergedDefaultSourceValue,
|
|
6501
|
+
mergedSources
|
|
6502
|
+
]);
|
|
6503
|
+
var _useState261 = _sliced_to_array(useState26(function() {
|
|
6504
|
+
return normalizeSelectValue(value !== null && value !== void 0 ? value : defaultValue);
|
|
6505
|
+
}), 2), innerValue = _useState261[0], setInnerValue = _useState261[1];
|
|
6506
|
+
var mergedValue = valueControlled ? normalizeSelectValue(value) : innerValue;
|
|
6507
|
+
var _useState262 = _sliced_to_array(useState26(""), 2), searchText = _useState262[0], setSearchText = _useState262[1];
|
|
6508
|
+
var _useState263 = _sliced_to_array(useState26(""), 2), keyword = _useState263[0], setKeyword = _useState263[1];
|
|
6509
|
+
useDebounce(function() {
|
|
6510
|
+
setKeyword(searchText.trim());
|
|
6511
|
+
}, 600, [
|
|
6512
|
+
searchText
|
|
6513
|
+
]);
|
|
6514
|
+
var requestFn = request || apiService.merchantList;
|
|
6515
|
+
var transformOptionsFn = transformOptions || defaultTransformMerchantOptions;
|
|
6516
|
+
var searchEnabled = Boolean(currentSource && keyword.length >= DEFAULT_SEARCH_MIN_LENGTH);
|
|
6517
|
+
var searchCacheKey = request ? request.name || "custom" : DEFAULT_MERCHANT_SEARCH_CACHE_KEY;
|
|
6518
|
+
var _useEffectSearchOptions = useEffectSearchOptions({
|
|
6519
|
+
cacheKey: searchCacheKey,
|
|
6520
|
+
keyword: keyword,
|
|
6521
|
+
source: currentSource,
|
|
6522
|
+
enabled: searchEnabled,
|
|
6523
|
+
fetchParams: fetchParams,
|
|
6524
|
+
pageSize: pageSize,
|
|
6525
|
+
request: requestFn,
|
|
6526
|
+
buildParams: buildParams,
|
|
6527
|
+
transformOptions: transformOptionsFn
|
|
6528
|
+
}), options = _useEffectSearchOptions.options, isLoading = _useEffectSearchOptions.isLoading, error = _useEffectSearchOptions.error;
|
|
6529
|
+
var resetSearchAndValue = useCallback23(function() {
|
|
6530
|
+
setSearchText("");
|
|
6531
|
+
setKeyword("");
|
|
6532
|
+
if (!valueControlled) {
|
|
6533
|
+
setInnerValue(void 0);
|
|
6534
|
+
}
|
|
6535
|
+
}, [
|
|
6536
|
+
valueControlled
|
|
6537
|
+
]);
|
|
6538
|
+
var handleSourceChange = useCallback23(function(nextSourceValue) {
|
|
6539
|
+
setInnerSourceValue(nextSourceValue);
|
|
6540
|
+
resetSearchAndValue();
|
|
6541
|
+
}, [
|
|
6542
|
+
resetSearchAndValue
|
|
6543
|
+
]);
|
|
6544
|
+
var handleSearch = useCallback23(function(nextSearchText) {
|
|
6545
|
+
setSearchText(nextSearchText);
|
|
6546
|
+
}, []);
|
|
6547
|
+
var handleChange = useCallback23(function(nextValue, option) {
|
|
6548
|
+
var selectedOption = normalizeSelectedOption(option);
|
|
6549
|
+
var normalizedValue = normalizeSelectValue(nextValue);
|
|
6550
|
+
if (!valueControlled) {
|
|
6551
|
+
setInnerValue(normalizedValue);
|
|
6552
|
+
}
|
|
6553
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(normalizedValue, selectedOption);
|
|
6554
|
+
}, [
|
|
6555
|
+
onChange,
|
|
6556
|
+
valueControlled
|
|
6557
|
+
]);
|
|
6558
|
+
var handleClear = useCallback23(function() {
|
|
6559
|
+
resetSearchAndValue();
|
|
6560
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
6561
|
+
}, [
|
|
6562
|
+
onClear,
|
|
6563
|
+
resetSearchAndValue
|
|
6564
|
+
]);
|
|
6565
|
+
var sourceOptions = useMemo18(function() {
|
|
6566
|
+
return mergedSources.map(function(param) {
|
|
6567
|
+
var label = param.label, val = param.value;
|
|
6568
|
+
return {
|
|
6569
|
+
label: label,
|
|
6570
|
+
value: val
|
|
6571
|
+
};
|
|
6572
|
+
});
|
|
6573
|
+
}, [
|
|
6574
|
+
mergedSources
|
|
6575
|
+
]);
|
|
6576
|
+
var sourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6577
|
+
var defaultPlaceholder = sourceLabel ? "请输入".concat(sourceLabel) : "\u8BF7\u8F93\u5165";
|
|
6578
|
+
var defaultNotFoundContent = resolveNotFoundContent({
|
|
6579
|
+
error: error,
|
|
6580
|
+
isLoading: isLoading,
|
|
6581
|
+
keyword: keyword,
|
|
6582
|
+
sourceLabel: sourceLabel,
|
|
6583
|
+
defaultPlaceholder: defaultPlaceholder
|
|
6584
|
+
});
|
|
6585
|
+
return /* @__PURE__ */ jsxs19(Space3.Compact, {
|
|
6586
|
+
className: index_module_default18.search_select_wrap,
|
|
6587
|
+
style: style,
|
|
6588
|
+
children: [
|
|
6589
|
+
/* @__PURE__ */ jsx42(Select8, {
|
|
6590
|
+
className: index_module_default18.source_select,
|
|
6591
|
+
disabled: disabled,
|
|
6592
|
+
value: currentSourceValue,
|
|
6593
|
+
options: sourceOptions,
|
|
6594
|
+
popupMatchSelectWidth: false,
|
|
6595
|
+
onChange: handleSourceChange
|
|
6596
|
+
}),
|
|
6597
|
+
/* @__PURE__ */ jsx42(Select8, _object_spread_props(_object_spread({}, selectProps), {
|
|
6598
|
+
className: classnames12(index_module_default18.value_select, className),
|
|
6599
|
+
disabled: disabled,
|
|
6600
|
+
value: mergedValue,
|
|
6601
|
+
options: options,
|
|
6602
|
+
loading: isLoading,
|
|
6603
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
|
|
6604
|
+
notFoundContent: notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : defaultNotFoundContent,
|
|
6605
|
+
showSearch: true,
|
|
6606
|
+
allowClear: true,
|
|
6607
|
+
defaultActiveFirstOption: false,
|
|
6608
|
+
filterOption: false,
|
|
6609
|
+
popupMatchSelectWidth: false,
|
|
6610
|
+
optionFilterProp: "label",
|
|
6611
|
+
onSearch: handleSearch,
|
|
6612
|
+
onChange: handleChange,
|
|
6613
|
+
onClear: handleClear
|
|
6614
|
+
}))
|
|
6615
|
+
]
|
|
6616
|
+
});
|
|
6617
|
+
};
|
|
6618
|
+
var EffectSearchSelect = React37.memo(EffectSearchSelectBase);
|
|
6266
6619
|
// src/EffectScopeSelect/index.tsx
|
|
6267
|
-
import { memo as memo33, useCallback as
|
|
6268
|
-
import { Flex as Flex3, Space as
|
|
6620
|
+
import { memo as memo33, useCallback as useCallback24, useMemo as useMemo19, useState as useState27 } from "react";
|
|
6621
|
+
import { Flex as Flex3, Space as Space5 } from "antd";
|
|
6269
6622
|
import { useUpdateEffect as useUpdateEffect14 } from "react-use";
|
|
6270
6623
|
// src/EffectScopeSelect/ScopeViewMode.tsx
|
|
6271
6624
|
import { memo as memo32 } from "react";
|
|
6272
|
-
import { Space as
|
|
6273
|
-
import { jsx as
|
|
6625
|
+
import { Space as Space4, Typography as Typography6 } from "antd";
|
|
6626
|
+
import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6274
6627
|
var ScopeViewMode = memo32(function(props) {
|
|
6275
6628
|
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;
|
|
6276
6629
|
var items = [];
|
|
@@ -6294,18 +6647,18 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6294
6647
|
label: "SKU",
|
|
6295
6648
|
value: skuName || String(skuId)
|
|
6296
6649
|
});
|
|
6297
|
-
if (items.length === 0) return /* @__PURE__ */
|
|
6650
|
+
if (items.length === 0) return /* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6298
6651
|
style: {
|
|
6299
6652
|
fontSize: 14
|
|
6300
6653
|
},
|
|
6301
6654
|
type: "danger",
|
|
6302
6655
|
children: "\u8BF7\u5148\u9009\u62E9\u54C1\u7C7B\u4FE1\u606F"
|
|
6303
6656
|
});
|
|
6304
|
-
return /* @__PURE__ */
|
|
6657
|
+
return /* @__PURE__ */ jsx43(Space4, {
|
|
6305
6658
|
size: 4,
|
|
6306
6659
|
children: items.map(function(param) {
|
|
6307
6660
|
var label = param.label, value = param.value;
|
|
6308
|
-
return /* @__PURE__ */
|
|
6661
|
+
return /* @__PURE__ */ jsxs20(Space4, {
|
|
6309
6662
|
size: 4,
|
|
6310
6663
|
style: {
|
|
6311
6664
|
height: 32,
|
|
@@ -6313,7 +6666,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6313
6666
|
borderRadius: 6
|
|
6314
6667
|
},
|
|
6315
6668
|
children: [
|
|
6316
|
-
/* @__PURE__ */
|
|
6669
|
+
/* @__PURE__ */ jsxs20(Typography6.Text, {
|
|
6317
6670
|
style: {
|
|
6318
6671
|
fontSize: 14,
|
|
6319
6672
|
paddingRight: 16
|
|
@@ -6323,7 +6676,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6323
6676
|
":"
|
|
6324
6677
|
]
|
|
6325
6678
|
}),
|
|
6326
|
-
/* @__PURE__ */
|
|
6679
|
+
/* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6327
6680
|
style: {
|
|
6328
6681
|
fontSize: 14
|
|
6329
6682
|
},
|
|
@@ -6335,7 +6688,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6335
6688
|
});
|
|
6336
6689
|
});
|
|
6337
6690
|
// src/EffectScopeSelect/index.tsx
|
|
6338
|
-
import { jsx as
|
|
6691
|
+
import { jsx as jsx44, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6339
6692
|
var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
6340
6693
|
ScopeLevelEnum2[ScopeLevelEnum2["CATEGORY"] = 1] = "CATEGORY";
|
|
6341
6694
|
ScopeLevelEnum2[ScopeLevelEnum2["BRAND"] = 2] = "BRAND";
|
|
@@ -6346,8 +6699,8 @@ var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
|
6346
6699
|
}(ScopeLevelEnum || {});
|
|
6347
6700
|
var EffectScopeSelect = memo33(function(props) {
|
|
6348
6701
|
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;
|
|
6349
|
-
var
|
|
6350
|
-
var lastLevelCategoryId =
|
|
6702
|
+
var _useState27 = _sliced_to_array(useState27(_object_spread({}, controlledValue, defaultValue)), 2), value = _useState27[0], setValue = _useState27[1];
|
|
6703
|
+
var lastLevelCategoryId = useMemo19(function() {
|
|
6351
6704
|
var _value_categoryIds;
|
|
6352
6705
|
return (_value_categoryIds = value.categoryIds) === null || _value_categoryIds === void 0 ? void 0 : _value_categoryIds[value.categoryIds.length - 1];
|
|
6353
6706
|
}, [
|
|
@@ -6358,14 +6711,14 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6358
6711
|
}, [
|
|
6359
6712
|
controlledValue
|
|
6360
6713
|
]);
|
|
6361
|
-
var handleChange =
|
|
6714
|
+
var handleChange = useCallback24(function(newValue) {
|
|
6362
6715
|
setTimeout(function() {
|
|
6363
6716
|
return onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
6364
6717
|
}, 0);
|
|
6365
6718
|
}, [
|
|
6366
6719
|
onChange
|
|
6367
6720
|
]);
|
|
6368
|
-
var handleCategoryChange =
|
|
6721
|
+
var handleCategoryChange = useCallback24(function(_values, selectedList) {
|
|
6369
6722
|
if (!selectedList || !isSingleTreeSelected(selectedList)) {
|
|
6370
6723
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange();
|
|
6371
6724
|
return;
|
|
@@ -6384,7 +6737,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6384
6737
|
handleChange,
|
|
6385
6738
|
requireLevel
|
|
6386
6739
|
]);
|
|
6387
|
-
var handleBrandChange =
|
|
6740
|
+
var handleBrandChange = useCallback24(function(brandValue) {
|
|
6388
6741
|
var brandId = brandValue === void 0 ? void 0 : Number(brandValue);
|
|
6389
6742
|
setValue(function(prev) {
|
|
6390
6743
|
var newScope = {
|
|
@@ -6400,7 +6753,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6400
6753
|
handleChange,
|
|
6401
6754
|
requireLevel
|
|
6402
6755
|
]);
|
|
6403
|
-
var handleSeriesChange =
|
|
6756
|
+
var handleSeriesChange = useCallback24(function(seriesValue) {
|
|
6404
6757
|
var seriesId = seriesValue === void 0 ? void 0 : Number(seriesValue);
|
|
6405
6758
|
setValue(function(prev) {
|
|
6406
6759
|
var newScope = {
|
|
@@ -6417,7 +6770,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6417
6770
|
handleChange,
|
|
6418
6771
|
requireLevel
|
|
6419
6772
|
]);
|
|
6420
|
-
var handleSpuChange =
|
|
6773
|
+
var handleSpuChange = useCallback24(function(spuValue) {
|
|
6421
6774
|
var spuId = spuValue === void 0 ? void 0 : Number(spuValue);
|
|
6422
6775
|
setValue(function(prev) {
|
|
6423
6776
|
var newScope = {
|
|
@@ -6435,7 +6788,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6435
6788
|
handleChange,
|
|
6436
6789
|
requireLevel
|
|
6437
6790
|
]);
|
|
6438
|
-
var handleSkuChange =
|
|
6791
|
+
var handleSkuChange = useCallback24(function(skuValue) {
|
|
6439
6792
|
var skuId = skuValue === void 0 ? void 0 : Number(skuValue);
|
|
6440
6793
|
setValue(function(prev) {
|
|
6441
6794
|
var newScope = _object_spread_props(_object_spread({}, prev), {
|
|
@@ -6450,18 +6803,18 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6450
6803
|
handleChange,
|
|
6451
6804
|
requireLevel
|
|
6452
6805
|
]);
|
|
6453
|
-
var renderLabel =
|
|
6454
|
-
return /* @__PURE__ */
|
|
6806
|
+
var renderLabel = useCallback24(function(label, required) {
|
|
6807
|
+
return /* @__PURE__ */ jsx44(Flex3, {
|
|
6455
6808
|
flex: "0 0 auto",
|
|
6456
|
-
children: /* @__PURE__ */
|
|
6809
|
+
children: /* @__PURE__ */ jsxs21(Space5, {
|
|
6457
6810
|
children: [
|
|
6458
|
-
required && /* @__PURE__ */
|
|
6811
|
+
required && /* @__PURE__ */ jsx44("span", {
|
|
6459
6812
|
style: {
|
|
6460
6813
|
color: "var(--ant-color-error)"
|
|
6461
6814
|
},
|
|
6462
6815
|
children: "*"
|
|
6463
6816
|
}),
|
|
6464
|
-
/* @__PURE__ */
|
|
6817
|
+
/* @__PURE__ */ jsxs21("span", {
|
|
6465
6818
|
children: [
|
|
6466
6819
|
label,
|
|
6467
6820
|
":"
|
|
@@ -6472,34 +6825,34 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6472
6825
|
});
|
|
6473
6826
|
}, []);
|
|
6474
6827
|
if (mode === "view") {
|
|
6475
|
-
return /* @__PURE__ */
|
|
6828
|
+
return /* @__PURE__ */ jsx44(ScopeViewMode, _object_spread({}, value));
|
|
6476
6829
|
}
|
|
6477
|
-
return /* @__PURE__ */
|
|
6830
|
+
return /* @__PURE__ */ jsxs21(Flex3, {
|
|
6478
6831
|
justify: "flex-start",
|
|
6479
6832
|
align: "center",
|
|
6480
6833
|
wrap: "nowrap",
|
|
6481
6834
|
gap: "15px",
|
|
6482
6835
|
children: [
|
|
6483
|
-
/* @__PURE__ */
|
|
6836
|
+
/* @__PURE__ */ jsxs21(Flex3, {
|
|
6484
6837
|
align: "center",
|
|
6485
6838
|
gap: "5px",
|
|
6486
6839
|
flex: "0 0 auto",
|
|
6487
6840
|
children: [
|
|
6488
6841
|
renderLabel("\u5206\u7C7B", requireLevel >= 1 /* CATEGORY */ ),
|
|
6489
|
-
/* @__PURE__ */
|
|
6842
|
+
/* @__PURE__ */ jsx44(EffectCategoryCascade, {
|
|
6490
6843
|
onChange: handleCategoryChange,
|
|
6491
6844
|
changeOnSelect: categoryChangeOnSelect,
|
|
6492
6845
|
value: value.categoryIds
|
|
6493
6846
|
})
|
|
6494
6847
|
]
|
|
6495
6848
|
}),
|
|
6496
|
-
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */
|
|
6849
|
+
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6497
6850
|
align: "center",
|
|
6498
6851
|
gap: "5px",
|
|
6499
6852
|
flex: "0 0 auto",
|
|
6500
6853
|
children: [
|
|
6501
6854
|
renderLabel("\u54C1\u724C", requireLevel >= 2 /* BRAND */ ),
|
|
6502
|
-
/* @__PURE__ */
|
|
6855
|
+
/* @__PURE__ */ jsx44(EffectBrandSelect, _object_spread_props(_object_spread({
|
|
6503
6856
|
categoryId: lastLevelCategoryId
|
|
6504
6857
|
}, value), {
|
|
6505
6858
|
onChange: handleBrandChange,
|
|
@@ -6507,13 +6860,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6507
6860
|
}))
|
|
6508
6861
|
]
|
|
6509
6862
|
}),
|
|
6510
|
-
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */
|
|
6863
|
+
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6511
6864
|
align: "center",
|
|
6512
6865
|
gap: "5px",
|
|
6513
6866
|
flex: "0 0 auto",
|
|
6514
6867
|
children: [
|
|
6515
6868
|
renderLabel("\u7CFB\u5217", requireLevel >= 3 /* SERIES */ ),
|
|
6516
|
-
/* @__PURE__ */
|
|
6869
|
+
/* @__PURE__ */ jsx44(EffectSeriesSelect, _object_spread_props(_object_spread({
|
|
6517
6870
|
categoryId: lastLevelCategoryId
|
|
6518
6871
|
}, value), {
|
|
6519
6872
|
onChange: handleSeriesChange,
|
|
@@ -6521,13 +6874,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6521
6874
|
}))
|
|
6522
6875
|
]
|
|
6523
6876
|
}),
|
|
6524
|
-
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */
|
|
6877
|
+
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6525
6878
|
align: "center",
|
|
6526
6879
|
gap: "5px",
|
|
6527
6880
|
flex: "0 0 auto",
|
|
6528
6881
|
children: [
|
|
6529
6882
|
renderLabel("SPU", requireLevel >= 4 /* SPU */ ),
|
|
6530
|
-
/* @__PURE__ */
|
|
6883
|
+
/* @__PURE__ */ jsx44(EffectSpuSelect, _object_spread_props(_object_spread({
|
|
6531
6884
|
categoryId: lastLevelCategoryId
|
|
6532
6885
|
}, value), {
|
|
6533
6886
|
onChange: handleSpuChange,
|
|
@@ -6535,13 +6888,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6535
6888
|
}))
|
|
6536
6889
|
]
|
|
6537
6890
|
}),
|
|
6538
|
-
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */
|
|
6891
|
+
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6539
6892
|
align: "center",
|
|
6540
6893
|
gap: "5px",
|
|
6541
6894
|
flex: "0 0 auto",
|
|
6542
6895
|
children: [
|
|
6543
6896
|
renderLabel("SKU", requireLevel >= 5 /* SKU */ ),
|
|
6544
|
-
/* @__PURE__ */
|
|
6897
|
+
/* @__PURE__ */ jsx44(EffectSkuSelect, _object_spread_props(_object_spread({
|
|
6545
6898
|
categoryId: lastLevelCategoryId
|
|
6546
6899
|
}, value), {
|
|
6547
6900
|
onChange: handleSkuChange,
|
|
@@ -6553,22 +6906,22 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6553
6906
|
});
|
|
6554
6907
|
});
|
|
6555
6908
|
// src/EffectStaffSelect/index.tsx
|
|
6556
|
-
import { memo as memo34, useCallback as
|
|
6909
|
+
import { memo as memo34, useCallback as useCallback25, useEffect as useEffect23, useState as useState28 } from "react";
|
|
6557
6910
|
import { useAsyncFn as useAsyncFn4, useMount as useMount5, useUpdateEffect as useUpdateEffect15 } from "react-use";
|
|
6558
|
-
import
|
|
6559
|
-
import { Select as
|
|
6911
|
+
import classnames13 from "classnames";
|
|
6912
|
+
import { Select as Select9 } from "antd";
|
|
6560
6913
|
import { debounce as debounce7 } from "@xfe-repo/web-utils/tools";
|
|
6561
6914
|
// src/EffectStaffSelect/index.module.less
|
|
6562
|
-
var
|
|
6915
|
+
var index_module_default19 = {
|
|
6563
6916
|
select: "index_module_select4"
|
|
6564
6917
|
};
|
|
6565
6918
|
// src/EffectStaffSelect/index.tsx
|
|
6566
|
-
import { jsx as
|
|
6919
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6567
6920
|
var EffectStaffSelect = memo34(function(props) {
|
|
6568
6921
|
var _state_value_data, _state_value;
|
|
6569
6922
|
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;
|
|
6570
|
-
var
|
|
6571
|
-
var
|
|
6923
|
+
var _useState28 = _sliced_to_array(useState28([]), 2), options = _useState28[0], setOptions = _useState28[1];
|
|
6924
|
+
var _useState281 = _sliced_to_array(useState28(controlValue !== null && controlValue !== void 0 ? controlValue : defaultValue), 2), value = _useState281[0], setValue = _useState281[1];
|
|
6572
6925
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6573
6926
|
var getBusinessOptions = function getBusinessOptions(businessName, currentDeptId) {
|
|
6574
6927
|
return _async_to_generator(function() {
|
|
@@ -6602,10 +6955,10 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6602
6955
|
deptId,
|
|
6603
6956
|
config
|
|
6604
6957
|
]), 2), state = _useAsyncFn4[0], searchFetch = _useAsyncFn4[1];
|
|
6605
|
-
var debounceSearchFetch =
|
|
6958
|
+
var debounceSearchFetch = useCallback25(debounce7(600, searchFetch), [
|
|
6606
6959
|
searchFetch
|
|
6607
6960
|
]);
|
|
6608
|
-
|
|
6961
|
+
useEffect23(function() {
|
|
6609
6962
|
var _state_value_data, _state_value;
|
|
6610
6963
|
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)) {
|
|
6611
6964
|
return;
|
|
@@ -6660,8 +7013,8 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6660
7013
|
}
|
|
6661
7014
|
};
|
|
6662
7015
|
var defaultPlaceholder = deptId ? "\u8BF7\u9009\u62E9\u5458\u5DE5\u59D3\u540D" : "\u8BF7\u5148\u8F93\u5165\u5458\u5DE5\u59D3\u540D";
|
|
6663
|
-
return /* @__PURE__ */
|
|
6664
|
-
className:
|
|
7016
|
+
return /* @__PURE__ */ jsx45(Select9, {
|
|
7017
|
+
className: classnames13(index_module_default19.select, className),
|
|
6665
7018
|
style: style,
|
|
6666
7019
|
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,
|
|
6667
7020
|
placeholder: placeholder || defaultPlaceholder,
|
|
@@ -6679,14 +7032,14 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6679
7032
|
});
|
|
6680
7033
|
});
|
|
6681
7034
|
// src/EffectReservoirSelect/EffectReservoirSelect.tsx
|
|
6682
|
-
import { memo as memo35, useEffect as
|
|
7035
|
+
import { memo as memo35, useEffect as useEffect24, useState as useState29 } from "react";
|
|
6683
7036
|
import { useAsyncFn as useAsyncFn5, useMount as useMount6, usePrevious as usePrevious7, useUpdateEffect as useUpdateEffect16 } from "react-use";
|
|
6684
|
-
import { Select as
|
|
6685
|
-
import { jsx as
|
|
7037
|
+
import { Select as Select10 } from "antd";
|
|
7038
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6686
7039
|
var EffectReservoirSelect = memo35(function(props) {
|
|
6687
7040
|
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;
|
|
6688
|
-
var
|
|
6689
|
-
var
|
|
7041
|
+
var _useState29 = _sliced_to_array(useState29([]), 2), options = _useState29[0], setOptions = _useState29[1];
|
|
7042
|
+
var _useState291 = _sliced_to_array(useState29(controlValue || defaultValue), 2), value = _useState291[0], setValue = _useState291[1];
|
|
6690
7043
|
var prevControlValue = usePrevious7(controlValue);
|
|
6691
7044
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6692
7045
|
var get_reservoir_options = function get_reservoir_options() {
|
|
@@ -6719,7 +7072,7 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6719
7072
|
var _useAsyncFn5 = _sliced_to_array(useAsyncFn5(get_reservoir_options, [
|
|
6720
7073
|
warehouseId
|
|
6721
7074
|
]), 2), state = _useAsyncFn5[0], fetch = _useAsyncFn5[1];
|
|
6722
|
-
|
|
7075
|
+
useEffect24(function() {
|
|
6723
7076
|
var _state_value;
|
|
6724
7077
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6725
7078
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6770,20 +7123,20 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6770
7123
|
onChange: handleOnChange,
|
|
6771
7124
|
loading: state.loading
|
|
6772
7125
|
};
|
|
6773
|
-
return /* @__PURE__ */
|
|
7126
|
+
return /* @__PURE__ */ jsx46(Select10, _object_spread({
|
|
6774
7127
|
className: className
|
|
6775
7128
|
}, selectBrandProps));
|
|
6776
7129
|
});
|
|
6777
7130
|
// src/EffectReservoirSelect/EffectShelveSelect.tsx
|
|
6778
|
-
import { memo as memo36, useEffect as
|
|
7131
|
+
import { memo as memo36, useEffect as useEffect25, useState as useState30 } from "react";
|
|
6779
7132
|
import { useAsyncFn as useAsyncFn6, useMount as useMount7, usePrevious as usePrevious8, useUpdateEffect as useUpdateEffect17 } from "react-use";
|
|
6780
|
-
import { Select as
|
|
6781
|
-
import { jsx as
|
|
7133
|
+
import { Select as Select11 } from "antd";
|
|
7134
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6782
7135
|
var EffectShelveSelect = memo36(function(props) {
|
|
6783
7136
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, reservoirId = props.reservoirId;
|
|
6784
7137
|
var _props_valueType = props.valueType, valueType = _props_valueType === void 0 ? "code" : _props_valueType;
|
|
6785
|
-
var
|
|
6786
|
-
var
|
|
7138
|
+
var _useState30 = _sliced_to_array(useState30([]), 2), options = _useState30[0], setOptions = _useState30[1];
|
|
7139
|
+
var _useState301 = _sliced_to_array(useState30(controlValue || defaultValue), 2), value = _useState301[0], setValue = _useState301[1];
|
|
6787
7140
|
var prevControlValue = usePrevious8(controlValue);
|
|
6788
7141
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6789
7142
|
var get_shelve_options = function get_shelve_options() {
|
|
@@ -6817,7 +7170,7 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6817
7170
|
reservoirId,
|
|
6818
7171
|
warehouseId
|
|
6819
7172
|
]), 2), state = _useAsyncFn6[0], fetch = _useAsyncFn6[1];
|
|
6820
|
-
|
|
7173
|
+
useEffect25(function() {
|
|
6821
7174
|
var _state_value;
|
|
6822
7175
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6823
7176
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6870,16 +7223,16 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6870
7223
|
onChange: handleOnChange,
|
|
6871
7224
|
loading: state.loading
|
|
6872
7225
|
};
|
|
6873
|
-
return /* @__PURE__ */
|
|
7226
|
+
return /* @__PURE__ */ jsx47(Select11, _object_spread({
|
|
6874
7227
|
className: className
|
|
6875
7228
|
}, selectBrandProps));
|
|
6876
7229
|
});
|
|
6877
7230
|
// src/EffectWarehouseSelect/index.tsx
|
|
6878
|
-
import { Select as
|
|
6879
|
-
import
|
|
7231
|
+
import { Select as Select12 } from "antd";
|
|
7232
|
+
import classnames14 from "classnames";
|
|
6880
7233
|
import { memo as memo37 } from "react";
|
|
6881
7234
|
// src/EffectWarehouseSelect/useStoreOptions.ts
|
|
6882
|
-
import
|
|
7235
|
+
import useSWRImmutable8 from "swr/immutable";
|
|
6883
7236
|
var transformStoreData = function transformStoreData() {
|
|
6884
7237
|
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
6885
7238
|
return list.map(function(item) {
|
|
@@ -6892,7 +7245,7 @@ var transformStoreData = function transformStoreData() {
|
|
|
6892
7245
|
function useStoreOptions() {
|
|
6893
7246
|
var currentMerchantOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, warehouseType = arguments.length > 1 ? arguments[1] : void 0;
|
|
6894
7247
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6895
|
-
var
|
|
7248
|
+
var _useSWRImmutable8 = useSWRImmutable8([
|
|
6896
7249
|
"warehouse/store/combo-box",
|
|
6897
7250
|
currentMerchantOnly,
|
|
6898
7251
|
warehouseType
|
|
@@ -6927,7 +7280,7 @@ function useStoreOptions() {
|
|
|
6927
7280
|
retryCount: 3,
|
|
6928
7281
|
dedupingInterval: 5e3,
|
|
6929
7282
|
fallback: []
|
|
6930
|
-
}), data =
|
|
7283
|
+
}), data = _useSWRImmutable8.data, error = _useSWRImmutable8.error, isLoading = _useSWRImmutable8.isLoading, mutate = _useSWRImmutable8.mutate;
|
|
6931
7284
|
return {
|
|
6932
7285
|
data: data,
|
|
6933
7286
|
error: error,
|
|
@@ -6936,11 +7289,11 @@ function useStoreOptions() {
|
|
|
6936
7289
|
};
|
|
6937
7290
|
}
|
|
6938
7291
|
// src/EffectWarehouseSelect/index.module.less
|
|
6939
|
-
var
|
|
7292
|
+
var index_module_default20 = {
|
|
6940
7293
|
select: "index_module_select5"
|
|
6941
7294
|
};
|
|
6942
7295
|
// src/EffectWarehouseSelect/index.tsx
|
|
6943
|
-
import { jsx as
|
|
7296
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
6944
7297
|
var EffectWarehouseSelect = memo37(function(props) {
|
|
6945
7298
|
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;
|
|
6946
7299
|
var state = useStoreOptions(currentMerchantOnly, warehouseType);
|
|
@@ -6951,8 +7304,8 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6951
7304
|
var handleClear = function handleClear() {
|
|
6952
7305
|
onChange === null || onChange === void 0 ? void 0 : onChange(void 0, void 0);
|
|
6953
7306
|
};
|
|
6954
|
-
return /* @__PURE__ */
|
|
6955
|
-
className:
|
|
7307
|
+
return /* @__PURE__ */ jsx48(Select12, {
|
|
7308
|
+
className: classnames14(index_module_default20.select, className),
|
|
6956
7309
|
placeholder: "\u8BF7\u9009\u62E9\u4ED3\u5E93",
|
|
6957
7310
|
notFoundContent: state.isLoading ? "\u52A0\u8F7D\u4E2D..." : "\u6682\u65E0\u4ED3\u5E93\u6570\u636E",
|
|
6958
7311
|
loading: state.isLoading,
|
|
@@ -6964,22 +7317,22 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6964
7317
|
});
|
|
6965
7318
|
});
|
|
6966
7319
|
// src/EffectAddressCascade/index.tsx
|
|
6967
|
-
import { memo as memo38, useEffect as
|
|
7320
|
+
import { memo as memo38, useEffect as useEffect26, useState as useState31 } from "react";
|
|
6968
7321
|
import { useAsyncFn as useAsyncFn7, useMount as useMount8 } from "react-use";
|
|
6969
|
-
import
|
|
7322
|
+
import classnames15 from "classnames";
|
|
6970
7323
|
// src/EffectAddressCascade/index.module.less
|
|
6971
|
-
var
|
|
7324
|
+
var index_module_default21 = {
|
|
6972
7325
|
input: "index_module_input7",
|
|
6973
7326
|
select: "index_module_select6"
|
|
6974
7327
|
};
|
|
6975
7328
|
// src/EffectAddressCascade/index.tsx
|
|
6976
7329
|
import { Cascader as Cascader2 } from "antd";
|
|
6977
|
-
import { jsx as
|
|
7330
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6978
7331
|
var EffectAddressCascade = memo38(function(props) {
|
|
6979
7332
|
var _selectedList_;
|
|
6980
7333
|
var className = props.className, disabled = props.disabled, defaultValue = props.defaultValue, onChange = props.onChange;
|
|
6981
|
-
var
|
|
6982
|
-
var
|
|
7334
|
+
var _useState31 = _sliced_to_array(useState31(), 2), selectedList = _useState31[0], setSelectedList = _useState31[1];
|
|
7335
|
+
var _useState311 = _sliced_to_array(useState31(), 2), customTree = _useState311[0], setCustomTree = _useState311[1];
|
|
6983
7336
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6984
7337
|
var params = {
|
|
6985
7338
|
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) || ""
|
|
@@ -7005,7 +7358,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7005
7358
|
var _useAsyncFn7 = _sliced_to_array(useAsyncFn7(getAddress, [
|
|
7006
7359
|
selectedList
|
|
7007
7360
|
]), 2), state = _useAsyncFn7[0], getAddressFetch = _useAsyncFn7[1];
|
|
7008
|
-
|
|
7361
|
+
useEffect26(function() {
|
|
7009
7362
|
var _state_value;
|
|
7010
7363
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7011
7364
|
var list = state.value.data.list;
|
|
@@ -7043,7 +7396,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7043
7396
|
}, [
|
|
7044
7397
|
state
|
|
7045
7398
|
]);
|
|
7046
|
-
|
|
7399
|
+
useEffect26(function() {
|
|
7047
7400
|
if (!state.loading || !customTree || !selectedList) return;
|
|
7048
7401
|
var target = findTargetLeaf(selectedList, customTree);
|
|
7049
7402
|
if (!target) return;
|
|
@@ -7055,7 +7408,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7055
7408
|
useMount8(function() {
|
|
7056
7409
|
void getAddressFetch();
|
|
7057
7410
|
});
|
|
7058
|
-
|
|
7411
|
+
useEffect26(function() {
|
|
7059
7412
|
var target = findTargetLeaf(selectedList || [], customTree || []);
|
|
7060
7413
|
if ((target === null || target === void 0 ? void 0 : target.isLeaf) || !(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length)) return;
|
|
7061
7414
|
void getAddressFetch();
|
|
@@ -7071,8 +7424,8 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7071
7424
|
setSelectedList(_selectedList);
|
|
7072
7425
|
if (onChange) onChange(_selectedList);
|
|
7073
7426
|
};
|
|
7074
|
-
return /* @__PURE__ */
|
|
7075
|
-
className:
|
|
7427
|
+
return /* @__PURE__ */ jsx49(Cascader2, {
|
|
7428
|
+
className: classnames15(index_module_default21.input, className),
|
|
7076
7429
|
disabled: disabled,
|
|
7077
7430
|
defaultValue: defaultValue,
|
|
7078
7431
|
multiple: false,
|
|
@@ -7105,233 +7458,4 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7105
7458
|
};
|
|
7106
7459
|
});
|
|
7107
7460
|
};
|
|
7108
|
-
|
|
7109
|
-
import { memo as memo39, useEffect as useEffect26, useState as useState31 } from "react";
|
|
7110
|
-
import { useUpdateEffect as useUpdateEffect18 } from "react-use";
|
|
7111
|
-
import classnames15 from "classnames";
|
|
7112
|
-
// src/EffectLabelSelect/hooks.ts
|
|
7113
|
-
import { useAsyncFn as useAsyncFn8, useDebounce } from "react-use";
|
|
7114
|
-
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7115
|
-
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7116
|
-
var reqDataFn = function reqDataFn() {
|
|
7117
|
-
return _async_to_generator(function() {
|
|
7118
|
-
return _ts_generator(this, function(_state) {
|
|
7119
|
-
switch(_state.label){
|
|
7120
|
-
case 0:
|
|
7121
|
-
return [
|
|
7122
|
-
4,
|
|
7123
|
-
fn === null || fn === void 0 ? void 0 : fn(reqParams, reqConfig)
|
|
7124
|
-
];
|
|
7125
|
-
case 1:
|
|
7126
|
-
return [
|
|
7127
|
-
2,
|
|
7128
|
-
_state.sent()
|
|
7129
|
-
];
|
|
7130
|
-
}
|
|
7131
|
-
});
|
|
7132
|
-
})();
|
|
7133
|
-
};
|
|
7134
|
-
var _useAsyncFn8 = _sliced_to_array(useAsyncFn8(reqDataFn, [
|
|
7135
|
-
dependency
|
|
7136
|
-
]), 2), resState = _useAsyncFn8[0], fetchData = _useAsyncFn8[1];
|
|
7137
|
-
useDebounce(function() {
|
|
7138
|
-
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7139
|
-
if (shouldFetchData) {
|
|
7140
|
-
void fetchData();
|
|
7141
|
-
}
|
|
7142
|
-
}, 600, [
|
|
7143
|
-
dependency
|
|
7144
|
-
]);
|
|
7145
|
-
return [
|
|
7146
|
-
resState,
|
|
7147
|
-
fetchData
|
|
7148
|
-
];
|
|
7149
|
-
};
|
|
7150
|
-
// src/EffectLabelSelect/index.module.less
|
|
7151
|
-
var index_module_default21 = {
|
|
7152
|
-
select_wrap: "index_module_select_wrap",
|
|
7153
|
-
select_label: "index_module_select_label",
|
|
7154
|
-
value_select: "index_module_value_select",
|
|
7155
|
-
select: "index_module_select7"
|
|
7156
|
-
};
|
|
7157
|
-
// src/EffectLabelSelect/index.tsx
|
|
7158
|
-
import { Select as Select12, Space as Space5 } from "antd";
|
|
7159
|
-
import { jsx as jsx49, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7160
|
-
var EffectLabelSelect = memo39(function(props) {
|
|
7161
|
-
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;
|
|
7162
|
-
var apiService = useRequestConfig().apiService;
|
|
7163
|
-
var _useState31 = _sliced_to_array(useState31(function() {
|
|
7164
|
-
var _transformObj2Options_, _transformObj2Options;
|
|
7165
|
-
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7166
|
-
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;
|
|
7167
|
-
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7168
|
-
}), 2), curSelectLabel = _useState31[0], setCurSelectLabel = _useState31[1];
|
|
7169
|
-
var _useState311 = _sliced_to_array(useState31(value !== null && value !== void 0 ? value : void 0), 2), curSelectValue = _useState311[0], setCurSelectValue = _useState311[1];
|
|
7170
|
-
var _useState312 = _sliced_to_array(useState31(), 2), curSelectItem = _useState312[0], setCurSelectItem = _useState312[1];
|
|
7171
|
-
var _useState313 = _sliced_to_array(useState31(), 2), curSearchValue = _useState313[0], setCurSearchValue = _useState313[1];
|
|
7172
|
-
var _useState314 = _sliced_to_array(useState31([]), 2), optionsData = _useState314[0], setOptionsData = _useState314[1];
|
|
7173
|
-
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7174
|
-
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7175
|
-
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7176
|
-
page: 1,
|
|
7177
|
-
pageSize: 20
|
|
7178
|
-
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7179
|
-
useEffect26(function() {
|
|
7180
|
-
var _resState_value;
|
|
7181
|
-
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7182
|
-
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7183
|
-
setOptionsData(optionsData2);
|
|
7184
|
-
}, [
|
|
7185
|
-
resState
|
|
7186
|
-
]);
|
|
7187
|
-
useUpdateEffect18(function() {
|
|
7188
|
-
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
7189
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(changedValue, curSelectItem);
|
|
7190
|
-
}, [
|
|
7191
|
-
curSelectValue
|
|
7192
|
-
]);
|
|
7193
|
-
var handleLabelChange = function handleLabelChange(param) {
|
|
7194
|
-
setCurSelectLabel(param);
|
|
7195
|
-
setCurSelectValue(void 0);
|
|
7196
|
-
handleValueClear();
|
|
7197
|
-
};
|
|
7198
|
-
var handleValueChange = function handleValueChange(valueParam, _option) {
|
|
7199
|
-
var option = _option;
|
|
7200
|
-
if (customLabelInValue) {
|
|
7201
|
-
setCurSelectValue(getStrValue("label", option === null || option === void 0 ? void 0 : option.value, option === null || option === void 0 ? void 0 : option.label, curSelectLabel));
|
|
7202
|
-
} else {
|
|
7203
|
-
setCurSelectValue(valueParam);
|
|
7204
|
-
}
|
|
7205
|
-
setCurSelectItem(option);
|
|
7206
|
-
};
|
|
7207
|
-
var handleValueSearch = function handleValueSearch(param) {
|
|
7208
|
-
setCurSearchValue(param);
|
|
7209
|
-
};
|
|
7210
|
-
var handleValueClear = function handleValueClear() {
|
|
7211
|
-
setCurSearchValue(void 0);
|
|
7212
|
-
setCurSelectValue(void 0);
|
|
7213
|
-
setOptionsData([]);
|
|
7214
|
-
};
|
|
7215
|
-
var selectLabelProps = {
|
|
7216
|
-
className: index_module_default21.select_label,
|
|
7217
|
-
disabled: disabled,
|
|
7218
|
-
defaultValue: curSelectLabel,
|
|
7219
|
-
options: transformObj2Options(labelDic),
|
|
7220
|
-
onChange: handleLabelChange,
|
|
7221
|
-
popupMatchSelectWidth: false
|
|
7222
|
-
};
|
|
7223
|
-
var labelText = labelDic[curSelectLabel] || "";
|
|
7224
|
-
var notFoundContent = resState.loading ? "\u641C\u7D22\u4E2D" : curSearchValue ? "输入的".concat(labelText, "未查询到信息") : "请输入".concat(labelText);
|
|
7225
|
-
var mergedValue = customLabelInValue ? getSelectValue(curSelectValue, optionsDisplayType) : curSelectValue;
|
|
7226
|
-
var mergedOptionsData = optionsDisplayType === "labelAndValue" ? optionsData.map(function(item) {
|
|
7227
|
-
return _object_spread_props(_object_spread({}, item), {
|
|
7228
|
-
label: getInitialValue(item.label, item.value)
|
|
7229
|
-
});
|
|
7230
|
-
}) : optionsData;
|
|
7231
|
-
var selectValueProps = {
|
|
7232
|
-
className: classnames15(index_module_default21.value_select, className),
|
|
7233
|
-
notFoundContent: notFoundContent,
|
|
7234
|
-
value: mergedValue,
|
|
7235
|
-
options: mergedOptionsData,
|
|
7236
|
-
disabled: disabled,
|
|
7237
|
-
loading: resState.loading,
|
|
7238
|
-
placeholder: "请输入".concat(labelText),
|
|
7239
|
-
onChange: handleValueChange,
|
|
7240
|
-
onSearch: handleValueSearch,
|
|
7241
|
-
onClear: handleValueClear,
|
|
7242
|
-
optionFilterProp: "label",
|
|
7243
|
-
showSearch: true,
|
|
7244
|
-
allowClear: true,
|
|
7245
|
-
defaultActiveFirstOption: false,
|
|
7246
|
-
filterOption: false,
|
|
7247
|
-
popupMatchSelectWidth: false
|
|
7248
|
-
};
|
|
7249
|
-
return /* @__PURE__ */ jsxs21(Space5.Compact, {
|
|
7250
|
-
className: index_module_default21.select_wrap,
|
|
7251
|
-
style: style,
|
|
7252
|
-
children: [
|
|
7253
|
-
/* @__PURE__ */ jsx49(Select12, _object_spread({}, selectLabelProps)),
|
|
7254
|
-
/* @__PURE__ */ jsx49(Select12, _object_spread({}, selectValueProps))
|
|
7255
|
-
]
|
|
7256
|
-
});
|
|
7257
|
-
});
|
|
7258
|
-
var defaultLabelDic = {
|
|
7259
|
-
businessNo: "\u5546\u6237\u53F7",
|
|
7260
|
-
name: "\u5546\u6237\u540D"
|
|
7261
|
-
};
|
|
7262
|
-
var defaultTransformDataFn = function defaultTransformDataFn(_0) {
|
|
7263
|
-
var name = _0.name, enterpriseNo = _0.enterpriseNo, otherParams = _object_without_properties(_0, [
|
|
7264
|
-
"name",
|
|
7265
|
-
"enterpriseNo"
|
|
7266
|
-
]);
|
|
7267
|
-
return {
|
|
7268
|
-
label: name,
|
|
7269
|
-
value: enterpriseNo,
|
|
7270
|
-
customFields: otherParams
|
|
7271
|
-
};
|
|
7272
|
-
};
|
|
7273
|
-
var transformObj2Options = function transformObj2Options(obj) {
|
|
7274
|
-
var options = [];
|
|
7275
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7276
|
-
try {
|
|
7277
|
-
for(var _iterator = Object.entries(obj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7278
|
-
var _step_value = _sliced_to_array(_step.value, 2), value = _step_value[0], key = _step_value[1];
|
|
7279
|
-
options.push({
|
|
7280
|
-
value: value,
|
|
7281
|
-
label: key
|
|
7282
|
-
});
|
|
7283
|
-
}
|
|
7284
|
-
} catch (err) {
|
|
7285
|
-
_didIteratorError = true;
|
|
7286
|
-
_iteratorError = err;
|
|
7287
|
-
} finally{
|
|
7288
|
-
try {
|
|
7289
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7290
|
-
_iterator.return();
|
|
7291
|
-
}
|
|
7292
|
-
} finally{
|
|
7293
|
-
if (_didIteratorError) {
|
|
7294
|
-
throw _iteratorError;
|
|
7295
|
-
}
|
|
7296
|
-
}
|
|
7297
|
-
}
|
|
7298
|
-
return options;
|
|
7299
|
-
};
|
|
7300
|
-
var getStrValue = function getStrValue(displayType) {
|
|
7301
|
-
var value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", label = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", labelDicKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
7302
|
-
if (!value) {
|
|
7303
|
-
return void 0;
|
|
7304
|
-
}
|
|
7305
|
-
return "".concat(displayType, ";").concat(value, ";").concat(label, ";").concat(labelDicKey);
|
|
7306
|
-
};
|
|
7307
|
-
var getSelectValue = function getSelectValue(str, returnType) {
|
|
7308
|
-
if (str === "null" || typeof str === "undefined") {
|
|
7309
|
-
return void 0;
|
|
7310
|
-
}
|
|
7311
|
-
var _String_split = _sliced_to_array(String(str).split(";"), 4), displayType = _String_split[0], value = _String_split[1], label = _String_split[2], labelDicKey = _String_split[3];
|
|
7312
|
-
if (returnType === "labelAndValue") {
|
|
7313
|
-
return (label === null || label === void 0 ? void 0 : label.includes("-")) ? label : getInitialValue(label, value);
|
|
7314
|
-
} else if (returnType === "labelDicKey") {
|
|
7315
|
-
return labelDicKey;
|
|
7316
|
-
} else if (returnType === "value" || displayType === "value") {
|
|
7317
|
-
return value;
|
|
7318
|
-
} else if (returnType === "label" || displayType === "label") {
|
|
7319
|
-
return label;
|
|
7320
|
-
}
|
|
7321
|
-
return void 0;
|
|
7322
|
-
};
|
|
7323
|
-
var getInitialValue = function getInitialValue() {
|
|
7324
|
-
var label = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
7325
|
-
return label && value ? "".concat(value, " - ").concat(label) : value;
|
|
7326
|
-
};
|
|
7327
|
-
var getFirstValue = function getFirstValue() {
|
|
7328
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7329
|
-
var _str_split_, _str_split;
|
|
7330
|
-
return str === null || str === void 0 ? void 0 : (_str_split = str.split("-")) === null || _str_split === void 0 ? void 0 : (_str_split_ = _str_split[0]) === null || _str_split_ === void 0 ? void 0 : _str_split_.trim();
|
|
7331
|
-
};
|
|
7332
|
-
var getSecondValue = function getSecondValue() {
|
|
7333
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7334
|
-
var _this;
|
|
7335
|
-
return (_this = (str === null || str === void 0 ? void 0 : str.includes("-")) ? str.split("-")[1] : str) === null || _this === void 0 ? void 0 : _this.trim();
|
|
7336
|
-
};
|
|
7337
|
-
export { CInput, CTable, CVideo, Clock, ConfigContext, ConfigProvider, Countdown, Counter, Currency, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, EffectCategoryCascade, EffectFileUpload, EffectLabelSelect, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, EffectSkuSelect, EffectSkuTable, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, Iconfont, ImageItem, Loading, MultiWindow, MultiWindowContents, OSSImage, PrivacyField, QRCode, QRCodeStatus, RichTextEditor, ScopeLevelEnum, SearchForm, SearchFormContent, SearchList, SelectDropdown, WithCVideoModal, WithModal, WithPanel, commonDatePickerGetValueProps, commonDatePickerNormalize, commonDateRangePickerGetValueProps, commonDateRangePickerNormalize, commonStatusSelectOptions, commonYesOrNoSelectOptions, commonYesOrNoSelectOptionsMap, formatClock, formatDate, getCTable, getCommonSelectProps, getCommonTableProps, getFirstValue, getInitialValue, getNumberValue, getSecondValue, getSelectValue, getStrValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|
|
7461
|
+
export { CInput, CTable, CVideo, Clock, ConfigContext, ConfigProvider, Countdown, Counter, Currency, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, EffectCategoryCascade, EffectFileUpload, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, EffectSkuSelect, EffectSkuTable, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, Iconfont, ImageItem, Loading, MultiWindow, MultiWindowContents, OSSImage, PrivacyField, QRCode, QRCodeStatus, RichTextEditor, ScopeLevelEnum, SearchForm, SearchFormContent, SearchList, SelectDropdown, WithCVideoModal, WithModal, WithPanel, commonDatePickerGetValueProps, commonDatePickerNormalize, commonDateRangePickerGetValueProps, commonDateRangePickerNormalize, commonStatusSelectOptions, commonYesOrNoSelectOptions, commonYesOrNoSelectOptionsMap, defaultMerchantSearchSources, formatClock, formatDate, getCTable, getCommonSelectProps, getCommonTableProps, getNumberValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|