@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.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, 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, source = _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,12 @@ 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: [
|
|
6125
|
+
item.enterpriseNo,
|
|
6126
|
+
item.platformName,
|
|
6127
|
+
item.name
|
|
6128
|
+
].filter(Boolean).join(" - "),
|
|
6122
6129
|
value: item.enterpriseNo,
|
|
6123
6130
|
originalName: item.platformName,
|
|
6124
6131
|
data: item
|
|
@@ -6153,8 +6160,27 @@ var index_module_default17 = {
|
|
|
6153
6160
|
// src/EffectMerchantSelect/index.tsx
|
|
6154
6161
|
import { Select as Select7, Typography as Typography5 } from "antd";
|
|
6155
6162
|
import { jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6163
|
+
var defaultMerchantSearchSources = [
|
|
6164
|
+
{
|
|
6165
|
+
label: "\u5546\u6237\u53F7",
|
|
6166
|
+
value: "enterpriseNo"
|
|
6167
|
+
},
|
|
6168
|
+
{
|
|
6169
|
+
label: "\u5E73\u53F0\u540D",
|
|
6170
|
+
value: "platformName"
|
|
6171
|
+
},
|
|
6172
|
+
{
|
|
6173
|
+
label: "\u5546\u6237\u540D",
|
|
6174
|
+
value: "name"
|
|
6175
|
+
},
|
|
6176
|
+
{
|
|
6177
|
+
label: "\u6CE8\u518C\u624B\u673A\u53F7",
|
|
6178
|
+
value: "phone"
|
|
6179
|
+
}
|
|
6180
|
+
];
|
|
6156
6181
|
var EffectMerchantSelect = memo31(function(props) {
|
|
6157
|
-
var
|
|
6182
|
+
var _ref;
|
|
6183
|
+
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
6184
|
var _useState25 = _sliced_to_array(useState25(), 2), searchValue = _useState25[0], setSearchValue = _useState25[1];
|
|
6159
6185
|
var _useState251 = _sliced_to_array(useState25(controlValue), 2), value = _useState251[0], setValue = _useState251[1];
|
|
6160
6186
|
var _useState252 = _sliced_to_array(useState25(), 2), name = _useState252[0], setName = _useState252[1];
|
|
@@ -6171,12 +6197,11 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6171
6197
|
useEffect21(function() {
|
|
6172
6198
|
if (controlValue !== value) setValue(controlValue);
|
|
6173
6199
|
if (controlValue) setParams({
|
|
6174
|
-
|
|
6175
|
-
|
|
6200
|
+
enterpriseNo: controlValue,
|
|
6201
|
+
source: sourceControl
|
|
6176
6202
|
});
|
|
6177
6203
|
}, [
|
|
6178
|
-
controlValue
|
|
6179
|
-
labelDisplayMode
|
|
6204
|
+
controlValue
|
|
6180
6205
|
]);
|
|
6181
6206
|
useUpdateEffect13(function() {
|
|
6182
6207
|
var changeValue = (value !== null && value !== void 0 ? value : "") === "" ? void 0 : String(value);
|
|
@@ -6190,24 +6215,23 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6190
6215
|
setName(option === null || option === void 0 ? void 0 : option.originalName);
|
|
6191
6216
|
};
|
|
6192
6217
|
var handleOnSearch = function handleOnSearch(searchValue2) {
|
|
6218
|
+
setSearchValue(searchValue2);
|
|
6193
6219
|
var _obj;
|
|
6194
|
-
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "
|
|
6220
|
+
if (searchValue2) setParams((_obj = {}, _define_property(_obj, sourceControl, searchValue2), _define_property(_obj, "source", sourceControl), _obj));
|
|
6195
6221
|
};
|
|
6196
6222
|
var handleOnSearchDebounce = useCallback22(debounce6(800, handleOnSearch), [
|
|
6197
|
-
sourceControl
|
|
6198
|
-
labelDisplayMode
|
|
6223
|
+
sourceControl
|
|
6199
6224
|
]);
|
|
6200
6225
|
var handleOnClear = function handleOnClear() {
|
|
6201
6226
|
setSearchValue(void 0);
|
|
6202
6227
|
setOptions([]);
|
|
6203
6228
|
};
|
|
6204
|
-
var
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
var
|
|
6210
|
-
var handleAddonChange = function handleAddonChange(value2, _option) {
|
|
6229
|
+
var currentSource = defaultMerchantSearchSources.find(function(s) {
|
|
6230
|
+
return s.value === sourceControl;
|
|
6231
|
+
});
|
|
6232
|
+
var currentSourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6233
|
+
var notFoundContent = state.isLoading ? "\u641C\u7D22\u4E2D" : searchValue ? "输入的".concat(currentSourceLabel, "未查询到商户信息") : "请输入".concat(currentSourceLabel);
|
|
6234
|
+
var handleAddonChange = function handleAddonChange(value2) {
|
|
6211
6235
|
setSourceControl(value2);
|
|
6212
6236
|
setValue(void 0);
|
|
6213
6237
|
setSearchValue(void 0);
|
|
@@ -6225,13 +6249,7 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6225
6249
|
popupMatchSelectWidth: false,
|
|
6226
6250
|
disabled: disabled,
|
|
6227
6251
|
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
|
-
}),
|
|
6252
|
+
options: defaultMerchantSearchSources,
|
|
6235
6253
|
onChange: handleAddonChange,
|
|
6236
6254
|
style: {
|
|
6237
6255
|
width: 140
|
|
@@ -6239,12 +6257,13 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6239
6257
|
};
|
|
6240
6258
|
var selectBrandProps = {
|
|
6241
6259
|
notFoundContent: notFoundContent,
|
|
6242
|
-
placeholder: "请输入".concat(
|
|
6260
|
+
placeholder: "请输入".concat(currentSourceLabel),
|
|
6243
6261
|
optionFilterProp: "label",
|
|
6244
6262
|
showSearch: true,
|
|
6245
6263
|
allowClear: true,
|
|
6246
6264
|
defaultActiveFirstOption: false,
|
|
6247
6265
|
filterOption: false,
|
|
6266
|
+
popupMatchSelectWidth: false,
|
|
6248
6267
|
value: value,
|
|
6249
6268
|
options: options,
|
|
6250
6269
|
disabled: disabled,
|
|
@@ -6263,14 +6282,338 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6263
6282
|
]
|
|
6264
6283
|
});
|
|
6265
6284
|
});
|
|
6285
|
+
// src/EffectSearchSelect/index.tsx
|
|
6286
|
+
import React37, { useCallback as useCallback23, useEffect as useEffect22, useMemo as useMemo18, useRef as useRef13, useState as useState26 } from "react";
|
|
6287
|
+
import { useDebounce } from "react-use";
|
|
6288
|
+
import classnames12 from "classnames";
|
|
6289
|
+
import { Select as Select8, Space as Space3 } from "antd";
|
|
6290
|
+
// src/EffectSearchSelect/index.module.less
|
|
6291
|
+
var index_module_default18 = {
|
|
6292
|
+
search_select_wrap: "index_module_search_select_wrap",
|
|
6293
|
+
source_select: "index_module_source_select",
|
|
6294
|
+
value_select: "index_module_value_select"
|
|
6295
|
+
};
|
|
6296
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6297
|
+
import useSWRImmutable7 from "swr/immutable";
|
|
6298
|
+
// src/EffectSearchSelect/utils.ts
|
|
6299
|
+
var DEFAULT_SEARCH_PAGE_SIZE = 20;
|
|
6300
|
+
var DEFAULT_SEARCH_MIN_LENGTH = 1;
|
|
6301
|
+
var DEFAULT_MERCHANT_SEARCH_CACHE_KEY = "merchant/list";
|
|
6302
|
+
var DEFAULT_MERCHANT_SOURCE_VALUE = "enterpriseNo";
|
|
6303
|
+
var defaultMerchantSearchSources2 = [
|
|
6304
|
+
{
|
|
6305
|
+
label: "\u5546\u6237\u53F7",
|
|
6306
|
+
value: "enterpriseNo"
|
|
6307
|
+
},
|
|
6308
|
+
{
|
|
6309
|
+
label: "\u5E73\u53F0\u540D",
|
|
6310
|
+
value: "platformName"
|
|
6311
|
+
},
|
|
6312
|
+
{
|
|
6313
|
+
label: "\u5546\u6237\u540D",
|
|
6314
|
+
value: "name"
|
|
6315
|
+
},
|
|
6316
|
+
{
|
|
6317
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6318
|
+
value: "phone"
|
|
6319
|
+
}
|
|
6320
|
+
];
|
|
6321
|
+
var defaultTransformMerchantOptions = function defaultTransformMerchantOptions(data, context) {
|
|
6322
|
+
return (data.list || []).map(function(item) {
|
|
6323
|
+
return {
|
|
6324
|
+
label: getMerchantSourceLabel(item, context.source.value),
|
|
6325
|
+
value: item.enterpriseNo,
|
|
6326
|
+
raw: item
|
|
6327
|
+
};
|
|
6328
|
+
});
|
|
6329
|
+
};
|
|
6330
|
+
var getMerchantSourceLabel = function getMerchantSourceLabel(item, sourceValue) {
|
|
6331
|
+
var sourceLabelMap = {
|
|
6332
|
+
enterpriseNo: item.enterpriseNo,
|
|
6333
|
+
platformName: item.platformName,
|
|
6334
|
+
name: item.name,
|
|
6335
|
+
// 目前接口没有手机号,先放空字符串,后续如果接口增加了手机号字段再修改这里
|
|
6336
|
+
phone: ""
|
|
6337
|
+
};
|
|
6338
|
+
return sourceLabelMap[sourceValue] || [
|
|
6339
|
+
item.enterpriseNo,
|
|
6340
|
+
item.platformName,
|
|
6341
|
+
item.name
|
|
6342
|
+
].filter(Boolean).join(" - ");
|
|
6343
|
+
};
|
|
6344
|
+
var getDefaultSourceValue = function getDefaultSourceValue(sources, defaultSourceValue) {
|
|
6345
|
+
var _sources_;
|
|
6346
|
+
if (defaultSourceValue && sources.some(function(source) {
|
|
6347
|
+
return source.value === defaultSourceValue;
|
|
6348
|
+
})) {
|
|
6349
|
+
return defaultSourceValue;
|
|
6350
|
+
}
|
|
6351
|
+
return (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value;
|
|
6352
|
+
};
|
|
6353
|
+
var getCurrentSource = function getCurrentSource(sources, selectedSourceValue) {
|
|
6354
|
+
return sources.find(function(source) {
|
|
6355
|
+
return source.value === selectedSourceValue;
|
|
6356
|
+
}) || sources[0];
|
|
6357
|
+
};
|
|
6358
|
+
var buildDefaultSearchParams = function buildDefaultSearchParams(keyword, source, baseParams, pageSize) {
|
|
6359
|
+
return _object_spread_props(_object_spread({
|
|
6360
|
+
page: 1,
|
|
6361
|
+
pageSize: pageSize
|
|
6362
|
+
}, baseParams), _define_property({}, source.value, keyword));
|
|
6363
|
+
};
|
|
6364
|
+
var normalizeSelectValue = function normalizeSelectValue(value) {
|
|
6365
|
+
return value === null ? void 0 : value;
|
|
6366
|
+
};
|
|
6367
|
+
var normalizeSelectedOption = function normalizeSelectedOption(option) {
|
|
6368
|
+
var selectedOption = Array.isArray(option) ? option[0] : option;
|
|
6369
|
+
return selectedOption ? selectedOption : void 0;
|
|
6370
|
+
};
|
|
6371
|
+
var resolveMergedDefaultSourceValue = function resolveMergedDefaultSourceValue(sources, defaultSourceValue, hasCustomSources) {
|
|
6372
|
+
var _sources_;
|
|
6373
|
+
if (defaultSourceValue) return defaultSourceValue;
|
|
6374
|
+
return hasCustomSources ? (_sources_ = sources[0]) === null || _sources_ === void 0 ? void 0 : _sources_.value : DEFAULT_MERCHANT_SOURCE_VALUE;
|
|
6375
|
+
};
|
|
6376
|
+
var resolveNotFoundContent = function resolveNotFoundContent(params) {
|
|
6377
|
+
var error = params.error, isLoading = params.isLoading, keyword = params.keyword, sourceLabel = params.sourceLabel, defaultPlaceholder = params.defaultPlaceholder;
|
|
6378
|
+
if (error) return error.message || "\u67E5\u8BE2\u5931\u8D25";
|
|
6379
|
+
if (isLoading) return "\u641C\u7D22\u4E2D";
|
|
6380
|
+
if (keyword) return "输入的".concat(sourceLabel, "未查询到信息");
|
|
6381
|
+
return defaultPlaceholder;
|
|
6382
|
+
};
|
|
6383
|
+
// src/EffectSearchSelect/useEffectSearchOptions.ts
|
|
6384
|
+
function useEffectSearchOptions(params) {
|
|
6385
|
+
var config = useRequestConfig().config;
|
|
6386
|
+
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;
|
|
6387
|
+
var swrKey = enabled && source ? [
|
|
6388
|
+
"EffectSearchSelect",
|
|
6389
|
+
cacheKey,
|
|
6390
|
+
source.value,
|
|
6391
|
+
keyword,
|
|
6392
|
+
fetchParams,
|
|
6393
|
+
pageSize
|
|
6394
|
+
] : null;
|
|
6395
|
+
var _useSWRImmutable7 = useSWRImmutable7(swrKey, function() {
|
|
6396
|
+
return _async_to_generator(function() {
|
|
6397
|
+
var requestParams, response;
|
|
6398
|
+
return _ts_generator(this, function(_state) {
|
|
6399
|
+
switch(_state.label){
|
|
6400
|
+
case 0:
|
|
6401
|
+
if (!source) return [
|
|
6402
|
+
2,
|
|
6403
|
+
[]
|
|
6404
|
+
];
|
|
6405
|
+
requestParams = buildParams ? buildParams(keyword, source, fetchParams) : buildDefaultSearchParams(keyword, source, fetchParams, pageSize);
|
|
6406
|
+
return [
|
|
6407
|
+
4,
|
|
6408
|
+
request(requestParams, config)
|
|
6409
|
+
];
|
|
6410
|
+
case 1:
|
|
6411
|
+
response = _state.sent();
|
|
6412
|
+
if ((response === null || response === void 0 ? void 0 : response.code) !== 200) {
|
|
6413
|
+
throw new Error((response === null || response === void 0 ? void 0 : response.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6414
|
+
}
|
|
6415
|
+
return [
|
|
6416
|
+
2,
|
|
6417
|
+
transformOptions(response.data, {
|
|
6418
|
+
source: source,
|
|
6419
|
+
keyword: keyword
|
|
6420
|
+
})
|
|
6421
|
+
];
|
|
6422
|
+
}
|
|
6423
|
+
});
|
|
6424
|
+
})();
|
|
6425
|
+
}, {
|
|
6426
|
+
errorRetryCount: 0,
|
|
6427
|
+
shouldRetryOnError: false
|
|
6428
|
+
}), data = _useSWRImmutable7.data, error = _useSWRImmutable7.error, isLoading = _useSWRImmutable7.isLoading, mutate = _useSWRImmutable7.mutate;
|
|
6429
|
+
return {
|
|
6430
|
+
options: data || [],
|
|
6431
|
+
error: error,
|
|
6432
|
+
isLoading: isLoading,
|
|
6433
|
+
mutate: mutate
|
|
6434
|
+
};
|
|
6435
|
+
}
|
|
6436
|
+
// src/EffectSearchSelect/index.tsx
|
|
6437
|
+
import { jsx as jsx42, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6438
|
+
var EMPTY_FETCH_PARAMS = {};
|
|
6439
|
+
var EffectSearchSelectBase = function EffectSearchSelectBase(props) {
|
|
6440
|
+
var _ref;
|
|
6441
|
+
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, [
|
|
6442
|
+
"className",
|
|
6443
|
+
"style",
|
|
6444
|
+
"value",
|
|
6445
|
+
"defaultValue",
|
|
6446
|
+
"disabled",
|
|
6447
|
+
"placeholder",
|
|
6448
|
+
"notFoundContent",
|
|
6449
|
+
"sources",
|
|
6450
|
+
"defaultSourceValue",
|
|
6451
|
+
"fetchParams",
|
|
6452
|
+
"pageSize",
|
|
6453
|
+
"request",
|
|
6454
|
+
"buildParams",
|
|
6455
|
+
"transformOptions",
|
|
6456
|
+
"onChange",
|
|
6457
|
+
"onClear"
|
|
6458
|
+
]);
|
|
6459
|
+
var apiService = useRequestConfig().apiService;
|
|
6460
|
+
var valueControlledRef = useRef13(Object.prototype.hasOwnProperty.call(props, "value"));
|
|
6461
|
+
var valueControlled = valueControlledRef.current;
|
|
6462
|
+
var hasCustomSources = Boolean(sources === null || sources === void 0 ? void 0 : sources.length);
|
|
6463
|
+
var mergedSources = useMemo18(function() {
|
|
6464
|
+
return hasCustomSources ? sources : defaultMerchantSearchSources2;
|
|
6465
|
+
}, [
|
|
6466
|
+
hasCustomSources,
|
|
6467
|
+
sources
|
|
6468
|
+
]);
|
|
6469
|
+
var mergedDefaultSourceValue = useMemo18(function() {
|
|
6470
|
+
return resolveMergedDefaultSourceValue(mergedSources, defaultSourceValue, hasCustomSources);
|
|
6471
|
+
}, [
|
|
6472
|
+
defaultSourceValue,
|
|
6473
|
+
hasCustomSources,
|
|
6474
|
+
mergedSources
|
|
6475
|
+
]);
|
|
6476
|
+
var _useState26 = _sliced_to_array(useState26(function() {
|
|
6477
|
+
return getDefaultSourceValue(mergedSources, mergedDefaultSourceValue);
|
|
6478
|
+
}), 2), innerSourceValue = _useState26[0], setInnerSourceValue = _useState26[1];
|
|
6479
|
+
var currentSource = getCurrentSource(mergedSources, innerSourceValue);
|
|
6480
|
+
var currentSourceValue = currentSource === null || currentSource === void 0 ? void 0 : currentSource.value;
|
|
6481
|
+
useEffect22(function() {
|
|
6482
|
+
var isCurrentSourceValid = mergedSources.some(function(source) {
|
|
6483
|
+
return source.value === innerSourceValue;
|
|
6484
|
+
});
|
|
6485
|
+
if (!isCurrentSourceValid) {
|
|
6486
|
+
setInnerSourceValue(getDefaultSourceValue(mergedSources, mergedDefaultSourceValue));
|
|
6487
|
+
}
|
|
6488
|
+
}, [
|
|
6489
|
+
innerSourceValue,
|
|
6490
|
+
mergedDefaultSourceValue,
|
|
6491
|
+
mergedSources
|
|
6492
|
+
]);
|
|
6493
|
+
var _useState261 = _sliced_to_array(useState26(function() {
|
|
6494
|
+
return normalizeSelectValue(value !== null && value !== void 0 ? value : defaultValue);
|
|
6495
|
+
}), 2), innerValue = _useState261[0], setInnerValue = _useState261[1];
|
|
6496
|
+
var mergedValue = valueControlled ? normalizeSelectValue(value) : innerValue;
|
|
6497
|
+
var _useState262 = _sliced_to_array(useState26(""), 2), searchText = _useState262[0], setSearchText = _useState262[1];
|
|
6498
|
+
var _useState263 = _sliced_to_array(useState26(""), 2), keyword = _useState263[0], setKeyword = _useState263[1];
|
|
6499
|
+
useDebounce(function() {
|
|
6500
|
+
setKeyword(searchText.trim());
|
|
6501
|
+
}, 600, [
|
|
6502
|
+
searchText
|
|
6503
|
+
]);
|
|
6504
|
+
var requestFn = request || apiService.merchantList;
|
|
6505
|
+
var transformOptionsFn = transformOptions || defaultTransformMerchantOptions;
|
|
6506
|
+
var searchEnabled = Boolean(currentSource && keyword.length >= DEFAULT_SEARCH_MIN_LENGTH);
|
|
6507
|
+
var searchCacheKey = request ? request.name || "custom" : DEFAULT_MERCHANT_SEARCH_CACHE_KEY;
|
|
6508
|
+
var _useEffectSearchOptions = useEffectSearchOptions({
|
|
6509
|
+
cacheKey: searchCacheKey,
|
|
6510
|
+
keyword: keyword,
|
|
6511
|
+
source: currentSource,
|
|
6512
|
+
enabled: searchEnabled,
|
|
6513
|
+
fetchParams: fetchParams,
|
|
6514
|
+
pageSize: pageSize,
|
|
6515
|
+
request: requestFn,
|
|
6516
|
+
buildParams: buildParams,
|
|
6517
|
+
transformOptions: transformOptionsFn
|
|
6518
|
+
}), options = _useEffectSearchOptions.options, isLoading = _useEffectSearchOptions.isLoading, error = _useEffectSearchOptions.error;
|
|
6519
|
+
var resetSearchAndValue = useCallback23(function() {
|
|
6520
|
+
setSearchText("");
|
|
6521
|
+
setKeyword("");
|
|
6522
|
+
if (!valueControlled) {
|
|
6523
|
+
setInnerValue(void 0);
|
|
6524
|
+
}
|
|
6525
|
+
}, [
|
|
6526
|
+
valueControlled
|
|
6527
|
+
]);
|
|
6528
|
+
var handleSourceChange = useCallback23(function(nextSourceValue) {
|
|
6529
|
+
setInnerSourceValue(nextSourceValue);
|
|
6530
|
+
resetSearchAndValue();
|
|
6531
|
+
}, [
|
|
6532
|
+
resetSearchAndValue
|
|
6533
|
+
]);
|
|
6534
|
+
var handleSearch = useCallback23(function(nextSearchText) {
|
|
6535
|
+
setSearchText(nextSearchText);
|
|
6536
|
+
}, []);
|
|
6537
|
+
var handleChange = useCallback23(function(nextValue, option) {
|
|
6538
|
+
var selectedOption = normalizeSelectedOption(option);
|
|
6539
|
+
var normalizedValue = normalizeSelectValue(nextValue);
|
|
6540
|
+
if (!valueControlled) {
|
|
6541
|
+
setInnerValue(normalizedValue);
|
|
6542
|
+
}
|
|
6543
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(normalizedValue, selectedOption);
|
|
6544
|
+
}, [
|
|
6545
|
+
onChange,
|
|
6546
|
+
valueControlled
|
|
6547
|
+
]);
|
|
6548
|
+
var handleClear = useCallback23(function() {
|
|
6549
|
+
resetSearchAndValue();
|
|
6550
|
+
onClear === null || onClear === void 0 ? void 0 : onClear();
|
|
6551
|
+
}, [
|
|
6552
|
+
onClear,
|
|
6553
|
+
resetSearchAndValue
|
|
6554
|
+
]);
|
|
6555
|
+
var sourceOptions = useMemo18(function() {
|
|
6556
|
+
return mergedSources.map(function(param) {
|
|
6557
|
+
var label = param.label, val = param.value;
|
|
6558
|
+
return {
|
|
6559
|
+
label: label,
|
|
6560
|
+
value: val
|
|
6561
|
+
};
|
|
6562
|
+
});
|
|
6563
|
+
}, [
|
|
6564
|
+
mergedSources
|
|
6565
|
+
]);
|
|
6566
|
+
var sourceLabel = (_ref = currentSource === null || currentSource === void 0 ? void 0 : currentSource.label) !== null && _ref !== void 0 ? _ref : "";
|
|
6567
|
+
var defaultPlaceholder = sourceLabel ? "请输入".concat(sourceLabel) : "\u8BF7\u8F93\u5165";
|
|
6568
|
+
var defaultNotFoundContent = resolveNotFoundContent({
|
|
6569
|
+
error: error,
|
|
6570
|
+
isLoading: isLoading,
|
|
6571
|
+
keyword: keyword,
|
|
6572
|
+
sourceLabel: sourceLabel,
|
|
6573
|
+
defaultPlaceholder: defaultPlaceholder
|
|
6574
|
+
});
|
|
6575
|
+
return /* @__PURE__ */ jsxs19(Space3.Compact, {
|
|
6576
|
+
className: index_module_default18.search_select_wrap,
|
|
6577
|
+
style: style,
|
|
6578
|
+
children: [
|
|
6579
|
+
/* @__PURE__ */ jsx42(Select8, {
|
|
6580
|
+
className: index_module_default18.source_select,
|
|
6581
|
+
disabled: disabled,
|
|
6582
|
+
value: currentSourceValue,
|
|
6583
|
+
options: sourceOptions,
|
|
6584
|
+
popupMatchSelectWidth: false,
|
|
6585
|
+
onChange: handleSourceChange
|
|
6586
|
+
}),
|
|
6587
|
+
/* @__PURE__ */ jsx42(Select8, _object_spread_props(_object_spread({}, selectProps), {
|
|
6588
|
+
className: classnames12(index_module_default18.value_select, className),
|
|
6589
|
+
disabled: disabled,
|
|
6590
|
+
value: mergedValue,
|
|
6591
|
+
options: options,
|
|
6592
|
+
loading: isLoading,
|
|
6593
|
+
placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : defaultPlaceholder,
|
|
6594
|
+
notFoundContent: notFoundContent !== null && notFoundContent !== void 0 ? notFoundContent : defaultNotFoundContent,
|
|
6595
|
+
showSearch: true,
|
|
6596
|
+
allowClear: true,
|
|
6597
|
+
defaultActiveFirstOption: false,
|
|
6598
|
+
filterOption: false,
|
|
6599
|
+
popupMatchSelectWidth: false,
|
|
6600
|
+
optionFilterProp: "label",
|
|
6601
|
+
onSearch: handleSearch,
|
|
6602
|
+
onChange: handleChange,
|
|
6603
|
+
onClear: handleClear
|
|
6604
|
+
}))
|
|
6605
|
+
]
|
|
6606
|
+
});
|
|
6607
|
+
};
|
|
6608
|
+
var EffectSearchSelect = React37.memo(EffectSearchSelectBase);
|
|
6266
6609
|
// src/EffectScopeSelect/index.tsx
|
|
6267
|
-
import { memo as memo33, useCallback as
|
|
6268
|
-
import { Flex as Flex3, Space as
|
|
6610
|
+
import { memo as memo33, useCallback as useCallback24, useMemo as useMemo19, useState as useState27 } from "react";
|
|
6611
|
+
import { Flex as Flex3, Space as Space5 } from "antd";
|
|
6269
6612
|
import { useUpdateEffect as useUpdateEffect14 } from "react-use";
|
|
6270
6613
|
// src/EffectScopeSelect/ScopeViewMode.tsx
|
|
6271
6614
|
import { memo as memo32 } from "react";
|
|
6272
|
-
import { Space as
|
|
6273
|
-
import { jsx as
|
|
6615
|
+
import { Space as Space4, Typography as Typography6 } from "antd";
|
|
6616
|
+
import { jsx as jsx43, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6274
6617
|
var ScopeViewMode = memo32(function(props) {
|
|
6275
6618
|
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
6619
|
var items = [];
|
|
@@ -6294,18 +6637,18 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6294
6637
|
label: "SKU",
|
|
6295
6638
|
value: skuName || String(skuId)
|
|
6296
6639
|
});
|
|
6297
|
-
if (items.length === 0) return /* @__PURE__ */
|
|
6640
|
+
if (items.length === 0) return /* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6298
6641
|
style: {
|
|
6299
6642
|
fontSize: 14
|
|
6300
6643
|
},
|
|
6301
6644
|
type: "danger",
|
|
6302
6645
|
children: "\u8BF7\u5148\u9009\u62E9\u54C1\u7C7B\u4FE1\u606F"
|
|
6303
6646
|
});
|
|
6304
|
-
return /* @__PURE__ */
|
|
6647
|
+
return /* @__PURE__ */ jsx43(Space4, {
|
|
6305
6648
|
size: 4,
|
|
6306
6649
|
children: items.map(function(param) {
|
|
6307
6650
|
var label = param.label, value = param.value;
|
|
6308
|
-
return /* @__PURE__ */
|
|
6651
|
+
return /* @__PURE__ */ jsxs20(Space4, {
|
|
6309
6652
|
size: 4,
|
|
6310
6653
|
style: {
|
|
6311
6654
|
height: 32,
|
|
@@ -6313,7 +6656,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6313
6656
|
borderRadius: 6
|
|
6314
6657
|
},
|
|
6315
6658
|
children: [
|
|
6316
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsxs20(Typography6.Text, {
|
|
6317
6660
|
style: {
|
|
6318
6661
|
fontSize: 14,
|
|
6319
6662
|
paddingRight: 16
|
|
@@ -6323,7 +6666,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6323
6666
|
":"
|
|
6324
6667
|
]
|
|
6325
6668
|
}),
|
|
6326
|
-
/* @__PURE__ */
|
|
6669
|
+
/* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6327
6670
|
style: {
|
|
6328
6671
|
fontSize: 14
|
|
6329
6672
|
},
|
|
@@ -6335,7 +6678,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6335
6678
|
});
|
|
6336
6679
|
});
|
|
6337
6680
|
// src/EffectScopeSelect/index.tsx
|
|
6338
|
-
import { jsx as
|
|
6681
|
+
import { jsx as jsx44, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6339
6682
|
var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
6340
6683
|
ScopeLevelEnum2[ScopeLevelEnum2["CATEGORY"] = 1] = "CATEGORY";
|
|
6341
6684
|
ScopeLevelEnum2[ScopeLevelEnum2["BRAND"] = 2] = "BRAND";
|
|
@@ -6346,8 +6689,8 @@ var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
|
6346
6689
|
}(ScopeLevelEnum || {});
|
|
6347
6690
|
var EffectScopeSelect = memo33(function(props) {
|
|
6348
6691
|
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 =
|
|
6692
|
+
var _useState27 = _sliced_to_array(useState27(_object_spread({}, controlledValue, defaultValue)), 2), value = _useState27[0], setValue = _useState27[1];
|
|
6693
|
+
var lastLevelCategoryId = useMemo19(function() {
|
|
6351
6694
|
var _value_categoryIds;
|
|
6352
6695
|
return (_value_categoryIds = value.categoryIds) === null || _value_categoryIds === void 0 ? void 0 : _value_categoryIds[value.categoryIds.length - 1];
|
|
6353
6696
|
}, [
|
|
@@ -6358,14 +6701,14 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6358
6701
|
}, [
|
|
6359
6702
|
controlledValue
|
|
6360
6703
|
]);
|
|
6361
|
-
var handleChange =
|
|
6704
|
+
var handleChange = useCallback24(function(newValue) {
|
|
6362
6705
|
setTimeout(function() {
|
|
6363
6706
|
return onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
6364
6707
|
}, 0);
|
|
6365
6708
|
}, [
|
|
6366
6709
|
onChange
|
|
6367
6710
|
]);
|
|
6368
|
-
var handleCategoryChange =
|
|
6711
|
+
var handleCategoryChange = useCallback24(function(_values, selectedList) {
|
|
6369
6712
|
if (!selectedList || !isSingleTreeSelected(selectedList)) {
|
|
6370
6713
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange();
|
|
6371
6714
|
return;
|
|
@@ -6384,7 +6727,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6384
6727
|
handleChange,
|
|
6385
6728
|
requireLevel
|
|
6386
6729
|
]);
|
|
6387
|
-
var handleBrandChange =
|
|
6730
|
+
var handleBrandChange = useCallback24(function(brandValue) {
|
|
6388
6731
|
var brandId = brandValue === void 0 ? void 0 : Number(brandValue);
|
|
6389
6732
|
setValue(function(prev) {
|
|
6390
6733
|
var newScope = {
|
|
@@ -6400,7 +6743,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6400
6743
|
handleChange,
|
|
6401
6744
|
requireLevel
|
|
6402
6745
|
]);
|
|
6403
|
-
var handleSeriesChange =
|
|
6746
|
+
var handleSeriesChange = useCallback24(function(seriesValue) {
|
|
6404
6747
|
var seriesId = seriesValue === void 0 ? void 0 : Number(seriesValue);
|
|
6405
6748
|
setValue(function(prev) {
|
|
6406
6749
|
var newScope = {
|
|
@@ -6417,7 +6760,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6417
6760
|
handleChange,
|
|
6418
6761
|
requireLevel
|
|
6419
6762
|
]);
|
|
6420
|
-
var handleSpuChange =
|
|
6763
|
+
var handleSpuChange = useCallback24(function(spuValue) {
|
|
6421
6764
|
var spuId = spuValue === void 0 ? void 0 : Number(spuValue);
|
|
6422
6765
|
setValue(function(prev) {
|
|
6423
6766
|
var newScope = {
|
|
@@ -6435,7 +6778,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6435
6778
|
handleChange,
|
|
6436
6779
|
requireLevel
|
|
6437
6780
|
]);
|
|
6438
|
-
var handleSkuChange =
|
|
6781
|
+
var handleSkuChange = useCallback24(function(skuValue) {
|
|
6439
6782
|
var skuId = skuValue === void 0 ? void 0 : Number(skuValue);
|
|
6440
6783
|
setValue(function(prev) {
|
|
6441
6784
|
var newScope = _object_spread_props(_object_spread({}, prev), {
|
|
@@ -6450,18 +6793,18 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6450
6793
|
handleChange,
|
|
6451
6794
|
requireLevel
|
|
6452
6795
|
]);
|
|
6453
|
-
var renderLabel =
|
|
6454
|
-
return /* @__PURE__ */
|
|
6796
|
+
var renderLabel = useCallback24(function(label, required) {
|
|
6797
|
+
return /* @__PURE__ */ jsx44(Flex3, {
|
|
6455
6798
|
flex: "0 0 auto",
|
|
6456
|
-
children: /* @__PURE__ */
|
|
6799
|
+
children: /* @__PURE__ */ jsxs21(Space5, {
|
|
6457
6800
|
children: [
|
|
6458
|
-
required && /* @__PURE__ */
|
|
6801
|
+
required && /* @__PURE__ */ jsx44("span", {
|
|
6459
6802
|
style: {
|
|
6460
6803
|
color: "var(--ant-color-error)"
|
|
6461
6804
|
},
|
|
6462
6805
|
children: "*"
|
|
6463
6806
|
}),
|
|
6464
|
-
/* @__PURE__ */
|
|
6807
|
+
/* @__PURE__ */ jsxs21("span", {
|
|
6465
6808
|
children: [
|
|
6466
6809
|
label,
|
|
6467
6810
|
":"
|
|
@@ -6472,34 +6815,34 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6472
6815
|
});
|
|
6473
6816
|
}, []);
|
|
6474
6817
|
if (mode === "view") {
|
|
6475
|
-
return /* @__PURE__ */
|
|
6818
|
+
return /* @__PURE__ */ jsx44(ScopeViewMode, _object_spread({}, value));
|
|
6476
6819
|
}
|
|
6477
|
-
return /* @__PURE__ */
|
|
6820
|
+
return /* @__PURE__ */ jsxs21(Flex3, {
|
|
6478
6821
|
justify: "flex-start",
|
|
6479
6822
|
align: "center",
|
|
6480
6823
|
wrap: "nowrap",
|
|
6481
6824
|
gap: "15px",
|
|
6482
6825
|
children: [
|
|
6483
|
-
/* @__PURE__ */
|
|
6826
|
+
/* @__PURE__ */ jsxs21(Flex3, {
|
|
6484
6827
|
align: "center",
|
|
6485
6828
|
gap: "5px",
|
|
6486
6829
|
flex: "0 0 auto",
|
|
6487
6830
|
children: [
|
|
6488
6831
|
renderLabel("\u5206\u7C7B", requireLevel >= 1 /* CATEGORY */ ),
|
|
6489
|
-
/* @__PURE__ */
|
|
6832
|
+
/* @__PURE__ */ jsx44(EffectCategoryCascade, {
|
|
6490
6833
|
onChange: handleCategoryChange,
|
|
6491
6834
|
changeOnSelect: categoryChangeOnSelect,
|
|
6492
6835
|
value: value.categoryIds
|
|
6493
6836
|
})
|
|
6494
6837
|
]
|
|
6495
6838
|
}),
|
|
6496
|
-
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */
|
|
6839
|
+
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6497
6840
|
align: "center",
|
|
6498
6841
|
gap: "5px",
|
|
6499
6842
|
flex: "0 0 auto",
|
|
6500
6843
|
children: [
|
|
6501
6844
|
renderLabel("\u54C1\u724C", requireLevel >= 2 /* BRAND */ ),
|
|
6502
|
-
/* @__PURE__ */
|
|
6845
|
+
/* @__PURE__ */ jsx44(EffectBrandSelect, _object_spread_props(_object_spread({
|
|
6503
6846
|
categoryId: lastLevelCategoryId
|
|
6504
6847
|
}, value), {
|
|
6505
6848
|
onChange: handleBrandChange,
|
|
@@ -6507,13 +6850,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6507
6850
|
}))
|
|
6508
6851
|
]
|
|
6509
6852
|
}),
|
|
6510
|
-
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */
|
|
6853
|
+
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6511
6854
|
align: "center",
|
|
6512
6855
|
gap: "5px",
|
|
6513
6856
|
flex: "0 0 auto",
|
|
6514
6857
|
children: [
|
|
6515
6858
|
renderLabel("\u7CFB\u5217", requireLevel >= 3 /* SERIES */ ),
|
|
6516
|
-
/* @__PURE__ */
|
|
6859
|
+
/* @__PURE__ */ jsx44(EffectSeriesSelect, _object_spread_props(_object_spread({
|
|
6517
6860
|
categoryId: lastLevelCategoryId
|
|
6518
6861
|
}, value), {
|
|
6519
6862
|
onChange: handleSeriesChange,
|
|
@@ -6521,13 +6864,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6521
6864
|
}))
|
|
6522
6865
|
]
|
|
6523
6866
|
}),
|
|
6524
|
-
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */
|
|
6867
|
+
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6525
6868
|
align: "center",
|
|
6526
6869
|
gap: "5px",
|
|
6527
6870
|
flex: "0 0 auto",
|
|
6528
6871
|
children: [
|
|
6529
6872
|
renderLabel("SPU", requireLevel >= 4 /* SPU */ ),
|
|
6530
|
-
/* @__PURE__ */
|
|
6873
|
+
/* @__PURE__ */ jsx44(EffectSpuSelect, _object_spread_props(_object_spread({
|
|
6531
6874
|
categoryId: lastLevelCategoryId
|
|
6532
6875
|
}, value), {
|
|
6533
6876
|
onChange: handleSpuChange,
|
|
@@ -6535,13 +6878,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6535
6878
|
}))
|
|
6536
6879
|
]
|
|
6537
6880
|
}),
|
|
6538
|
-
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */
|
|
6881
|
+
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6539
6882
|
align: "center",
|
|
6540
6883
|
gap: "5px",
|
|
6541
6884
|
flex: "0 0 auto",
|
|
6542
6885
|
children: [
|
|
6543
6886
|
renderLabel("SKU", requireLevel >= 5 /* SKU */ ),
|
|
6544
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsx44(EffectSkuSelect, _object_spread_props(_object_spread({
|
|
6545
6888
|
categoryId: lastLevelCategoryId
|
|
6546
6889
|
}, value), {
|
|
6547
6890
|
onChange: handleSkuChange,
|
|
@@ -6553,22 +6896,22 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6553
6896
|
});
|
|
6554
6897
|
});
|
|
6555
6898
|
// src/EffectStaffSelect/index.tsx
|
|
6556
|
-
import { memo as memo34, useCallback as
|
|
6899
|
+
import { memo as memo34, useCallback as useCallback25, useEffect as useEffect23, useState as useState28 } from "react";
|
|
6557
6900
|
import { useAsyncFn as useAsyncFn4, useMount as useMount5, useUpdateEffect as useUpdateEffect15 } from "react-use";
|
|
6558
|
-
import
|
|
6559
|
-
import { Select as
|
|
6901
|
+
import classnames13 from "classnames";
|
|
6902
|
+
import { Select as Select9 } from "antd";
|
|
6560
6903
|
import { debounce as debounce7 } from "@xfe-repo/web-utils/tools";
|
|
6561
6904
|
// src/EffectStaffSelect/index.module.less
|
|
6562
|
-
var
|
|
6905
|
+
var index_module_default19 = {
|
|
6563
6906
|
select: "index_module_select4"
|
|
6564
6907
|
};
|
|
6565
6908
|
// src/EffectStaffSelect/index.tsx
|
|
6566
|
-
import { jsx as
|
|
6909
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6567
6910
|
var EffectStaffSelect = memo34(function(props) {
|
|
6568
6911
|
var _state_value_data, _state_value;
|
|
6569
6912
|
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
|
|
6913
|
+
var _useState28 = _sliced_to_array(useState28([]), 2), options = _useState28[0], setOptions = _useState28[1];
|
|
6914
|
+
var _useState281 = _sliced_to_array(useState28(controlValue !== null && controlValue !== void 0 ? controlValue : defaultValue), 2), value = _useState281[0], setValue = _useState281[1];
|
|
6572
6915
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6573
6916
|
var getBusinessOptions = function getBusinessOptions(businessName, currentDeptId) {
|
|
6574
6917
|
return _async_to_generator(function() {
|
|
@@ -6602,10 +6945,10 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6602
6945
|
deptId,
|
|
6603
6946
|
config
|
|
6604
6947
|
]), 2), state = _useAsyncFn4[0], searchFetch = _useAsyncFn4[1];
|
|
6605
|
-
var debounceSearchFetch =
|
|
6948
|
+
var debounceSearchFetch = useCallback25(debounce7(600, searchFetch), [
|
|
6606
6949
|
searchFetch
|
|
6607
6950
|
]);
|
|
6608
|
-
|
|
6951
|
+
useEffect23(function() {
|
|
6609
6952
|
var _state_value_data, _state_value;
|
|
6610
6953
|
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
6954
|
return;
|
|
@@ -6660,8 +7003,8 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6660
7003
|
}
|
|
6661
7004
|
};
|
|
6662
7005
|
var defaultPlaceholder = deptId ? "\u8BF7\u9009\u62E9\u5458\u5DE5\u59D3\u540D" : "\u8BF7\u5148\u8F93\u5165\u5458\u5DE5\u59D3\u540D";
|
|
6663
|
-
return /* @__PURE__ */
|
|
6664
|
-
className:
|
|
7006
|
+
return /* @__PURE__ */ jsx45(Select9, {
|
|
7007
|
+
className: classnames13(index_module_default19.select, className),
|
|
6665
7008
|
style: style,
|
|
6666
7009
|
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
7010
|
placeholder: placeholder || defaultPlaceholder,
|
|
@@ -6679,14 +7022,14 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6679
7022
|
});
|
|
6680
7023
|
});
|
|
6681
7024
|
// src/EffectReservoirSelect/EffectReservoirSelect.tsx
|
|
6682
|
-
import { memo as memo35, useEffect as
|
|
7025
|
+
import { memo as memo35, useEffect as useEffect24, useState as useState29 } from "react";
|
|
6683
7026
|
import { useAsyncFn as useAsyncFn5, useMount as useMount6, usePrevious as usePrevious7, useUpdateEffect as useUpdateEffect16 } from "react-use";
|
|
6684
|
-
import { Select as
|
|
6685
|
-
import { jsx as
|
|
7027
|
+
import { Select as Select10 } from "antd";
|
|
7028
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6686
7029
|
var EffectReservoirSelect = memo35(function(props) {
|
|
6687
7030
|
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
|
|
7031
|
+
var _useState29 = _sliced_to_array(useState29([]), 2), options = _useState29[0], setOptions = _useState29[1];
|
|
7032
|
+
var _useState291 = _sliced_to_array(useState29(controlValue || defaultValue), 2), value = _useState291[0], setValue = _useState291[1];
|
|
6690
7033
|
var prevControlValue = usePrevious7(controlValue);
|
|
6691
7034
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6692
7035
|
var get_reservoir_options = function get_reservoir_options() {
|
|
@@ -6719,7 +7062,7 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6719
7062
|
var _useAsyncFn5 = _sliced_to_array(useAsyncFn5(get_reservoir_options, [
|
|
6720
7063
|
warehouseId
|
|
6721
7064
|
]), 2), state = _useAsyncFn5[0], fetch = _useAsyncFn5[1];
|
|
6722
|
-
|
|
7065
|
+
useEffect24(function() {
|
|
6723
7066
|
var _state_value;
|
|
6724
7067
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6725
7068
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6770,20 +7113,20 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6770
7113
|
onChange: handleOnChange,
|
|
6771
7114
|
loading: state.loading
|
|
6772
7115
|
};
|
|
6773
|
-
return /* @__PURE__ */
|
|
7116
|
+
return /* @__PURE__ */ jsx46(Select10, _object_spread({
|
|
6774
7117
|
className: className
|
|
6775
7118
|
}, selectBrandProps));
|
|
6776
7119
|
});
|
|
6777
7120
|
// src/EffectReservoirSelect/EffectShelveSelect.tsx
|
|
6778
|
-
import { memo as memo36, useEffect as
|
|
7121
|
+
import { memo as memo36, useEffect as useEffect25, useState as useState30 } from "react";
|
|
6779
7122
|
import { useAsyncFn as useAsyncFn6, useMount as useMount7, usePrevious as usePrevious8, useUpdateEffect as useUpdateEffect17 } from "react-use";
|
|
6780
|
-
import { Select as
|
|
6781
|
-
import { jsx as
|
|
7123
|
+
import { Select as Select11 } from "antd";
|
|
7124
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6782
7125
|
var EffectShelveSelect = memo36(function(props) {
|
|
6783
7126
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, reservoirId = props.reservoirId;
|
|
6784
7127
|
var _props_valueType = props.valueType, valueType = _props_valueType === void 0 ? "code" : _props_valueType;
|
|
6785
|
-
var
|
|
6786
|
-
var
|
|
7128
|
+
var _useState30 = _sliced_to_array(useState30([]), 2), options = _useState30[0], setOptions = _useState30[1];
|
|
7129
|
+
var _useState301 = _sliced_to_array(useState30(controlValue || defaultValue), 2), value = _useState301[0], setValue = _useState301[1];
|
|
6787
7130
|
var prevControlValue = usePrevious8(controlValue);
|
|
6788
7131
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6789
7132
|
var get_shelve_options = function get_shelve_options() {
|
|
@@ -6817,7 +7160,7 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6817
7160
|
reservoirId,
|
|
6818
7161
|
warehouseId
|
|
6819
7162
|
]), 2), state = _useAsyncFn6[0], fetch = _useAsyncFn6[1];
|
|
6820
|
-
|
|
7163
|
+
useEffect25(function() {
|
|
6821
7164
|
var _state_value;
|
|
6822
7165
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6823
7166
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6870,16 +7213,16 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6870
7213
|
onChange: handleOnChange,
|
|
6871
7214
|
loading: state.loading
|
|
6872
7215
|
};
|
|
6873
|
-
return /* @__PURE__ */
|
|
7216
|
+
return /* @__PURE__ */ jsx47(Select11, _object_spread({
|
|
6874
7217
|
className: className
|
|
6875
7218
|
}, selectBrandProps));
|
|
6876
7219
|
});
|
|
6877
7220
|
// src/EffectWarehouseSelect/index.tsx
|
|
6878
|
-
import { Select as
|
|
6879
|
-
import
|
|
7221
|
+
import { Select as Select12 } from "antd";
|
|
7222
|
+
import classnames14 from "classnames";
|
|
6880
7223
|
import { memo as memo37 } from "react";
|
|
6881
7224
|
// src/EffectWarehouseSelect/useStoreOptions.ts
|
|
6882
|
-
import
|
|
7225
|
+
import useSWRImmutable8 from "swr/immutable";
|
|
6883
7226
|
var transformStoreData = function transformStoreData() {
|
|
6884
7227
|
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
6885
7228
|
return list.map(function(item) {
|
|
@@ -6892,7 +7235,7 @@ var transformStoreData = function transformStoreData() {
|
|
|
6892
7235
|
function useStoreOptions() {
|
|
6893
7236
|
var currentMerchantOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, warehouseType = arguments.length > 1 ? arguments[1] : void 0;
|
|
6894
7237
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6895
|
-
var
|
|
7238
|
+
var _useSWRImmutable8 = useSWRImmutable8([
|
|
6896
7239
|
"warehouse/store/combo-box",
|
|
6897
7240
|
currentMerchantOnly,
|
|
6898
7241
|
warehouseType
|
|
@@ -6927,7 +7270,7 @@ function useStoreOptions() {
|
|
|
6927
7270
|
retryCount: 3,
|
|
6928
7271
|
dedupingInterval: 5e3,
|
|
6929
7272
|
fallback: []
|
|
6930
|
-
}), data =
|
|
7273
|
+
}), data = _useSWRImmutable8.data, error = _useSWRImmutable8.error, isLoading = _useSWRImmutable8.isLoading, mutate = _useSWRImmutable8.mutate;
|
|
6931
7274
|
return {
|
|
6932
7275
|
data: data,
|
|
6933
7276
|
error: error,
|
|
@@ -6936,11 +7279,11 @@ function useStoreOptions() {
|
|
|
6936
7279
|
};
|
|
6937
7280
|
}
|
|
6938
7281
|
// src/EffectWarehouseSelect/index.module.less
|
|
6939
|
-
var
|
|
7282
|
+
var index_module_default20 = {
|
|
6940
7283
|
select: "index_module_select5"
|
|
6941
7284
|
};
|
|
6942
7285
|
// src/EffectWarehouseSelect/index.tsx
|
|
6943
|
-
import { jsx as
|
|
7286
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
6944
7287
|
var EffectWarehouseSelect = memo37(function(props) {
|
|
6945
7288
|
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
7289
|
var state = useStoreOptions(currentMerchantOnly, warehouseType);
|
|
@@ -6951,8 +7294,8 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6951
7294
|
var handleClear = function handleClear() {
|
|
6952
7295
|
onChange === null || onChange === void 0 ? void 0 : onChange(void 0, void 0);
|
|
6953
7296
|
};
|
|
6954
|
-
return /* @__PURE__ */
|
|
6955
|
-
className:
|
|
7297
|
+
return /* @__PURE__ */ jsx48(Select12, {
|
|
7298
|
+
className: classnames14(index_module_default20.select, className),
|
|
6956
7299
|
placeholder: "\u8BF7\u9009\u62E9\u4ED3\u5E93",
|
|
6957
7300
|
notFoundContent: state.isLoading ? "\u52A0\u8F7D\u4E2D..." : "\u6682\u65E0\u4ED3\u5E93\u6570\u636E",
|
|
6958
7301
|
loading: state.isLoading,
|
|
@@ -6964,22 +7307,22 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6964
7307
|
});
|
|
6965
7308
|
});
|
|
6966
7309
|
// src/EffectAddressCascade/index.tsx
|
|
6967
|
-
import { memo as memo38, useEffect as
|
|
7310
|
+
import { memo as memo38, useEffect as useEffect26, useState as useState31 } from "react";
|
|
6968
7311
|
import { useAsyncFn as useAsyncFn7, useMount as useMount8 } from "react-use";
|
|
6969
|
-
import
|
|
7312
|
+
import classnames15 from "classnames";
|
|
6970
7313
|
// src/EffectAddressCascade/index.module.less
|
|
6971
|
-
var
|
|
7314
|
+
var index_module_default21 = {
|
|
6972
7315
|
input: "index_module_input7",
|
|
6973
7316
|
select: "index_module_select6"
|
|
6974
7317
|
};
|
|
6975
7318
|
// src/EffectAddressCascade/index.tsx
|
|
6976
7319
|
import { Cascader as Cascader2 } from "antd";
|
|
6977
|
-
import { jsx as
|
|
7320
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6978
7321
|
var EffectAddressCascade = memo38(function(props) {
|
|
6979
7322
|
var _selectedList_;
|
|
6980
7323
|
var className = props.className, disabled = props.disabled, defaultValue = props.defaultValue, onChange = props.onChange;
|
|
6981
|
-
var
|
|
6982
|
-
var
|
|
7324
|
+
var _useState31 = _sliced_to_array(useState31(), 2), selectedList = _useState31[0], setSelectedList = _useState31[1];
|
|
7325
|
+
var _useState311 = _sliced_to_array(useState31(), 2), customTree = _useState311[0], setCustomTree = _useState311[1];
|
|
6983
7326
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6984
7327
|
var params = {
|
|
6985
7328
|
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 +7348,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7005
7348
|
var _useAsyncFn7 = _sliced_to_array(useAsyncFn7(getAddress, [
|
|
7006
7349
|
selectedList
|
|
7007
7350
|
]), 2), state = _useAsyncFn7[0], getAddressFetch = _useAsyncFn7[1];
|
|
7008
|
-
|
|
7351
|
+
useEffect26(function() {
|
|
7009
7352
|
var _state_value;
|
|
7010
7353
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
7011
7354
|
var list = state.value.data.list;
|
|
@@ -7043,7 +7386,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7043
7386
|
}, [
|
|
7044
7387
|
state
|
|
7045
7388
|
]);
|
|
7046
|
-
|
|
7389
|
+
useEffect26(function() {
|
|
7047
7390
|
if (!state.loading || !customTree || !selectedList) return;
|
|
7048
7391
|
var target = findTargetLeaf(selectedList, customTree);
|
|
7049
7392
|
if (!target) return;
|
|
@@ -7055,7 +7398,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7055
7398
|
useMount8(function() {
|
|
7056
7399
|
void getAddressFetch();
|
|
7057
7400
|
});
|
|
7058
|
-
|
|
7401
|
+
useEffect26(function() {
|
|
7059
7402
|
var target = findTargetLeaf(selectedList || [], customTree || []);
|
|
7060
7403
|
if ((target === null || target === void 0 ? void 0 : target.isLeaf) || !(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length)) return;
|
|
7061
7404
|
void getAddressFetch();
|
|
@@ -7071,8 +7414,8 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7071
7414
|
setSelectedList(_selectedList);
|
|
7072
7415
|
if (onChange) onChange(_selectedList);
|
|
7073
7416
|
};
|
|
7074
|
-
return /* @__PURE__ */
|
|
7075
|
-
className:
|
|
7417
|
+
return /* @__PURE__ */ jsx49(Cascader2, {
|
|
7418
|
+
className: classnames15(index_module_default21.input, className),
|
|
7076
7419
|
disabled: disabled,
|
|
7077
7420
|
defaultValue: defaultValue,
|
|
7078
7421
|
multiple: false,
|
|
@@ -7106,11 +7449,11 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7106
7449
|
});
|
|
7107
7450
|
};
|
|
7108
7451
|
// src/EffectLabelSelect/index.tsx
|
|
7109
|
-
import { memo as memo39, useEffect as
|
|
7452
|
+
import { memo as memo39, useEffect as useEffect27, useState as useState32 } from "react";
|
|
7110
7453
|
import { useUpdateEffect as useUpdateEffect18 } from "react-use";
|
|
7111
|
-
import
|
|
7454
|
+
import classnames16 from "classnames";
|
|
7112
7455
|
// src/EffectLabelSelect/hooks.ts
|
|
7113
|
-
import { useAsyncFn as useAsyncFn8, useDebounce } from "react-use";
|
|
7456
|
+
import { useAsyncFn as useAsyncFn8, useDebounce as useDebounce2 } from "react-use";
|
|
7114
7457
|
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7115
7458
|
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7116
7459
|
var reqDataFn = function reqDataFn() {
|
|
@@ -7134,7 +7477,7 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7134
7477
|
var _useAsyncFn8 = _sliced_to_array(useAsyncFn8(reqDataFn, [
|
|
7135
7478
|
dependency
|
|
7136
7479
|
]), 2), resState = _useAsyncFn8[0], fetchData = _useAsyncFn8[1];
|
|
7137
|
-
|
|
7480
|
+
useDebounce2(function() {
|
|
7138
7481
|
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7139
7482
|
if (shouldFetchData) {
|
|
7140
7483
|
void fetchData();
|
|
@@ -7148,41 +7491,42 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7148
7491
|
];
|
|
7149
7492
|
};
|
|
7150
7493
|
// src/EffectLabelSelect/index.module.less
|
|
7151
|
-
var
|
|
7494
|
+
var index_module_default22 = {
|
|
7152
7495
|
select_wrap: "index_module_select_wrap",
|
|
7153
7496
|
select_label: "index_module_select_label",
|
|
7154
|
-
value_select: "
|
|
7497
|
+
value_select: "index_module_value_select2",
|
|
7155
7498
|
select: "index_module_select7"
|
|
7156
7499
|
};
|
|
7157
7500
|
// src/EffectLabelSelect/index.tsx
|
|
7158
|
-
import { Select as
|
|
7159
|
-
import { jsx as
|
|
7501
|
+
import { Select as Select13, Space as Space6 } from "antd";
|
|
7502
|
+
import { jsx as jsx50, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7160
7503
|
var EffectLabelSelect = memo39(function(props) {
|
|
7161
7504
|
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
7505
|
var apiService = useRequestConfig().apiService;
|
|
7163
|
-
var
|
|
7506
|
+
var _useState32 = _sliced_to_array(useState32(function() {
|
|
7164
7507
|
var _transformObj2Options_, _transformObj2Options;
|
|
7165
7508
|
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7166
7509
|
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
7510
|
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7168
|
-
}), 2), curSelectLabel =
|
|
7169
|
-
var
|
|
7170
|
-
var
|
|
7171
|
-
var
|
|
7172
|
-
var
|
|
7511
|
+
}), 2), curSelectLabel = _useState32[0], setCurSelectLabel = _useState32[1];
|
|
7512
|
+
var _useState321 = _sliced_to_array(useState32(value !== null && value !== void 0 ? value : void 0), 2), curSelectValue = _useState321[0], setCurSelectValue = _useState321[1];
|
|
7513
|
+
var _useState322 = _sliced_to_array(useState32(), 2), curSelectItem = _useState322[0], setCurSelectItem = _useState322[1];
|
|
7514
|
+
var _useState323 = _sliced_to_array(useState32(), 2), curSearchValue = _useState323[0], setCurSearchValue = _useState323[1];
|
|
7515
|
+
var _useState324 = _sliced_to_array(useState32([]), 2), optionsData = _useState324[0], setOptionsData = _useState324[1];
|
|
7173
7516
|
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7174
7517
|
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7175
7518
|
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7176
7519
|
page: 1,
|
|
7177
7520
|
pageSize: 20
|
|
7178
7521
|
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7179
|
-
|
|
7522
|
+
useEffect27(function() {
|
|
7180
7523
|
var _resState_value;
|
|
7181
7524
|
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7182
7525
|
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7183
7526
|
setOptionsData(optionsData2);
|
|
7184
7527
|
}, [
|
|
7185
|
-
resState
|
|
7528
|
+
resState.loading,
|
|
7529
|
+
resState.value
|
|
7186
7530
|
]);
|
|
7187
7531
|
useUpdateEffect18(function() {
|
|
7188
7532
|
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
@@ -7213,7 +7557,7 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7213
7557
|
setOptionsData([]);
|
|
7214
7558
|
};
|
|
7215
7559
|
var selectLabelProps = {
|
|
7216
|
-
className:
|
|
7560
|
+
className: index_module_default22.select_label,
|
|
7217
7561
|
disabled: disabled,
|
|
7218
7562
|
defaultValue: curSelectLabel,
|
|
7219
7563
|
options: transformObj2Options(labelDic),
|
|
@@ -7229,7 +7573,7 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7229
7573
|
});
|
|
7230
7574
|
}) : optionsData;
|
|
7231
7575
|
var selectValueProps = {
|
|
7232
|
-
className:
|
|
7576
|
+
className: classnames16(index_module_default22.value_select, className),
|
|
7233
7577
|
notFoundContent: notFoundContent,
|
|
7234
7578
|
value: mergedValue,
|
|
7235
7579
|
options: mergedOptionsData,
|
|
@@ -7246,12 +7590,12 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7246
7590
|
filterOption: false,
|
|
7247
7591
|
popupMatchSelectWidth: false
|
|
7248
7592
|
};
|
|
7249
|
-
return /* @__PURE__ */
|
|
7250
|
-
className:
|
|
7593
|
+
return /* @__PURE__ */ jsxs22(Space6.Compact, {
|
|
7594
|
+
className: index_module_default22.select_wrap,
|
|
7251
7595
|
style: style,
|
|
7252
7596
|
children: [
|
|
7253
|
-
/* @__PURE__ */
|
|
7254
|
-
/* @__PURE__ */
|
|
7597
|
+
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectLabelProps)),
|
|
7598
|
+
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectValueProps))
|
|
7255
7599
|
]
|
|
7256
7600
|
});
|
|
7257
7601
|
});
|
|
@@ -7334,4 +7678,4 @@ var getSecondValue = function getSecondValue() {
|
|
|
7334
7678
|
var _this;
|
|
7335
7679
|
return (_this = (str === null || str === void 0 ? void 0 : str.includes("-")) ? str.split("-")[1] : str) === null || _this === void 0 ? void 0 : _this.trim();
|
|
7336
7680
|
};
|
|
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 };
|
|
7681
|
+
export { CInput, CTable, CVideo, Clock, ConfigContext, ConfigProvider, Countdown, Counter, Currency, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, EffectCategoryCascade, EffectFileUpload, EffectLabelSelect, 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, getFirstValue, getInitialValue, getNumberValue, getSecondValue, getSelectValue, getStrValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|