@xfe-repo/web-components 1.7.6 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +34 -1
- package/dist/index.d.mts +46 -12
- package/dist/index.d.ts +46 -12
- package/dist/index.js +549 -176
- package/dist/index.mjs +503 -138
- package/package.json +4 -2
- package/skills/xfe-web-components/GUIDE.md +3 -2
- package/skills/xfe-web-components/SKILL.md +3 -2
- package/skills/xfe-web-components/references/EffectLabelSelect.md +6 -5
- package/skills/xfe-web-components/references/EffectMerchantSelect.md +13 -28
- package/skills/xfe-web-components/references/EffectSearchSelect.md +262 -0
- package/skills/xfe-web-components/references/EffectStaffSelect.md +4 -4
- package/skills/xfe-web-components/references/commonFn.md +3 -1
package/dist/index.mjs
CHANGED
|
@@ -653,6 +653,11 @@ import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
|
|
|
653
653
|
import { CSS } from "@dnd-kit/utilities";
|
|
654
654
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
655
655
|
import { createElement } from "react";
|
|
656
|
+
var getMiddleClickCloseTargetKey = function getMiddleClickCloseTargetKey(event, data) {
|
|
657
|
+
if (event.button !== 1) return void 0;
|
|
658
|
+
if (!data || data.disabled || data.closable === false) return void 0;
|
|
659
|
+
return data.key;
|
|
660
|
+
};
|
|
656
661
|
var MultiWindowTabs = memo3(function(props) {
|
|
657
662
|
var pathKey = props.pathKey, pagePaths = props.pagePaths, className = props.className, onChange = props.onChange, onClose = props.onClose, onSort = props.onSort, onCollectionChange = props.onCollectionChange, sortAutoActive = props.sortAutoActive;
|
|
658
663
|
var sensor = useSensor(PointerSensor, {
|
|
@@ -728,6 +733,7 @@ var MultiWindowTabs = memo3(function(props) {
|
|
|
728
733
|
key: node.key,
|
|
729
734
|
data: pagePathsHelperData.map.get(String(node.key)),
|
|
730
735
|
onCollectionChange: onCollectionChange,
|
|
736
|
+
onClose: onClose,
|
|
731
737
|
isActivated: pathKey === String(node.key)
|
|
732
738
|
}), node);
|
|
733
739
|
}
|
|
@@ -739,6 +745,8 @@ var MultiWindowTabs = memo3(function(props) {
|
|
|
739
745
|
onDragStart,
|
|
740
746
|
onDragEnd,
|
|
741
747
|
onCollectionChange,
|
|
748
|
+
onClose,
|
|
749
|
+
pathKey,
|
|
742
750
|
sensor
|
|
743
751
|
]);
|
|
744
752
|
return /* @__PURE__ */ jsx4(Tabs, {
|
|
@@ -754,15 +762,26 @@ var MultiWindowTabs = memo3(function(props) {
|
|
|
754
762
|
});
|
|
755
763
|
});
|
|
756
764
|
var TabItem = memo3(function(props) {
|
|
757
|
-
var data = props.data, children = props.children, style = props.style, isActivated = props.isActivated, onCollectionChange = props.onCollectionChange;
|
|
765
|
+
var data = props.data, children = props.children, style = props.style, isActivated = props.isActivated, onCollectionChange = props.onCollectionChange, onClose = props.onClose;
|
|
758
766
|
var _useSortable = useSortable({
|
|
759
767
|
id: props["data-node-key"]
|
|
760
768
|
}), attributes = _useSortable.attributes, listeners = _useSortable.listeners, setNodeRef = _useSortable.setNodeRef, transform = _useSortable.transform, transition = _useSortable.transition, isDragging = _useSortable.isDragging;
|
|
769
|
+
var handleAuxClick = useCallback2(function(event) {
|
|
770
|
+
var targetKey = getMiddleClickCloseTargetKey(event, data);
|
|
771
|
+
if (!targetKey) return;
|
|
772
|
+
event.preventDefault();
|
|
773
|
+
event.stopPropagation();
|
|
774
|
+
onClose === null || onClose === void 0 ? void 0 : onClose(targetKey);
|
|
775
|
+
}, [
|
|
776
|
+
data,
|
|
777
|
+
onClose
|
|
778
|
+
]);
|
|
761
779
|
var handleCollectionChange = useCallback2(function(collectionKey) {
|
|
762
780
|
if (!data) return;
|
|
763
781
|
onCollectionChange === null || onCollectionChange === void 0 ? void 0 : onCollectionChange(data.key, collectionKey);
|
|
764
782
|
}, [
|
|
765
|
-
data
|
|
783
|
+
data,
|
|
784
|
+
onCollectionChange
|
|
766
785
|
]);
|
|
767
786
|
var collectionSelect = useMemo3(function() {
|
|
768
787
|
var _data_searchCollection;
|
|
@@ -799,7 +818,7 @@ var TabItem = memo3(function(props) {
|
|
|
799
818
|
children,
|
|
800
819
|
collectionSelect
|
|
801
820
|
]);
|
|
802
|
-
return React3.cloneElement(children, _object_spread({
|
|
821
|
+
return React3.cloneElement(children, _object_spread_props(_object_spread({
|
|
803
822
|
ref: setNodeRef,
|
|
804
823
|
style: _object_spread_props(_object_spread({}, style), {
|
|
805
824
|
transform: CSS.Translate.toString(transform && _object_spread_props(_object_spread({}, transform), {
|
|
@@ -810,7 +829,9 @@ var TabItem = memo3(function(props) {
|
|
|
810
829
|
cursor: "pointer"
|
|
811
830
|
}),
|
|
812
831
|
children: childrenWithCollectionSelect
|
|
813
|
-
}, attributes, listeners)
|
|
832
|
+
}, attributes, listeners), {
|
|
833
|
+
onAuxClick: handleAuxClick
|
|
834
|
+
}));
|
|
814
835
|
});
|
|
815
836
|
// src/MultiWindow/MultiWindow.tsx
|
|
816
837
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -3043,6 +3064,7 @@ var index_module_default6 = {
|
|
|
3043
3064
|
text: "index_module_text",
|
|
3044
3065
|
button: "index_module_button",
|
|
3045
3066
|
remote: "index_module_remote",
|
|
3067
|
+
paste_tip: "index_module_paste_tip",
|
|
3046
3068
|
upload_mask: "index_module_upload_mask"
|
|
3047
3069
|
};
|
|
3048
3070
|
// src/FileUpload/index.tsx
|
|
@@ -3813,16 +3835,19 @@ var FileUpload = function FileUpload(props) {
|
|
|
3813
3835
|
var renderPicCardUploadButton = useCallback14(function() {
|
|
3814
3836
|
if (max && fileList.length >= max) return null;
|
|
3815
3837
|
if (children) return children;
|
|
3816
|
-
if (disabled) return null;
|
|
3817
3838
|
return /* @__PURE__ */ jsxs12("div", {
|
|
3818
3839
|
className: index_module_default6.upload_btn,
|
|
3819
3840
|
children: [
|
|
3841
|
+
pastable && !disabled && /* @__PURE__ */ jsx30("div", {
|
|
3842
|
+
className: index_module_default6.paste_tip,
|
|
3843
|
+
children: "\u53EF\u7C98\u8D34\u4E0A\u4F20"
|
|
3844
|
+
}),
|
|
3820
3845
|
/* @__PURE__ */ jsx30(PlusOutlined, {}),
|
|
3821
3846
|
/* @__PURE__ */ jsx30("div", {
|
|
3822
3847
|
className: index_module_default6.text,
|
|
3823
3848
|
children: "\u4E0A\u4F20"
|
|
3824
3849
|
}),
|
|
3825
|
-
remote && /* @__PURE__ */ jsx30(RemoteUpload, {
|
|
3850
|
+
remote && !disabled && /* @__PURE__ */ jsx30(RemoteUpload, {
|
|
3826
3851
|
max: max,
|
|
3827
3852
|
onAddFile: setBufferAddFile
|
|
3828
3853
|
})
|
|
@@ -6070,13 +6095,13 @@ function useMerchantOptions(params) {
|
|
|
6070
6095
|
params
|
|
6071
6096
|
], function() {
|
|
6072
6097
|
return _async_to_generator(function() {
|
|
6073
|
-
var _res_data, _ref, enabled,
|
|
6098
|
+
var _res_data, _ref, enabled, source, searchParams, res, options;
|
|
6074
6099
|
return _ts_generator(this, function(_state) {
|
|
6075
6100
|
switch(_state.label){
|
|
6076
6101
|
case 0:
|
|
6077
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6102
|
+
_ref = params || {}, enabled = _ref.enabled, source = _ref.source, searchParams = _object_without_properties(_ref, [
|
|
6078
6103
|
"enabled",
|
|
6079
|
-
"
|
|
6104
|
+
"source"
|
|
6080
6105
|
]);
|
|
6081
6106
|
if (enabled === false) return [
|
|
6082
6107
|
2,
|
|
@@ -6087,7 +6112,7 @@ function useMerchantOptions(params) {
|
|
|
6087
6112
|
apiService.merchantList(_object_spread({
|
|
6088
6113
|
page: 1,
|
|
6089
6114
|
pageSize: 20
|
|
6090
|
-
},
|
|
6115
|
+
}, searchParams), config)
|
|
6091
6116
|
];
|
|
6092
6117
|
case 1:
|
|
6093
6118
|
res = _state.sent();
|
|
@@ -6095,9 +6120,12 @@ function useMerchantOptions(params) {
|
|
|
6095
6120
|
throw new Error((res === null || res === void 0 ? void 0 : res.msg) || "\u63A5\u53E3\u8BF7\u6C42\u9519\u8BEF~");
|
|
6096
6121
|
}
|
|
6097
6122
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6098
|
-
var label = labelDisplayMode === "platformName-enterpriseNo" ? "".concat(item.platformName, " - ").concat(item.enterpriseNo) : item.platformName;
|
|
6099
6123
|
return {
|
|
6100
|
-
label:
|
|
6124
|
+
label: [
|
|
6125
|
+
item.enterpriseNo,
|
|
6126
|
+
item.platformName,
|
|
6127
|
+
item.name
|
|
6128
|
+
].filter(Boolean).join(" - "),
|
|
6101
6129
|
value: item.enterpriseNo,
|
|
6102
6130
|
originalName: item.platformName,
|
|
6103
6131
|
data: item
|
|
@@ -6132,8 +6160,27 @@ var index_module_default17 = {
|
|
|
6132
6160
|
// src/EffectMerchantSelect/index.tsx
|
|
6133
6161
|
import { Select as Select7, Typography as Typography5 } from "antd";
|
|
6134
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
|
+
];
|
|
6135
6181
|
var EffectMerchantSelect = memo31(function(props) {
|
|
6136
|
-
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;
|
|
6137
6184
|
var _useState25 = _sliced_to_array(useState25(), 2), searchValue = _useState25[0], setSearchValue = _useState25[1];
|
|
6138
6185
|
var _useState251 = _sliced_to_array(useState25(controlValue), 2), value = _useState251[0], setValue = _useState251[1];
|
|
6139
6186
|
var _useState252 = _sliced_to_array(useState25(), 2), name = _useState252[0], setName = _useState252[1];
|
|
@@ -6150,12 +6197,11 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6150
6197
|
useEffect21(function() {
|
|
6151
6198
|
if (controlValue !== value) setValue(controlValue);
|
|
6152
6199
|
if (controlValue) setParams({
|
|
6153
|
-
|
|
6154
|
-
|
|
6200
|
+
enterpriseNo: controlValue,
|
|
6201
|
+
source: sourceControl
|
|
6155
6202
|
});
|
|
6156
6203
|
}, [
|
|
6157
|
-
controlValue
|
|
6158
|
-
labelDisplayMode
|
|
6204
|
+
controlValue
|
|
6159
6205
|
]);
|
|
6160
6206
|
useUpdateEffect13(function() {
|
|
6161
6207
|
var changeValue = (value !== null && value !== void 0 ? value : "") === "" ? void 0 : String(value);
|
|
@@ -6169,24 +6215,23 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6169
6215
|
setName(option === null || option === void 0 ? void 0 : option.originalName);
|
|
6170
6216
|
};
|
|
6171
6217
|
var handleOnSearch = function handleOnSearch(searchValue2) {
|
|
6218
|
+
setSearchValue(searchValue2);
|
|
6172
6219
|
var _obj;
|
|
6173
|
-
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));
|
|
6174
6221
|
};
|
|
6175
6222
|
var handleOnSearchDebounce = useCallback22(debounce6(800, handleOnSearch), [
|
|
6176
|
-
sourceControl
|
|
6177
|
-
labelDisplayMode
|
|
6223
|
+
sourceControl
|
|
6178
6224
|
]);
|
|
6179
6225
|
var handleOnClear = function handleOnClear() {
|
|
6180
6226
|
setSearchValue(void 0);
|
|
6181
6227
|
setOptions([]);
|
|
6182
6228
|
};
|
|
6183
|
-
var
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
var
|
|
6189
|
-
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) {
|
|
6190
6235
|
setSourceControl(value2);
|
|
6191
6236
|
setValue(void 0);
|
|
6192
6237
|
setSearchValue(void 0);
|
|
@@ -6204,13 +6249,7 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6204
6249
|
popupMatchSelectWidth: false,
|
|
6205
6250
|
disabled: disabled,
|
|
6206
6251
|
defaultValue: sourceControl,
|
|
6207
|
-
options:
|
|
6208
|
-
var _param = _sliced_to_array(param, 2), value2 = _param[0], label = _param[1];
|
|
6209
|
-
return {
|
|
6210
|
-
value: value2,
|
|
6211
|
-
label: label
|
|
6212
|
-
};
|
|
6213
|
-
}),
|
|
6252
|
+
options: defaultMerchantSearchSources,
|
|
6214
6253
|
onChange: handleAddonChange,
|
|
6215
6254
|
style: {
|
|
6216
6255
|
width: 140
|
|
@@ -6218,12 +6257,13 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6218
6257
|
};
|
|
6219
6258
|
var selectBrandProps = {
|
|
6220
6259
|
notFoundContent: notFoundContent,
|
|
6221
|
-
placeholder: "请输入".concat(
|
|
6260
|
+
placeholder: "请输入".concat(currentSourceLabel),
|
|
6222
6261
|
optionFilterProp: "label",
|
|
6223
6262
|
showSearch: true,
|
|
6224
6263
|
allowClear: true,
|
|
6225
6264
|
defaultActiveFirstOption: false,
|
|
6226
6265
|
filterOption: false,
|
|
6266
|
+
popupMatchSelectWidth: false,
|
|
6227
6267
|
value: value,
|
|
6228
6268
|
options: options,
|
|
6229
6269
|
disabled: disabled,
|
|
@@ -6242,14 +6282,338 @@ var EffectMerchantSelect = memo31(function(props) {
|
|
|
6242
6282
|
]
|
|
6243
6283
|
});
|
|
6244
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);
|
|
6245
6609
|
// src/EffectScopeSelect/index.tsx
|
|
6246
|
-
import { memo as memo33, useCallback as
|
|
6247
|
-
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";
|
|
6248
6612
|
import { useUpdateEffect as useUpdateEffect14 } from "react-use";
|
|
6249
6613
|
// src/EffectScopeSelect/ScopeViewMode.tsx
|
|
6250
6614
|
import { memo as memo32 } from "react";
|
|
6251
|
-
import { Space as
|
|
6252
|
-
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";
|
|
6253
6617
|
var ScopeViewMode = memo32(function(props) {
|
|
6254
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;
|
|
6255
6619
|
var items = [];
|
|
@@ -6273,18 +6637,18 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6273
6637
|
label: "SKU",
|
|
6274
6638
|
value: skuName || String(skuId)
|
|
6275
6639
|
});
|
|
6276
|
-
if (items.length === 0) return /* @__PURE__ */
|
|
6640
|
+
if (items.length === 0) return /* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6277
6641
|
style: {
|
|
6278
6642
|
fontSize: 14
|
|
6279
6643
|
},
|
|
6280
6644
|
type: "danger",
|
|
6281
6645
|
children: "\u8BF7\u5148\u9009\u62E9\u54C1\u7C7B\u4FE1\u606F"
|
|
6282
6646
|
});
|
|
6283
|
-
return /* @__PURE__ */
|
|
6647
|
+
return /* @__PURE__ */ jsx43(Space4, {
|
|
6284
6648
|
size: 4,
|
|
6285
6649
|
children: items.map(function(param) {
|
|
6286
6650
|
var label = param.label, value = param.value;
|
|
6287
|
-
return /* @__PURE__ */
|
|
6651
|
+
return /* @__PURE__ */ jsxs20(Space4, {
|
|
6288
6652
|
size: 4,
|
|
6289
6653
|
style: {
|
|
6290
6654
|
height: 32,
|
|
@@ -6292,7 +6656,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6292
6656
|
borderRadius: 6
|
|
6293
6657
|
},
|
|
6294
6658
|
children: [
|
|
6295
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsxs20(Typography6.Text, {
|
|
6296
6660
|
style: {
|
|
6297
6661
|
fontSize: 14,
|
|
6298
6662
|
paddingRight: 16
|
|
@@ -6302,7 +6666,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6302
6666
|
":"
|
|
6303
6667
|
]
|
|
6304
6668
|
}),
|
|
6305
|
-
/* @__PURE__ */
|
|
6669
|
+
/* @__PURE__ */ jsx43(Typography6.Text, {
|
|
6306
6670
|
style: {
|
|
6307
6671
|
fontSize: 14
|
|
6308
6672
|
},
|
|
@@ -6314,7 +6678,7 @@ var ScopeViewMode = memo32(function(props) {
|
|
|
6314
6678
|
});
|
|
6315
6679
|
});
|
|
6316
6680
|
// src/EffectScopeSelect/index.tsx
|
|
6317
|
-
import { jsx as
|
|
6681
|
+
import { jsx as jsx44, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6318
6682
|
var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
6319
6683
|
ScopeLevelEnum2[ScopeLevelEnum2["CATEGORY"] = 1] = "CATEGORY";
|
|
6320
6684
|
ScopeLevelEnum2[ScopeLevelEnum2["BRAND"] = 2] = "BRAND";
|
|
@@ -6325,8 +6689,8 @@ var ScopeLevelEnum = /* @__PURE__ */ function(ScopeLevelEnum2) {
|
|
|
6325
6689
|
}(ScopeLevelEnum || {});
|
|
6326
6690
|
var EffectScopeSelect = memo33(function(props) {
|
|
6327
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;
|
|
6328
|
-
var
|
|
6329
|
-
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() {
|
|
6330
6694
|
var _value_categoryIds;
|
|
6331
6695
|
return (_value_categoryIds = value.categoryIds) === null || _value_categoryIds === void 0 ? void 0 : _value_categoryIds[value.categoryIds.length - 1];
|
|
6332
6696
|
}, [
|
|
@@ -6337,14 +6701,14 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6337
6701
|
}, [
|
|
6338
6702
|
controlledValue
|
|
6339
6703
|
]);
|
|
6340
|
-
var handleChange =
|
|
6704
|
+
var handleChange = useCallback24(function(newValue) {
|
|
6341
6705
|
setTimeout(function() {
|
|
6342
6706
|
return onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
6343
6707
|
}, 0);
|
|
6344
6708
|
}, [
|
|
6345
6709
|
onChange
|
|
6346
6710
|
]);
|
|
6347
|
-
var handleCategoryChange =
|
|
6711
|
+
var handleCategoryChange = useCallback24(function(_values, selectedList) {
|
|
6348
6712
|
if (!selectedList || !isSingleTreeSelected(selectedList)) {
|
|
6349
6713
|
handleChange === null || handleChange === void 0 ? void 0 : handleChange();
|
|
6350
6714
|
return;
|
|
@@ -6363,7 +6727,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6363
6727
|
handleChange,
|
|
6364
6728
|
requireLevel
|
|
6365
6729
|
]);
|
|
6366
|
-
var handleBrandChange =
|
|
6730
|
+
var handleBrandChange = useCallback24(function(brandValue) {
|
|
6367
6731
|
var brandId = brandValue === void 0 ? void 0 : Number(brandValue);
|
|
6368
6732
|
setValue(function(prev) {
|
|
6369
6733
|
var newScope = {
|
|
@@ -6379,7 +6743,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6379
6743
|
handleChange,
|
|
6380
6744
|
requireLevel
|
|
6381
6745
|
]);
|
|
6382
|
-
var handleSeriesChange =
|
|
6746
|
+
var handleSeriesChange = useCallback24(function(seriesValue) {
|
|
6383
6747
|
var seriesId = seriesValue === void 0 ? void 0 : Number(seriesValue);
|
|
6384
6748
|
setValue(function(prev) {
|
|
6385
6749
|
var newScope = {
|
|
@@ -6396,7 +6760,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6396
6760
|
handleChange,
|
|
6397
6761
|
requireLevel
|
|
6398
6762
|
]);
|
|
6399
|
-
var handleSpuChange =
|
|
6763
|
+
var handleSpuChange = useCallback24(function(spuValue) {
|
|
6400
6764
|
var spuId = spuValue === void 0 ? void 0 : Number(spuValue);
|
|
6401
6765
|
setValue(function(prev) {
|
|
6402
6766
|
var newScope = {
|
|
@@ -6414,7 +6778,7 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6414
6778
|
handleChange,
|
|
6415
6779
|
requireLevel
|
|
6416
6780
|
]);
|
|
6417
|
-
var handleSkuChange =
|
|
6781
|
+
var handleSkuChange = useCallback24(function(skuValue) {
|
|
6418
6782
|
var skuId = skuValue === void 0 ? void 0 : Number(skuValue);
|
|
6419
6783
|
setValue(function(prev) {
|
|
6420
6784
|
var newScope = _object_spread_props(_object_spread({}, prev), {
|
|
@@ -6429,18 +6793,18 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6429
6793
|
handleChange,
|
|
6430
6794
|
requireLevel
|
|
6431
6795
|
]);
|
|
6432
|
-
var renderLabel =
|
|
6433
|
-
return /* @__PURE__ */
|
|
6796
|
+
var renderLabel = useCallback24(function(label, required) {
|
|
6797
|
+
return /* @__PURE__ */ jsx44(Flex3, {
|
|
6434
6798
|
flex: "0 0 auto",
|
|
6435
|
-
children: /* @__PURE__ */
|
|
6799
|
+
children: /* @__PURE__ */ jsxs21(Space5, {
|
|
6436
6800
|
children: [
|
|
6437
|
-
required && /* @__PURE__ */
|
|
6801
|
+
required && /* @__PURE__ */ jsx44("span", {
|
|
6438
6802
|
style: {
|
|
6439
6803
|
color: "var(--ant-color-error)"
|
|
6440
6804
|
},
|
|
6441
6805
|
children: "*"
|
|
6442
6806
|
}),
|
|
6443
|
-
/* @__PURE__ */
|
|
6807
|
+
/* @__PURE__ */ jsxs21("span", {
|
|
6444
6808
|
children: [
|
|
6445
6809
|
label,
|
|
6446
6810
|
":"
|
|
@@ -6451,34 +6815,34 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6451
6815
|
});
|
|
6452
6816
|
}, []);
|
|
6453
6817
|
if (mode === "view") {
|
|
6454
|
-
return /* @__PURE__ */
|
|
6818
|
+
return /* @__PURE__ */ jsx44(ScopeViewMode, _object_spread({}, value));
|
|
6455
6819
|
}
|
|
6456
|
-
return /* @__PURE__ */
|
|
6820
|
+
return /* @__PURE__ */ jsxs21(Flex3, {
|
|
6457
6821
|
justify: "flex-start",
|
|
6458
6822
|
align: "center",
|
|
6459
6823
|
wrap: "nowrap",
|
|
6460
6824
|
gap: "15px",
|
|
6461
6825
|
children: [
|
|
6462
|
-
/* @__PURE__ */
|
|
6826
|
+
/* @__PURE__ */ jsxs21(Flex3, {
|
|
6463
6827
|
align: "center",
|
|
6464
6828
|
gap: "5px",
|
|
6465
6829
|
flex: "0 0 auto",
|
|
6466
6830
|
children: [
|
|
6467
6831
|
renderLabel("\u5206\u7C7B", requireLevel >= 1 /* CATEGORY */ ),
|
|
6468
|
-
/* @__PURE__ */
|
|
6832
|
+
/* @__PURE__ */ jsx44(EffectCategoryCascade, {
|
|
6469
6833
|
onChange: handleCategoryChange,
|
|
6470
6834
|
changeOnSelect: categoryChangeOnSelect,
|
|
6471
6835
|
value: value.categoryIds
|
|
6472
6836
|
})
|
|
6473
6837
|
]
|
|
6474
6838
|
}),
|
|
6475
|
-
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */
|
|
6839
|
+
lastLevelCategoryId && scopeLevel >= 2 /* BRAND */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6476
6840
|
align: "center",
|
|
6477
6841
|
gap: "5px",
|
|
6478
6842
|
flex: "0 0 auto",
|
|
6479
6843
|
children: [
|
|
6480
6844
|
renderLabel("\u54C1\u724C", requireLevel >= 2 /* BRAND */ ),
|
|
6481
|
-
/* @__PURE__ */
|
|
6845
|
+
/* @__PURE__ */ jsx44(EffectBrandSelect, _object_spread_props(_object_spread({
|
|
6482
6846
|
categoryId: lastLevelCategoryId
|
|
6483
6847
|
}, value), {
|
|
6484
6848
|
onChange: handleBrandChange,
|
|
@@ -6486,13 +6850,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6486
6850
|
}))
|
|
6487
6851
|
]
|
|
6488
6852
|
}),
|
|
6489
|
-
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */
|
|
6853
|
+
!!value.brandId && scopeLevel >= 3 /* SERIES */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6490
6854
|
align: "center",
|
|
6491
6855
|
gap: "5px",
|
|
6492
6856
|
flex: "0 0 auto",
|
|
6493
6857
|
children: [
|
|
6494
6858
|
renderLabel("\u7CFB\u5217", requireLevel >= 3 /* SERIES */ ),
|
|
6495
|
-
/* @__PURE__ */
|
|
6859
|
+
/* @__PURE__ */ jsx44(EffectSeriesSelect, _object_spread_props(_object_spread({
|
|
6496
6860
|
categoryId: lastLevelCategoryId
|
|
6497
6861
|
}, value), {
|
|
6498
6862
|
onChange: handleSeriesChange,
|
|
@@ -6500,13 +6864,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6500
6864
|
}))
|
|
6501
6865
|
]
|
|
6502
6866
|
}),
|
|
6503
|
-
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */
|
|
6867
|
+
!!value.seriesId && scopeLevel >= 4 /* SPU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6504
6868
|
align: "center",
|
|
6505
6869
|
gap: "5px",
|
|
6506
6870
|
flex: "0 0 auto",
|
|
6507
6871
|
children: [
|
|
6508
6872
|
renderLabel("SPU", requireLevel >= 4 /* SPU */ ),
|
|
6509
|
-
/* @__PURE__ */
|
|
6873
|
+
/* @__PURE__ */ jsx44(EffectSpuSelect, _object_spread_props(_object_spread({
|
|
6510
6874
|
categoryId: lastLevelCategoryId
|
|
6511
6875
|
}, value), {
|
|
6512
6876
|
onChange: handleSpuChange,
|
|
@@ -6514,13 +6878,13 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6514
6878
|
}))
|
|
6515
6879
|
]
|
|
6516
6880
|
}),
|
|
6517
|
-
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */
|
|
6881
|
+
!!value.spuId && scopeLevel >= 5 /* SKU */ && /* @__PURE__ */ jsxs21(Flex3, {
|
|
6518
6882
|
align: "center",
|
|
6519
6883
|
gap: "5px",
|
|
6520
6884
|
flex: "0 0 auto",
|
|
6521
6885
|
children: [
|
|
6522
6886
|
renderLabel("SKU", requireLevel >= 5 /* SKU */ ),
|
|
6523
|
-
/* @__PURE__ */
|
|
6887
|
+
/* @__PURE__ */ jsx44(EffectSkuSelect, _object_spread_props(_object_spread({
|
|
6524
6888
|
categoryId: lastLevelCategoryId
|
|
6525
6889
|
}, value), {
|
|
6526
6890
|
onChange: handleSkuChange,
|
|
@@ -6532,22 +6896,22 @@ var EffectScopeSelect = memo33(function(props) {
|
|
|
6532
6896
|
});
|
|
6533
6897
|
});
|
|
6534
6898
|
// src/EffectStaffSelect/index.tsx
|
|
6535
|
-
import { memo as memo34, useCallback as
|
|
6899
|
+
import { memo as memo34, useCallback as useCallback25, useEffect as useEffect23, useState as useState28 } from "react";
|
|
6536
6900
|
import { useAsyncFn as useAsyncFn4, useMount as useMount5, useUpdateEffect as useUpdateEffect15 } from "react-use";
|
|
6537
|
-
import
|
|
6538
|
-
import { Select as
|
|
6901
|
+
import classnames13 from "classnames";
|
|
6902
|
+
import { Select as Select9 } from "antd";
|
|
6539
6903
|
import { debounce as debounce7 } from "@xfe-repo/web-utils/tools";
|
|
6540
6904
|
// src/EffectStaffSelect/index.module.less
|
|
6541
|
-
var
|
|
6905
|
+
var index_module_default19 = {
|
|
6542
6906
|
select: "index_module_select4"
|
|
6543
6907
|
};
|
|
6544
6908
|
// src/EffectStaffSelect/index.tsx
|
|
6545
|
-
import { jsx as
|
|
6909
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
6546
6910
|
var EffectStaffSelect = memo34(function(props) {
|
|
6547
6911
|
var _state_value_data, _state_value;
|
|
6548
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;
|
|
6549
|
-
var
|
|
6550
|
-
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];
|
|
6551
6915
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6552
6916
|
var getBusinessOptions = function getBusinessOptions(businessName, currentDeptId) {
|
|
6553
6917
|
return _async_to_generator(function() {
|
|
@@ -6581,10 +6945,10 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6581
6945
|
deptId,
|
|
6582
6946
|
config
|
|
6583
6947
|
]), 2), state = _useAsyncFn4[0], searchFetch = _useAsyncFn4[1];
|
|
6584
|
-
var debounceSearchFetch =
|
|
6948
|
+
var debounceSearchFetch = useCallback25(debounce7(600, searchFetch), [
|
|
6585
6949
|
searchFetch
|
|
6586
6950
|
]);
|
|
6587
|
-
|
|
6951
|
+
useEffect23(function() {
|
|
6588
6952
|
var _state_value_data, _state_value;
|
|
6589
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)) {
|
|
6590
6954
|
return;
|
|
@@ -6639,8 +7003,8 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6639
7003
|
}
|
|
6640
7004
|
};
|
|
6641
7005
|
var defaultPlaceholder = deptId ? "\u8BF7\u9009\u62E9\u5458\u5DE5\u59D3\u540D" : "\u8BF7\u5148\u8F93\u5165\u5458\u5DE5\u59D3\u540D";
|
|
6642
|
-
return /* @__PURE__ */
|
|
6643
|
-
className:
|
|
7006
|
+
return /* @__PURE__ */ jsx45(Select9, {
|
|
7007
|
+
className: classnames13(index_module_default19.select, className),
|
|
6644
7008
|
style: style,
|
|
6645
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,
|
|
6646
7010
|
placeholder: placeholder || defaultPlaceholder,
|
|
@@ -6658,14 +7022,14 @@ var EffectStaffSelect = memo34(function(props) {
|
|
|
6658
7022
|
});
|
|
6659
7023
|
});
|
|
6660
7024
|
// src/EffectReservoirSelect/EffectReservoirSelect.tsx
|
|
6661
|
-
import { memo as memo35, useEffect as
|
|
7025
|
+
import { memo as memo35, useEffect as useEffect24, useState as useState29 } from "react";
|
|
6662
7026
|
import { useAsyncFn as useAsyncFn5, useMount as useMount6, usePrevious as usePrevious7, useUpdateEffect as useUpdateEffect16 } from "react-use";
|
|
6663
|
-
import { Select as
|
|
6664
|
-
import { jsx as
|
|
7027
|
+
import { Select as Select10 } from "antd";
|
|
7028
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
6665
7029
|
var EffectReservoirSelect = memo35(function(props) {
|
|
6666
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;
|
|
6667
|
-
var
|
|
6668
|
-
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];
|
|
6669
7033
|
var prevControlValue = usePrevious7(controlValue);
|
|
6670
7034
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6671
7035
|
var get_reservoir_options = function get_reservoir_options() {
|
|
@@ -6698,7 +7062,7 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6698
7062
|
var _useAsyncFn5 = _sliced_to_array(useAsyncFn5(get_reservoir_options, [
|
|
6699
7063
|
warehouseId
|
|
6700
7064
|
]), 2), state = _useAsyncFn5[0], fetch = _useAsyncFn5[1];
|
|
6701
|
-
|
|
7065
|
+
useEffect24(function() {
|
|
6702
7066
|
var _state_value;
|
|
6703
7067
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6704
7068
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6749,20 +7113,20 @@ var EffectReservoirSelect = memo35(function(props) {
|
|
|
6749
7113
|
onChange: handleOnChange,
|
|
6750
7114
|
loading: state.loading
|
|
6751
7115
|
};
|
|
6752
|
-
return /* @__PURE__ */
|
|
7116
|
+
return /* @__PURE__ */ jsx46(Select10, _object_spread({
|
|
6753
7117
|
className: className
|
|
6754
7118
|
}, selectBrandProps));
|
|
6755
7119
|
});
|
|
6756
7120
|
// src/EffectReservoirSelect/EffectShelveSelect.tsx
|
|
6757
|
-
import { memo as memo36, useEffect as
|
|
7121
|
+
import { memo as memo36, useEffect as useEffect25, useState as useState30 } from "react";
|
|
6758
7122
|
import { useAsyncFn as useAsyncFn6, useMount as useMount7, usePrevious as usePrevious8, useUpdateEffect as useUpdateEffect17 } from "react-use";
|
|
6759
|
-
import { Select as
|
|
6760
|
-
import { jsx as
|
|
7123
|
+
import { Select as Select11 } from "antd";
|
|
7124
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6761
7125
|
var EffectShelveSelect = memo36(function(props) {
|
|
6762
7126
|
var onChange = props.onChange, className = props.className, defaultValue = props.defaultValue, controlValue = props.value, disabled = props.disabled, warehouseId = props.warehouseId, reservoirId = props.reservoirId;
|
|
6763
7127
|
var _props_valueType = props.valueType, valueType = _props_valueType === void 0 ? "code" : _props_valueType;
|
|
6764
|
-
var
|
|
6765
|
-
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];
|
|
6766
7130
|
var prevControlValue = usePrevious8(controlValue);
|
|
6767
7131
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6768
7132
|
var get_shelve_options = function get_shelve_options() {
|
|
@@ -6796,7 +7160,7 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6796
7160
|
reservoirId,
|
|
6797
7161
|
warehouseId
|
|
6798
7162
|
]), 2), state = _useAsyncFn6[0], fetch = _useAsyncFn6[1];
|
|
6799
|
-
|
|
7163
|
+
useEffect25(function() {
|
|
6800
7164
|
var _state_value;
|
|
6801
7165
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6802
7166
|
var options2 = state.value.data.list.map(function(param) {
|
|
@@ -6849,16 +7213,16 @@ var EffectShelveSelect = memo36(function(props) {
|
|
|
6849
7213
|
onChange: handleOnChange,
|
|
6850
7214
|
loading: state.loading
|
|
6851
7215
|
};
|
|
6852
|
-
return /* @__PURE__ */
|
|
7216
|
+
return /* @__PURE__ */ jsx47(Select11, _object_spread({
|
|
6853
7217
|
className: className
|
|
6854
7218
|
}, selectBrandProps));
|
|
6855
7219
|
});
|
|
6856
7220
|
// src/EffectWarehouseSelect/index.tsx
|
|
6857
|
-
import { Select as
|
|
6858
|
-
import
|
|
7221
|
+
import { Select as Select12 } from "antd";
|
|
7222
|
+
import classnames14 from "classnames";
|
|
6859
7223
|
import { memo as memo37 } from "react";
|
|
6860
7224
|
// src/EffectWarehouseSelect/useStoreOptions.ts
|
|
6861
|
-
import
|
|
7225
|
+
import useSWRImmutable8 from "swr/immutable";
|
|
6862
7226
|
var transformStoreData = function transformStoreData() {
|
|
6863
7227
|
var list = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
6864
7228
|
return list.map(function(item) {
|
|
@@ -6871,7 +7235,7 @@ var transformStoreData = function transformStoreData() {
|
|
|
6871
7235
|
function useStoreOptions() {
|
|
6872
7236
|
var currentMerchantOnly = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true, warehouseType = arguments.length > 1 ? arguments[1] : void 0;
|
|
6873
7237
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6874
|
-
var
|
|
7238
|
+
var _useSWRImmutable8 = useSWRImmutable8([
|
|
6875
7239
|
"warehouse/store/combo-box",
|
|
6876
7240
|
currentMerchantOnly,
|
|
6877
7241
|
warehouseType
|
|
@@ -6906,7 +7270,7 @@ function useStoreOptions() {
|
|
|
6906
7270
|
retryCount: 3,
|
|
6907
7271
|
dedupingInterval: 5e3,
|
|
6908
7272
|
fallback: []
|
|
6909
|
-
}), data =
|
|
7273
|
+
}), data = _useSWRImmutable8.data, error = _useSWRImmutable8.error, isLoading = _useSWRImmutable8.isLoading, mutate = _useSWRImmutable8.mutate;
|
|
6910
7274
|
return {
|
|
6911
7275
|
data: data,
|
|
6912
7276
|
error: error,
|
|
@@ -6915,11 +7279,11 @@ function useStoreOptions() {
|
|
|
6915
7279
|
};
|
|
6916
7280
|
}
|
|
6917
7281
|
// src/EffectWarehouseSelect/index.module.less
|
|
6918
|
-
var
|
|
7282
|
+
var index_module_default20 = {
|
|
6919
7283
|
select: "index_module_select5"
|
|
6920
7284
|
};
|
|
6921
7285
|
// src/EffectWarehouseSelect/index.tsx
|
|
6922
|
-
import { jsx as
|
|
7286
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
6923
7287
|
var EffectWarehouseSelect = memo37(function(props) {
|
|
6924
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;
|
|
6925
7289
|
var state = useStoreOptions(currentMerchantOnly, warehouseType);
|
|
@@ -6930,8 +7294,8 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6930
7294
|
var handleClear = function handleClear() {
|
|
6931
7295
|
onChange === null || onChange === void 0 ? void 0 : onChange(void 0, void 0);
|
|
6932
7296
|
};
|
|
6933
|
-
return /* @__PURE__ */
|
|
6934
|
-
className:
|
|
7297
|
+
return /* @__PURE__ */ jsx48(Select12, {
|
|
7298
|
+
className: classnames14(index_module_default20.select, className),
|
|
6935
7299
|
placeholder: "\u8BF7\u9009\u62E9\u4ED3\u5E93",
|
|
6936
7300
|
notFoundContent: state.isLoading ? "\u52A0\u8F7D\u4E2D..." : "\u6682\u65E0\u4ED3\u5E93\u6570\u636E",
|
|
6937
7301
|
loading: state.isLoading,
|
|
@@ -6943,22 +7307,22 @@ var EffectWarehouseSelect = memo37(function(props) {
|
|
|
6943
7307
|
});
|
|
6944
7308
|
});
|
|
6945
7309
|
// src/EffectAddressCascade/index.tsx
|
|
6946
|
-
import { memo as memo38, useEffect as
|
|
7310
|
+
import { memo as memo38, useEffect as useEffect26, useState as useState31 } from "react";
|
|
6947
7311
|
import { useAsyncFn as useAsyncFn7, useMount as useMount8 } from "react-use";
|
|
6948
|
-
import
|
|
7312
|
+
import classnames15 from "classnames";
|
|
6949
7313
|
// src/EffectAddressCascade/index.module.less
|
|
6950
|
-
var
|
|
7314
|
+
var index_module_default21 = {
|
|
6951
7315
|
input: "index_module_input7",
|
|
6952
7316
|
select: "index_module_select6"
|
|
6953
7317
|
};
|
|
6954
7318
|
// src/EffectAddressCascade/index.tsx
|
|
6955
7319
|
import { Cascader as Cascader2 } from "antd";
|
|
6956
|
-
import { jsx as
|
|
7320
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
6957
7321
|
var EffectAddressCascade = memo38(function(props) {
|
|
6958
7322
|
var _selectedList_;
|
|
6959
7323
|
var className = props.className, disabled = props.disabled, defaultValue = props.defaultValue, onChange = props.onChange;
|
|
6960
|
-
var
|
|
6961
|
-
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];
|
|
6962
7326
|
var _useRequestConfig = useRequestConfig(), config = _useRequestConfig.config, apiService = _useRequestConfig.apiService;
|
|
6963
7327
|
var params = {
|
|
6964
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) || ""
|
|
@@ -6984,7 +7348,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
6984
7348
|
var _useAsyncFn7 = _sliced_to_array(useAsyncFn7(getAddress, [
|
|
6985
7349
|
selectedList
|
|
6986
7350
|
]), 2), state = _useAsyncFn7[0], getAddressFetch = _useAsyncFn7[1];
|
|
6987
|
-
|
|
7351
|
+
useEffect26(function() {
|
|
6988
7352
|
var _state_value;
|
|
6989
7353
|
if (state.loading || !((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.data.list)) return;
|
|
6990
7354
|
var list = state.value.data.list;
|
|
@@ -7022,7 +7386,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7022
7386
|
}, [
|
|
7023
7387
|
state
|
|
7024
7388
|
]);
|
|
7025
|
-
|
|
7389
|
+
useEffect26(function() {
|
|
7026
7390
|
if (!state.loading || !customTree || !selectedList) return;
|
|
7027
7391
|
var target = findTargetLeaf(selectedList, customTree);
|
|
7028
7392
|
if (!target) return;
|
|
@@ -7034,7 +7398,7 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7034
7398
|
useMount8(function() {
|
|
7035
7399
|
void getAddressFetch();
|
|
7036
7400
|
});
|
|
7037
|
-
|
|
7401
|
+
useEffect26(function() {
|
|
7038
7402
|
var target = findTargetLeaf(selectedList || [], customTree || []);
|
|
7039
7403
|
if ((target === null || target === void 0 ? void 0 : target.isLeaf) || !(selectedList === null || selectedList === void 0 ? void 0 : selectedList.length)) return;
|
|
7040
7404
|
void getAddressFetch();
|
|
@@ -7050,8 +7414,8 @@ var EffectAddressCascade = memo38(function(props) {
|
|
|
7050
7414
|
setSelectedList(_selectedList);
|
|
7051
7415
|
if (onChange) onChange(_selectedList);
|
|
7052
7416
|
};
|
|
7053
|
-
return /* @__PURE__ */
|
|
7054
|
-
className:
|
|
7417
|
+
return /* @__PURE__ */ jsx49(Cascader2, {
|
|
7418
|
+
className: classnames15(index_module_default21.input, className),
|
|
7055
7419
|
disabled: disabled,
|
|
7056
7420
|
defaultValue: defaultValue,
|
|
7057
7421
|
multiple: false,
|
|
@@ -7085,11 +7449,11 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7085
7449
|
});
|
|
7086
7450
|
};
|
|
7087
7451
|
// src/EffectLabelSelect/index.tsx
|
|
7088
|
-
import { memo as memo39, useEffect as
|
|
7452
|
+
import { memo as memo39, useEffect as useEffect27, useState as useState32 } from "react";
|
|
7089
7453
|
import { useUpdateEffect as useUpdateEffect18 } from "react-use";
|
|
7090
|
-
import
|
|
7454
|
+
import classnames16 from "classnames";
|
|
7091
7455
|
// src/EffectLabelSelect/hooks.ts
|
|
7092
|
-
import { useAsyncFn as useAsyncFn8, useDebounce } from "react-use";
|
|
7456
|
+
import { useAsyncFn as useAsyncFn8, useDebounce as useDebounce2 } from "react-use";
|
|
7093
7457
|
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7094
7458
|
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7095
7459
|
var reqDataFn = function reqDataFn() {
|
|
@@ -7113,7 +7477,7 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7113
7477
|
var _useAsyncFn8 = _sliced_to_array(useAsyncFn8(reqDataFn, [
|
|
7114
7478
|
dependency
|
|
7115
7479
|
]), 2), resState = _useAsyncFn8[0], fetchData = _useAsyncFn8[1];
|
|
7116
|
-
|
|
7480
|
+
useDebounce2(function() {
|
|
7117
7481
|
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7118
7482
|
if (shouldFetchData) {
|
|
7119
7483
|
void fetchData();
|
|
@@ -7127,41 +7491,42 @@ var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
|
7127
7491
|
];
|
|
7128
7492
|
};
|
|
7129
7493
|
// src/EffectLabelSelect/index.module.less
|
|
7130
|
-
var
|
|
7494
|
+
var index_module_default22 = {
|
|
7131
7495
|
select_wrap: "index_module_select_wrap",
|
|
7132
7496
|
select_label: "index_module_select_label",
|
|
7133
|
-
value_select: "
|
|
7497
|
+
value_select: "index_module_value_select2",
|
|
7134
7498
|
select: "index_module_select7"
|
|
7135
7499
|
};
|
|
7136
7500
|
// src/EffectLabelSelect/index.tsx
|
|
7137
|
-
import { Select as
|
|
7138
|
-
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";
|
|
7139
7503
|
var EffectLabelSelect = memo39(function(props) {
|
|
7140
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;
|
|
7141
7505
|
var apiService = useRequestConfig().apiService;
|
|
7142
|
-
var
|
|
7506
|
+
var _useState32 = _sliced_to_array(useState32(function() {
|
|
7143
7507
|
var _transformObj2Options_, _transformObj2Options;
|
|
7144
7508
|
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7145
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;
|
|
7146
7510
|
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7147
|
-
}), 2), curSelectLabel =
|
|
7148
|
-
var
|
|
7149
|
-
var
|
|
7150
|
-
var
|
|
7151
|
-
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];
|
|
7152
7516
|
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7153
7517
|
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7154
7518
|
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7155
7519
|
page: 1,
|
|
7156
7520
|
pageSize: 20
|
|
7157
7521
|
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7158
|
-
|
|
7522
|
+
useEffect27(function() {
|
|
7159
7523
|
var _resState_value;
|
|
7160
7524
|
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7161
7525
|
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7162
7526
|
setOptionsData(optionsData2);
|
|
7163
7527
|
}, [
|
|
7164
|
-
resState
|
|
7528
|
+
resState.loading,
|
|
7529
|
+
resState.value
|
|
7165
7530
|
]);
|
|
7166
7531
|
useUpdateEffect18(function() {
|
|
7167
7532
|
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
@@ -7192,7 +7557,7 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7192
7557
|
setOptionsData([]);
|
|
7193
7558
|
};
|
|
7194
7559
|
var selectLabelProps = {
|
|
7195
|
-
className:
|
|
7560
|
+
className: index_module_default22.select_label,
|
|
7196
7561
|
disabled: disabled,
|
|
7197
7562
|
defaultValue: curSelectLabel,
|
|
7198
7563
|
options: transformObj2Options(labelDic),
|
|
@@ -7208,7 +7573,7 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7208
7573
|
});
|
|
7209
7574
|
}) : optionsData;
|
|
7210
7575
|
var selectValueProps = {
|
|
7211
|
-
className:
|
|
7576
|
+
className: classnames16(index_module_default22.value_select, className),
|
|
7212
7577
|
notFoundContent: notFoundContent,
|
|
7213
7578
|
value: mergedValue,
|
|
7214
7579
|
options: mergedOptionsData,
|
|
@@ -7225,12 +7590,12 @@ var EffectLabelSelect = memo39(function(props) {
|
|
|
7225
7590
|
filterOption: false,
|
|
7226
7591
|
popupMatchSelectWidth: false
|
|
7227
7592
|
};
|
|
7228
|
-
return /* @__PURE__ */
|
|
7229
|
-
className:
|
|
7593
|
+
return /* @__PURE__ */ jsxs22(Space6.Compact, {
|
|
7594
|
+
className: index_module_default22.select_wrap,
|
|
7230
7595
|
style: style,
|
|
7231
7596
|
children: [
|
|
7232
|
-
/* @__PURE__ */
|
|
7233
|
-
/* @__PURE__ */
|
|
7597
|
+
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectLabelProps)),
|
|
7598
|
+
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectValueProps))
|
|
7234
7599
|
]
|
|
7235
7600
|
});
|
|
7236
7601
|
});
|
|
@@ -7313,4 +7678,4 @@ var getSecondValue = function getSecondValue() {
|
|
|
7313
7678
|
var _this;
|
|
7314
7679
|
return (_this = (str === null || str === void 0 ? void 0 : str.includes("-")) ? str.split("-")[1] : str) === null || _this === void 0 ? void 0 : _this.trim();
|
|
7315
7680
|
};
|
|
7316
|
-
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 };
|