@xfe-repo/web-components 1.8.1 → 1.8.3
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 +1 -18
- package/dist/index.d.mts +2 -41
- package/dist/index.d.ts +2 -41
- package/dist/index.js +20 -266
- package/dist/index.mjs +21 -243
- package/package.json +4 -4
- package/skills/xfe-web-components/GUIDE.md +0 -1
- package/skills/xfe-web-components/SKILL.md +0 -1
- package/skills/xfe-web-components/references/EffectSearchSelect.md +0 -2
- package/skills/xfe-web-components/references/commonFn.md +0 -84
- package/skills/xfe-web-components/references/EffectLabelSelect.md +0 -223
package/dist/index.css
CHANGED
|
@@ -572,6 +572,7 @@
|
|
|
572
572
|
.index_module_selector {
|
|
573
573
|
flex: 1;
|
|
574
574
|
width: 100%;
|
|
575
|
+
max-width: 400px;
|
|
575
576
|
overflow: hidden;
|
|
576
577
|
}
|
|
577
578
|
.index_module_selector .ant-select-selector {
|
|
@@ -613,21 +614,3 @@
|
|
|
613
614
|
.index_module_select6 {
|
|
614
615
|
width: auto;
|
|
615
616
|
}
|
|
616
|
-
|
|
617
|
-
/* src/EffectLabelSelect/index.module.less */
|
|
618
|
-
.index_module_select_wrap {
|
|
619
|
-
display: flex;
|
|
620
|
-
}
|
|
621
|
-
.index_module_select_wrap .index_module_select_label {
|
|
622
|
-
width: 85px !important;
|
|
623
|
-
}
|
|
624
|
-
.index_module_select_wrap .index_module_select_label .ant-select-selector {
|
|
625
|
-
border-right: none !important;
|
|
626
|
-
}
|
|
627
|
-
.index_module_value_select2 {
|
|
628
|
-
width: calc(100% - 85px) !important;
|
|
629
|
-
min-width: 0;
|
|
630
|
-
}
|
|
631
|
-
.index_module_select7 {
|
|
632
|
-
width: auto;
|
|
633
|
-
}
|
package/dist/index.d.mts
CHANGED
|
@@ -407,6 +407,7 @@ declare class MerchantListBus {
|
|
|
407
407
|
legalPersonCardFrontImage: string;
|
|
408
408
|
legalPersonCardBackImage: string;
|
|
409
409
|
contactName: string;
|
|
410
|
+
phone: string;
|
|
410
411
|
contactPhone: string;
|
|
411
412
|
contactPosition: string;
|
|
412
413
|
serviceBuy: number;
|
|
@@ -1281,44 +1282,4 @@ type Props = {
|
|
|
1281
1282
|
};
|
|
1282
1283
|
declare const EffectAddressCascade: React__default.MemoExoticComponent<(props: Props) => react_jsx_runtime.JSX.Element>;
|
|
1283
1284
|
|
|
1284
|
-
type
|
|
1285
|
-
value: string;
|
|
1286
|
-
label: string;
|
|
1287
|
-
customFields?: Record<string, unknown> | null;
|
|
1288
|
-
};
|
|
1289
|
-
type LabelDic = Record<string, string>;
|
|
1290
|
-
interface EffectLabelSelectProps extends Omit<SelectProps$1, 'onChange'> {
|
|
1291
|
-
onChange?: (value?: string, selectedOptionItem?: SelectOptionItem) => void;
|
|
1292
|
-
defaultLabel?: string;
|
|
1293
|
-
labelDic?: LabelDic;
|
|
1294
|
-
value?: string;
|
|
1295
|
-
customLabelInValue?: boolean;
|
|
1296
|
-
onFetchData?: (params: any, config: any) => Promise<any>;
|
|
1297
|
-
onTransformData?: (params: Record<string, string>) => SelectOptionItem;
|
|
1298
|
-
fetchParams?: Record<string, unknown>;
|
|
1299
|
-
optionsDisplayType?: 'labelAndValue';
|
|
1300
|
-
}
|
|
1301
|
-
/** @deprecated 已废弃,请使用 EffectSearchSelect */
|
|
1302
|
-
declare const EffectLabelSelect: FunctionComponent<EffectLabelSelectProps>;
|
|
1303
|
-
/**
|
|
1304
|
-
*
|
|
1305
|
-
* 返回类型 格式为:
|
|
1306
|
-
* 类型('value' | 'label') + ID(value) + 名称(label) + labelDicKey(映射labelDic的key)
|
|
1307
|
-
*
|
|
1308
|
-
* eg: label;123;哈哈;name
|
|
1309
|
-
* value;123;哈哈;name
|
|
1310
|
-
*
|
|
1311
|
-
* eg: label;111;哈哈;businessNo
|
|
1312
|
-
* value;111;哈哈;businessNo
|
|
1313
|
-
*
|
|
1314
|
-
* eg: label;13200001111;13200001111;phone
|
|
1315
|
-
* value;13200001111;13200001111;phone
|
|
1316
|
-
*/
|
|
1317
|
-
declare const getStrValue: (displayType: "label" | "value", value?: string, label?: string, labelDicKey?: string) => string | undefined;
|
|
1318
|
-
type SelectValueDisplayType = 'label' | 'value' | 'labelDicKey' | 'labelAndValue';
|
|
1319
|
-
declare const getSelectValue: (str?: string | null | number, returnType?: SelectValueDisplayType) => string | undefined;
|
|
1320
|
-
declare const getInitialValue: (label?: string, value?: string) => string;
|
|
1321
|
-
declare const getFirstValue: (str?: string) => string | undefined;
|
|
1322
|
-
declare const getSecondValue: (str?: string) => string | undefined;
|
|
1323
|
-
|
|
1324
|
-
export { type BrandOptions, type BrandValueType, CInput, type CInputProps, type CSearchProps, CTable, type CTableProps, type CTextAreaProps, CVideo, Clock, type ClockProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Countdown, type CountdownProps, Counter, type CounterProps, Currency, type CurrencyProps, type CurrencyUnit, type CustomTreeItem, type CustomTreeOptions, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, type EffectBrandTransferProps, EffectCategoryCascade, EffectFileUpload, type EffectFileUploadRef, EffectLabelSelect, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, type EffectSearchSelectProps, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, type EffectSkuRecognizeProps, EffectSkuSelect, EffectSkuTable, type EffectSkuTableProps, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, type IApiPayload, type IApiService, type IConfigContext, Iconfont, ImageItem, type ImageItemProps, type ItemOption, type LabelDic, Loading, type MerchantOptions, type ModifyFileData, MultiWindow, MultiWindowContents, type MultiWindowContentsProps, type MultiWindowContentsRefType, type MultiWindowProps, OSSImage, type OSSImageProps, type PagePathType, PrivacyField, QRCode, type QRCodePropsType, QRCodeStatus, RichTextEditor, type RichTextEditorProps, ScopeLevelEnum, type ScopeSelectProps, type ScopeSelectValueType, SearchForm, SearchFormContent, type SearchFormContentProps, type SearchFormProps, SearchList, type SearchListProps, SelectDropdown, type SelectItem, type SelectOptionItem, type SimpleFileData, type SseEventDataType, type TableDragEndEvent, type TransferPropValueType, type TransferValueType, type TreeCategory, type TreeSelectItem, type TreeSelectList, type TreeSingleValueType, type TreeValueType, type UploadResult, type UseRemoteUploadConfigType, type ValueType, type WarehouseOption, WithCVideoModal, WithModal, type WithModalProps, WithPanel, type WithPanelProps, 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 };
|
|
1285
|
+
export { type BrandOptions, type BrandValueType, CInput, type CInputProps, type CSearchProps, CTable, type CTableProps, type CTextAreaProps, CVideo, Clock, type ClockProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Countdown, type CountdownProps, Counter, type CounterProps, Currency, type CurrencyProps, type CurrencyUnit, type CustomTreeItem, type CustomTreeOptions, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, type EffectBrandTransferProps, EffectCategoryCascade, EffectFileUpload, type EffectFileUploadRef, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, type EffectSearchSelectProps, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, type EffectSkuRecognizeProps, EffectSkuSelect, EffectSkuTable, type EffectSkuTableProps, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, type IApiPayload, type IApiService, type IConfigContext, Iconfont, ImageItem, type ImageItemProps, type ItemOption, Loading, type MerchantOptions, type ModifyFileData, MultiWindow, MultiWindowContents, type MultiWindowContentsProps, type MultiWindowContentsRefType, type MultiWindowProps, OSSImage, type OSSImageProps, type PagePathType, PrivacyField, QRCode, type QRCodePropsType, QRCodeStatus, RichTextEditor, type RichTextEditorProps, ScopeLevelEnum, type ScopeSelectProps, type ScopeSelectValueType, SearchForm, SearchFormContent, type SearchFormContentProps, type SearchFormProps, SearchList, type SearchListProps, SelectDropdown, type SelectItem, type SimpleFileData, type SseEventDataType, type TableDragEndEvent, type TransferPropValueType, type TransferValueType, type TreeCategory, type TreeSelectItem, type TreeSelectList, type TreeSingleValueType, type TreeValueType, type UploadResult, type UseRemoteUploadConfigType, type ValueType, type WarehouseOption, WithCVideoModal, WithModal, type WithModalProps, WithPanel, type WithPanelProps, commonDatePickerGetValueProps, commonDatePickerNormalize, commonDateRangePickerGetValueProps, commonDateRangePickerNormalize, commonStatusSelectOptions, commonYesOrNoSelectOptions, commonYesOrNoSelectOptionsMap, defaultMerchantSearchSources, formatClock, formatDate, getCTable, getCommonSelectProps, getCommonTableProps, getNumberValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|
package/dist/index.d.ts
CHANGED
|
@@ -407,6 +407,7 @@ declare class MerchantListBus {
|
|
|
407
407
|
legalPersonCardFrontImage: string;
|
|
408
408
|
legalPersonCardBackImage: string;
|
|
409
409
|
contactName: string;
|
|
410
|
+
phone: string;
|
|
410
411
|
contactPhone: string;
|
|
411
412
|
contactPosition: string;
|
|
412
413
|
serviceBuy: number;
|
|
@@ -1281,44 +1282,4 @@ type Props = {
|
|
|
1281
1282
|
};
|
|
1282
1283
|
declare const EffectAddressCascade: React__default.MemoExoticComponent<(props: Props) => react_jsx_runtime.JSX.Element>;
|
|
1283
1284
|
|
|
1284
|
-
type
|
|
1285
|
-
value: string;
|
|
1286
|
-
label: string;
|
|
1287
|
-
customFields?: Record<string, unknown> | null;
|
|
1288
|
-
};
|
|
1289
|
-
type LabelDic = Record<string, string>;
|
|
1290
|
-
interface EffectLabelSelectProps extends Omit<SelectProps$1, 'onChange'> {
|
|
1291
|
-
onChange?: (value?: string, selectedOptionItem?: SelectOptionItem) => void;
|
|
1292
|
-
defaultLabel?: string;
|
|
1293
|
-
labelDic?: LabelDic;
|
|
1294
|
-
value?: string;
|
|
1295
|
-
customLabelInValue?: boolean;
|
|
1296
|
-
onFetchData?: (params: any, config: any) => Promise<any>;
|
|
1297
|
-
onTransformData?: (params: Record<string, string>) => SelectOptionItem;
|
|
1298
|
-
fetchParams?: Record<string, unknown>;
|
|
1299
|
-
optionsDisplayType?: 'labelAndValue';
|
|
1300
|
-
}
|
|
1301
|
-
/** @deprecated 已废弃,请使用 EffectSearchSelect */
|
|
1302
|
-
declare const EffectLabelSelect: FunctionComponent<EffectLabelSelectProps>;
|
|
1303
|
-
/**
|
|
1304
|
-
*
|
|
1305
|
-
* 返回类型 格式为:
|
|
1306
|
-
* 类型('value' | 'label') + ID(value) + 名称(label) + labelDicKey(映射labelDic的key)
|
|
1307
|
-
*
|
|
1308
|
-
* eg: label;123;哈哈;name
|
|
1309
|
-
* value;123;哈哈;name
|
|
1310
|
-
*
|
|
1311
|
-
* eg: label;111;哈哈;businessNo
|
|
1312
|
-
* value;111;哈哈;businessNo
|
|
1313
|
-
*
|
|
1314
|
-
* eg: label;13200001111;13200001111;phone
|
|
1315
|
-
* value;13200001111;13200001111;phone
|
|
1316
|
-
*/
|
|
1317
|
-
declare const getStrValue: (displayType: "label" | "value", value?: string, label?: string, labelDicKey?: string) => string | undefined;
|
|
1318
|
-
type SelectValueDisplayType = 'label' | 'value' | 'labelDicKey' | 'labelAndValue';
|
|
1319
|
-
declare const getSelectValue: (str?: string | null | number, returnType?: SelectValueDisplayType) => string | undefined;
|
|
1320
|
-
declare const getInitialValue: (label?: string, value?: string) => string;
|
|
1321
|
-
declare const getFirstValue: (str?: string) => string | undefined;
|
|
1322
|
-
declare const getSecondValue: (str?: string) => string | undefined;
|
|
1323
|
-
|
|
1324
|
-
export { type BrandOptions, type BrandValueType, CInput, type CInputProps, type CSearchProps, CTable, type CTableProps, type CTextAreaProps, CVideo, Clock, type ClockProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Countdown, type CountdownProps, Counter, type CounterProps, Currency, type CurrencyProps, type CurrencyUnit, type CustomTreeItem, type CustomTreeOptions, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, type EffectBrandTransferProps, EffectCategoryCascade, EffectFileUpload, type EffectFileUploadRef, EffectLabelSelect, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, type EffectSearchSelectProps, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, type EffectSkuRecognizeProps, EffectSkuSelect, EffectSkuTable, type EffectSkuTableProps, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, type IApiPayload, type IApiService, type IConfigContext, Iconfont, ImageItem, type ImageItemProps, type ItemOption, type LabelDic, Loading, type MerchantOptions, type ModifyFileData, MultiWindow, MultiWindowContents, type MultiWindowContentsProps, type MultiWindowContentsRefType, type MultiWindowProps, OSSImage, type OSSImageProps, type PagePathType, PrivacyField, QRCode, type QRCodePropsType, QRCodeStatus, RichTextEditor, type RichTextEditorProps, ScopeLevelEnum, type ScopeSelectProps, type ScopeSelectValueType, SearchForm, SearchFormContent, type SearchFormContentProps, type SearchFormProps, SearchList, type SearchListProps, SelectDropdown, type SelectItem, type SelectOptionItem, type SimpleFileData, type SseEventDataType, type TableDragEndEvent, type TransferPropValueType, type TransferValueType, type TreeCategory, type TreeSelectItem, type TreeSelectList, type TreeSingleValueType, type TreeValueType, type UploadResult, type UseRemoteUploadConfigType, type ValueType, type WarehouseOption, WithCVideoModal, WithModal, type WithModalProps, WithPanel, type WithPanelProps, 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 };
|
|
1285
|
+
export { type BrandOptions, type BrandValueType, CInput, type CInputProps, type CSearchProps, CTable, type CTableProps, type CTextAreaProps, CVideo, Clock, type ClockProps, ConfigContext, ConfigProvider, type ConfigProviderProps, Countdown, type CountdownProps, Counter, type CounterProps, Currency, type CurrencyProps, type CurrencyUnit, type CustomTreeItem, type CustomTreeOptions, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, type EffectBrandTransferProps, EffectCategoryCascade, EffectFileUpload, type EffectFileUploadRef, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, type EffectSearchSelectProps, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, type EffectSkuRecognizeProps, EffectSkuSelect, EffectSkuTable, type EffectSkuTableProps, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, type IApiPayload, type IApiService, type IConfigContext, Iconfont, ImageItem, type ImageItemProps, type ItemOption, Loading, type MerchantOptions, type ModifyFileData, MultiWindow, MultiWindowContents, type MultiWindowContentsProps, type MultiWindowContentsRefType, type MultiWindowProps, OSSImage, type OSSImageProps, type PagePathType, PrivacyField, QRCode, type QRCodePropsType, QRCodeStatus, RichTextEditor, type RichTextEditorProps, ScopeLevelEnum, type ScopeSelectProps, type ScopeSelectValueType, SearchForm, SearchFormContent, type SearchFormContentProps, type SearchFormProps, SearchList, type SearchListProps, SelectDropdown, type SelectItem, type SimpleFileData, type SseEventDataType, type TableDragEndEvent, type TransferPropValueType, type TransferValueType, type TreeCategory, type TreeSelectItem, type TreeSelectList, type TreeSingleValueType, type TreeValueType, type UploadResult, type UseRemoteUploadConfigType, type ValueType, type WarehouseOption, WithCVideoModal, WithModal, type WithModalProps, WithPanel, type WithPanelProps, commonDatePickerGetValueProps, commonDatePickerNormalize, commonDateRangePickerGetValueProps, commonDateRangePickerNormalize, commonStatusSelectOptions, commonYesOrNoSelectOptions, commonYesOrNoSelectOptionsMap, defaultMerchantSearchSources, formatClock, formatDate, getCTable, getCommonSelectProps, getCommonTableProps, getNumberValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|
package/dist/index.js
CHANGED
|
@@ -460,9 +460,6 @@ __export(index_exports, {
|
|
|
460
460
|
EffectFileUpload: function EffectFileUpload1() {
|
|
461
461
|
return EffectFileUpload;
|
|
462
462
|
},
|
|
463
|
-
EffectLabelSelect: function EffectLabelSelect1() {
|
|
464
|
-
return EffectLabelSelect;
|
|
465
|
-
},
|
|
466
463
|
EffectMerchantSelect: function EffectMerchantSelect1() {
|
|
467
464
|
return EffectMerchantSelect;
|
|
468
465
|
},
|
|
@@ -601,24 +598,9 @@ __export(index_exports, {
|
|
|
601
598
|
getCommonTableProps: function getCommonTableProps1() {
|
|
602
599
|
return getCommonTableProps;
|
|
603
600
|
},
|
|
604
|
-
getFirstValue: function getFirstValue1() {
|
|
605
|
-
return getFirstValue;
|
|
606
|
-
},
|
|
607
|
-
getInitialValue: function getInitialValue1() {
|
|
608
|
-
return getInitialValue;
|
|
609
|
-
},
|
|
610
601
|
getNumberValue: function getNumberValue1() {
|
|
611
602
|
return getNumberValue;
|
|
612
603
|
},
|
|
613
|
-
getSecondValue: function getSecondValue1() {
|
|
614
|
-
return getSecondValue;
|
|
615
|
-
},
|
|
616
|
-
getSelectValue: function getSelectValue1() {
|
|
617
|
-
return getSelectValue;
|
|
618
|
-
},
|
|
619
|
-
getStrValue: function getStrValue1() {
|
|
620
|
-
return getStrValue;
|
|
621
|
-
},
|
|
622
604
|
isSingleTreeSelected: function isSingleTreeSelected1() {
|
|
623
605
|
return isSingleTreeSelected;
|
|
624
606
|
},
|
|
@@ -6395,11 +6377,11 @@ function useMerchantOptions(params) {
|
|
|
6395
6377
|
params
|
|
6396
6378
|
], function() {
|
|
6397
6379
|
return _async_to_generator(function() {
|
|
6398
|
-
var _res_data, _ref, enabled, source, searchParams, res, options;
|
|
6380
|
+
var _res_data, _ref, enabled, _ref_source, source, searchParams, res, options;
|
|
6399
6381
|
return _ts_generator(this, function(_state) {
|
|
6400
6382
|
switch(_state.label){
|
|
6401
6383
|
case 0:
|
|
6402
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6384
|
+
_ref = params || {}, enabled = _ref.enabled, _ref_source = _ref.source, source = _ref_source === void 0 ? "enterpriseNo" : _ref_source, searchParams = _object_without_properties(_ref, [
|
|
6403
6385
|
"enabled",
|
|
6404
6386
|
"source"
|
|
6405
6387
|
]);
|
|
@@ -6421,11 +6403,7 @@ function useMerchantOptions(params) {
|
|
|
6421
6403
|
}
|
|
6422
6404
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6423
6405
|
return {
|
|
6424
|
-
label:
|
|
6425
|
-
item.enterpriseNo,
|
|
6426
|
-
item.platformName,
|
|
6427
|
-
item.name
|
|
6428
|
-
].filter(Boolean).join(" - "),
|
|
6406
|
+
label: getMerchantSourceLabel(item, source),
|
|
6429
6407
|
value: item.enterpriseNo,
|
|
6430
6408
|
originalName: item.platformName,
|
|
6431
6409
|
data: item
|
|
@@ -6448,6 +6426,19 @@ function useMerchantOptions(params) {
|
|
|
6448
6426
|
mutate: mutate
|
|
6449
6427
|
};
|
|
6450
6428
|
}
|
|
6429
|
+
var getMerchantSourceLabel = function getMerchantSourceLabel(item, sourceValue) {
|
|
6430
|
+
var sourceLabelMap = {
|
|
6431
|
+
enterpriseNo: item.enterpriseNo,
|
|
6432
|
+
platformName: item.platformName,
|
|
6433
|
+
name: item.name,
|
|
6434
|
+
phone: item.phone
|
|
6435
|
+
};
|
|
6436
|
+
return sourceLabelMap[sourceValue] || [
|
|
6437
|
+
item.enterpriseNo,
|
|
6438
|
+
item.platformName,
|
|
6439
|
+
item.name
|
|
6440
|
+
].filter(Boolean).join(" - ");
|
|
6441
|
+
};
|
|
6451
6442
|
// src/EffectMerchantSelect/index.tsx
|
|
6452
6443
|
var import_tools10 = require("@xfe-repo/web-utils/tools");
|
|
6453
6444
|
var import_classnames12 = __toESM(require("classnames"));
|
|
@@ -6474,7 +6465,7 @@ var defaultMerchantSearchSources = [
|
|
|
6474
6465
|
value: "name"
|
|
6475
6466
|
},
|
|
6476
6467
|
{
|
|
6477
|
-
label: "\
|
|
6468
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6478
6469
|
value: "phone"
|
|
6479
6470
|
}
|
|
6480
6471
|
];
|
|
@@ -6621,19 +6612,18 @@ var defaultMerchantSearchSources2 = [
|
|
|
6621
6612
|
var defaultTransformMerchantOptions = function defaultTransformMerchantOptions(data, context) {
|
|
6622
6613
|
return (data.list || []).map(function(item) {
|
|
6623
6614
|
return {
|
|
6624
|
-
label:
|
|
6615
|
+
label: getMerchantSourceLabel2(item, context.source.value),
|
|
6625
6616
|
value: item.enterpriseNo,
|
|
6626
6617
|
raw: item
|
|
6627
6618
|
};
|
|
6628
6619
|
});
|
|
6629
6620
|
};
|
|
6630
|
-
var
|
|
6621
|
+
var getMerchantSourceLabel2 = function getMerchantSourceLabel2(item, sourceValue) {
|
|
6631
6622
|
var sourceLabelMap = {
|
|
6632
6623
|
enterpriseNo: item.enterpriseNo,
|
|
6633
6624
|
platformName: item.platformName,
|
|
6634
6625
|
name: item.name,
|
|
6635
|
-
|
|
6636
|
-
phone: ""
|
|
6626
|
+
phone: item.phone
|
|
6637
6627
|
};
|
|
6638
6628
|
return sourceLabelMap[sourceValue] || [
|
|
6639
6629
|
item.enterpriseNo,
|
|
@@ -7748,236 +7738,6 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7748
7738
|
};
|
|
7749
7739
|
});
|
|
7750
7740
|
};
|
|
7751
|
-
// src/EffectLabelSelect/index.tsx
|
|
7752
|
-
var import_react54 = require("react");
|
|
7753
|
-
var import_react_use23 = require("react-use");
|
|
7754
|
-
var import_classnames17 = __toESM(require("classnames"));
|
|
7755
|
-
// src/EffectLabelSelect/hooks.ts
|
|
7756
|
-
var import_react_use22 = require("react-use");
|
|
7757
|
-
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7758
|
-
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7759
|
-
var reqDataFn = function reqDataFn() {
|
|
7760
|
-
return _async_to_generator(function() {
|
|
7761
|
-
return _ts_generator(this, function(_state) {
|
|
7762
|
-
switch(_state.label){
|
|
7763
|
-
case 0:
|
|
7764
|
-
return [
|
|
7765
|
-
4,
|
|
7766
|
-
fn === null || fn === void 0 ? void 0 : fn(reqParams, reqConfig)
|
|
7767
|
-
];
|
|
7768
|
-
case 1:
|
|
7769
|
-
return [
|
|
7770
|
-
2,
|
|
7771
|
-
_state.sent()
|
|
7772
|
-
];
|
|
7773
|
-
}
|
|
7774
|
-
});
|
|
7775
|
-
})();
|
|
7776
|
-
};
|
|
7777
|
-
var _ref = _sliced_to_array((0, import_react_use22.useAsyncFn)(reqDataFn, [
|
|
7778
|
-
dependency
|
|
7779
|
-
]), 2), resState = _ref[0], fetchData = _ref[1];
|
|
7780
|
-
(0, import_react_use22.useDebounce)(function() {
|
|
7781
|
-
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7782
|
-
if (shouldFetchData) {
|
|
7783
|
-
void fetchData();
|
|
7784
|
-
}
|
|
7785
|
-
}, 600, [
|
|
7786
|
-
dependency
|
|
7787
|
-
]);
|
|
7788
|
-
return [
|
|
7789
|
-
resState,
|
|
7790
|
-
fetchData
|
|
7791
|
-
];
|
|
7792
|
-
};
|
|
7793
|
-
// src/EffectLabelSelect/index.module.less
|
|
7794
|
-
var index_module_default22 = {
|
|
7795
|
-
select_wrap: "index_module_select_wrap",
|
|
7796
|
-
select_label: "index_module_select_label",
|
|
7797
|
-
value_select: "index_module_value_select2",
|
|
7798
|
-
select: "index_module_select7"
|
|
7799
|
-
};
|
|
7800
|
-
// src/EffectLabelSelect/index.tsx
|
|
7801
|
-
var import_antd41 = require("antd");
|
|
7802
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
7803
|
-
var EffectLabelSelect = (0, import_react54.memo)(function(props) {
|
|
7804
|
-
var onChange = props.onChange, className = props.className, value = props.value, disabled = props.disabled, defaultLabel = props.defaultLabel, _props_labelDic = props.labelDic, labelDic = _props_labelDic === void 0 ? defaultLabelDic : _props_labelDic, onFetchData = props.onFetchData, _props_onTransformData = props.onTransformData, onTransformData = _props_onTransformData === void 0 ? defaultTransformDataFn : _props_onTransformData, _props_fetchParams = props.fetchParams, fetchParams = _props_fetchParams === void 0 ? {} : _props_fetchParams, _props_customLabelInValue = props.customLabelInValue, customLabelInValue = _props_customLabelInValue === void 0 ? false : _props_customLabelInValue, optionsDisplayType = props.optionsDisplayType, style = props.style;
|
|
7805
|
-
var apiService = useRequestConfig().apiService;
|
|
7806
|
-
var _ref = _sliced_to_array((0, import_react54.useState)(function() {
|
|
7807
|
-
var _transformObj2Options_, _transformObj2Options;
|
|
7808
|
-
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
7809
|
-
var defaultLabelFromLabelDic = transformObj2Options === null || transformObj2Options === void 0 ? void 0 : (_transformObj2Options = transformObj2Options(labelDic)) === null || _transformObj2Options === void 0 ? void 0 : (_transformObj2Options_ = _transformObj2Options[0]) === null || _transformObj2Options_ === void 0 ? void 0 : _transformObj2Options_.value;
|
|
7810
|
-
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
7811
|
-
}), 2), curSelectLabel = _ref[0], setCurSelectLabel = _ref[1];
|
|
7812
|
-
var _ref1 = _sliced_to_array((0, import_react54.useState)(value !== null && value !== void 0 ? value : void 0), 2), curSelectValue = _ref1[0], setCurSelectValue = _ref1[1];
|
|
7813
|
-
var _ref2 = _sliced_to_array((0, import_react54.useState)(), 2), curSelectItem = _ref2[0], setCurSelectItem = _ref2[1];
|
|
7814
|
-
var _ref3 = _sliced_to_array((0, import_react54.useState)(), 2), curSearchValue = _ref3[0], setCurSearchValue = _ref3[1];
|
|
7815
|
-
var _ref4 = _sliced_to_array((0, import_react54.useState)([]), 2), optionsData = _ref4[0], setOptionsData = _ref4[1];
|
|
7816
|
-
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7817
|
-
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7818
|
-
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7819
|
-
page: 1,
|
|
7820
|
-
pageSize: 20
|
|
7821
|
-
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7822
|
-
(0, import_react54.useEffect)(function() {
|
|
7823
|
-
var _resState_value;
|
|
7824
|
-
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7825
|
-
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7826
|
-
setOptionsData(optionsData2);
|
|
7827
|
-
}, [
|
|
7828
|
-
resState.loading,
|
|
7829
|
-
resState.value
|
|
7830
|
-
]);
|
|
7831
|
-
(0, import_react_use23.useUpdateEffect)(function() {
|
|
7832
|
-
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
7833
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(changedValue, curSelectItem);
|
|
7834
|
-
}, [
|
|
7835
|
-
curSelectValue
|
|
7836
|
-
]);
|
|
7837
|
-
var handleLabelChange = function handleLabelChange(param) {
|
|
7838
|
-
setCurSelectLabel(param);
|
|
7839
|
-
setCurSelectValue(void 0);
|
|
7840
|
-
handleValueClear();
|
|
7841
|
-
};
|
|
7842
|
-
var handleValueChange = function handleValueChange(valueParam, _option) {
|
|
7843
|
-
var option = _option;
|
|
7844
|
-
if (customLabelInValue) {
|
|
7845
|
-
setCurSelectValue(getStrValue("label", option === null || option === void 0 ? void 0 : option.value, option === null || option === void 0 ? void 0 : option.label, curSelectLabel));
|
|
7846
|
-
} else {
|
|
7847
|
-
setCurSelectValue(valueParam);
|
|
7848
|
-
}
|
|
7849
|
-
setCurSelectItem(option);
|
|
7850
|
-
};
|
|
7851
|
-
var handleValueSearch = function handleValueSearch(param) {
|
|
7852
|
-
setCurSearchValue(param);
|
|
7853
|
-
};
|
|
7854
|
-
var handleValueClear = function handleValueClear() {
|
|
7855
|
-
setCurSearchValue(void 0);
|
|
7856
|
-
setCurSelectValue(void 0);
|
|
7857
|
-
setOptionsData([]);
|
|
7858
|
-
};
|
|
7859
|
-
var selectLabelProps = {
|
|
7860
|
-
className: index_module_default22.select_label,
|
|
7861
|
-
disabled: disabled,
|
|
7862
|
-
defaultValue: curSelectLabel,
|
|
7863
|
-
options: transformObj2Options(labelDic),
|
|
7864
|
-
onChange: handleLabelChange,
|
|
7865
|
-
popupMatchSelectWidth: false
|
|
7866
|
-
};
|
|
7867
|
-
var labelText = labelDic[curSelectLabel] || "";
|
|
7868
|
-
var notFoundContent = resState.loading ? "\u641C\u7D22\u4E2D" : curSearchValue ? "输入的".concat(labelText, "未查询到信息") : "请输入".concat(labelText);
|
|
7869
|
-
var mergedValue = customLabelInValue ? getSelectValue(curSelectValue, optionsDisplayType) : curSelectValue;
|
|
7870
|
-
var mergedOptionsData = optionsDisplayType === "labelAndValue" ? optionsData.map(function(item) {
|
|
7871
|
-
return _object_spread_props(_object_spread({}, item), {
|
|
7872
|
-
label: getInitialValue(item.label, item.value)
|
|
7873
|
-
});
|
|
7874
|
-
}) : optionsData;
|
|
7875
|
-
var selectValueProps = {
|
|
7876
|
-
className: (0, import_classnames17.default)(index_module_default22.value_select, className),
|
|
7877
|
-
notFoundContent: notFoundContent,
|
|
7878
|
-
value: mergedValue,
|
|
7879
|
-
options: mergedOptionsData,
|
|
7880
|
-
disabled: disabled,
|
|
7881
|
-
loading: resState.loading,
|
|
7882
|
-
placeholder: "请输入".concat(labelText),
|
|
7883
|
-
onChange: handleValueChange,
|
|
7884
|
-
onSearch: handleValueSearch,
|
|
7885
|
-
onClear: handleValueClear,
|
|
7886
|
-
optionFilterProp: "label",
|
|
7887
|
-
showSearch: true,
|
|
7888
|
-
allowClear: true,
|
|
7889
|
-
defaultActiveFirstOption: false,
|
|
7890
|
-
filterOption: false,
|
|
7891
|
-
popupMatchSelectWidth: false
|
|
7892
|
-
};
|
|
7893
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_antd41.Space.Compact, {
|
|
7894
|
-
className: index_module_default22.select_wrap,
|
|
7895
|
-
style: style,
|
|
7896
|
-
children: [
|
|
7897
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_antd41.Select, _object_spread({}, selectLabelProps)),
|
|
7898
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_antd41.Select, _object_spread({}, selectValueProps))
|
|
7899
|
-
]
|
|
7900
|
-
});
|
|
7901
|
-
});
|
|
7902
|
-
var defaultLabelDic = {
|
|
7903
|
-
businessNo: "\u5546\u6237\u53F7",
|
|
7904
|
-
name: "\u5546\u6237\u540D"
|
|
7905
|
-
};
|
|
7906
|
-
var defaultTransformDataFn = function defaultTransformDataFn(_0) {
|
|
7907
|
-
var name = _0.name, enterpriseNo = _0.enterpriseNo, otherParams = _object_without_properties(_0, [
|
|
7908
|
-
"name",
|
|
7909
|
-
"enterpriseNo"
|
|
7910
|
-
]);
|
|
7911
|
-
return {
|
|
7912
|
-
label: name,
|
|
7913
|
-
value: enterpriseNo,
|
|
7914
|
-
customFields: otherParams
|
|
7915
|
-
};
|
|
7916
|
-
};
|
|
7917
|
-
var transformObj2Options = function transformObj2Options(obj) {
|
|
7918
|
-
var options = [];
|
|
7919
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7920
|
-
try {
|
|
7921
|
-
for(var _iterator = Object.entries(obj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7922
|
-
var _step_value = _sliced_to_array(_step.value, 2), value = _step_value[0], key = _step_value[1];
|
|
7923
|
-
options.push({
|
|
7924
|
-
value: value,
|
|
7925
|
-
label: key
|
|
7926
|
-
});
|
|
7927
|
-
}
|
|
7928
|
-
} catch (err) {
|
|
7929
|
-
_didIteratorError = true;
|
|
7930
|
-
_iteratorError = err;
|
|
7931
|
-
} finally{
|
|
7932
|
-
try {
|
|
7933
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7934
|
-
_iterator.return();
|
|
7935
|
-
}
|
|
7936
|
-
} finally{
|
|
7937
|
-
if (_didIteratorError) {
|
|
7938
|
-
throw _iteratorError;
|
|
7939
|
-
}
|
|
7940
|
-
}
|
|
7941
|
-
}
|
|
7942
|
-
return options;
|
|
7943
|
-
};
|
|
7944
|
-
var getStrValue = function getStrValue(displayType) {
|
|
7945
|
-
var value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", label = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", labelDicKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
7946
|
-
if (!value) {
|
|
7947
|
-
return void 0;
|
|
7948
|
-
}
|
|
7949
|
-
return "".concat(displayType, ";").concat(value, ";").concat(label, ";").concat(labelDicKey);
|
|
7950
|
-
};
|
|
7951
|
-
var getSelectValue = function getSelectValue(str, returnType) {
|
|
7952
|
-
if (str === "null" || typeof str === "undefined") {
|
|
7953
|
-
return void 0;
|
|
7954
|
-
}
|
|
7955
|
-
var _String_split = _sliced_to_array(String(str).split(";"), 4), displayType = _String_split[0], value = _String_split[1], label = _String_split[2], labelDicKey = _String_split[3];
|
|
7956
|
-
if (returnType === "labelAndValue") {
|
|
7957
|
-
return (label === null || label === void 0 ? void 0 : label.includes("-")) ? label : getInitialValue(label, value);
|
|
7958
|
-
} else if (returnType === "labelDicKey") {
|
|
7959
|
-
return labelDicKey;
|
|
7960
|
-
} else if (returnType === "value" || displayType === "value") {
|
|
7961
|
-
return value;
|
|
7962
|
-
} else if (returnType === "label" || displayType === "label") {
|
|
7963
|
-
return label;
|
|
7964
|
-
}
|
|
7965
|
-
return void 0;
|
|
7966
|
-
};
|
|
7967
|
-
var getInitialValue = function getInitialValue() {
|
|
7968
|
-
var label = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
7969
|
-
return label && value ? "".concat(value, " - ").concat(label) : value;
|
|
7970
|
-
};
|
|
7971
|
-
var getFirstValue = function getFirstValue() {
|
|
7972
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7973
|
-
var _str_split_, _str_split;
|
|
7974
|
-
return str === null || str === void 0 ? void 0 : (_str_split = str.split("-")) === null || _str_split === void 0 ? void 0 : (_str_split_ = _str_split[0]) === null || _str_split_ === void 0 ? void 0 : _str_split_.trim();
|
|
7975
|
-
};
|
|
7976
|
-
var getSecondValue = function getSecondValue() {
|
|
7977
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7978
|
-
var _this;
|
|
7979
|
-
return (_this = (str === null || str === void 0 ? void 0 : str.includes("-")) ? str.split("-")[1] : str) === null || _this === void 0 ? void 0 : _this.trim();
|
|
7980
|
-
};
|
|
7981
7741
|
// Annotate the CommonJS export names for ESM import in node:
|
|
7982
7742
|
0 && (module.exports = {
|
|
7983
7743
|
CInput: CInput,
|
|
@@ -7994,7 +7754,6 @@ var getSecondValue = function getSecondValue() {
|
|
|
7994
7754
|
EffectBrandTransfer: EffectBrandTransfer,
|
|
7995
7755
|
EffectCategoryCascade: EffectCategoryCascade,
|
|
7996
7756
|
EffectFileUpload: EffectFileUpload,
|
|
7997
|
-
EffectLabelSelect: EffectLabelSelect,
|
|
7998
7757
|
EffectMerchantSelect: EffectMerchantSelect,
|
|
7999
7758
|
EffectReservoirSelect: EffectReservoirSelect,
|
|
8000
7759
|
EffectScopeSelect: EffectScopeSelect,
|
|
@@ -8041,12 +7800,7 @@ var getSecondValue = function getSecondValue() {
|
|
|
8041
7800
|
getCTable: getCTable,
|
|
8042
7801
|
getCommonSelectProps: getCommonSelectProps,
|
|
8043
7802
|
getCommonTableProps: getCommonTableProps,
|
|
8044
|
-
getFirstValue: getFirstValue,
|
|
8045
|
-
getInitialValue: getInitialValue,
|
|
8046
7803
|
getNumberValue: getNumberValue,
|
|
8047
|
-
getSecondValue: getSecondValue,
|
|
8048
|
-
getSelectValue: getSelectValue,
|
|
8049
|
-
getStrValue: getStrValue,
|
|
8050
7804
|
isSingleTreeSelected: isSingleTreeSelected,
|
|
8051
7805
|
replaceRgbWithHex: replaceRgbWithHex,
|
|
8052
7806
|
saasApiService: saasApiService,
|
package/dist/index.mjs
CHANGED
|
@@ -6095,11 +6095,11 @@ function useMerchantOptions(params) {
|
|
|
6095
6095
|
params
|
|
6096
6096
|
], function() {
|
|
6097
6097
|
return _async_to_generator(function() {
|
|
6098
|
-
var _res_data, _ref, enabled, source, searchParams, res, options;
|
|
6098
|
+
var _res_data, _ref, enabled, _ref_source, source, searchParams, res, options;
|
|
6099
6099
|
return _ts_generator(this, function(_state) {
|
|
6100
6100
|
switch(_state.label){
|
|
6101
6101
|
case 0:
|
|
6102
|
-
_ref = params || {}, enabled = _ref.enabled,
|
|
6102
|
+
_ref = params || {}, enabled = _ref.enabled, _ref_source = _ref.source, source = _ref_source === void 0 ? "enterpriseNo" : _ref_source, searchParams = _object_without_properties(_ref, [
|
|
6103
6103
|
"enabled",
|
|
6104
6104
|
"source"
|
|
6105
6105
|
]);
|
|
@@ -6121,11 +6121,7 @@ function useMerchantOptions(params) {
|
|
|
6121
6121
|
}
|
|
6122
6122
|
options = (_res_data = res.data) === null || _res_data === void 0 ? void 0 : _res_data.list.map(function(item) {
|
|
6123
6123
|
return {
|
|
6124
|
-
label:
|
|
6125
|
-
item.enterpriseNo,
|
|
6126
|
-
item.platformName,
|
|
6127
|
-
item.name
|
|
6128
|
-
].filter(Boolean).join(" - "),
|
|
6124
|
+
label: getMerchantSourceLabel(item, source),
|
|
6129
6125
|
value: item.enterpriseNo,
|
|
6130
6126
|
originalName: item.platformName,
|
|
6131
6127
|
data: item
|
|
@@ -6148,6 +6144,19 @@ function useMerchantOptions(params) {
|
|
|
6148
6144
|
mutate: mutate
|
|
6149
6145
|
};
|
|
6150
6146
|
}
|
|
6147
|
+
var getMerchantSourceLabel = function getMerchantSourceLabel(item, sourceValue) {
|
|
6148
|
+
var sourceLabelMap = {
|
|
6149
|
+
enterpriseNo: item.enterpriseNo,
|
|
6150
|
+
platformName: item.platformName,
|
|
6151
|
+
name: item.name,
|
|
6152
|
+
phone: item.phone
|
|
6153
|
+
};
|
|
6154
|
+
return sourceLabelMap[sourceValue] || [
|
|
6155
|
+
item.enterpriseNo,
|
|
6156
|
+
item.platformName,
|
|
6157
|
+
item.name
|
|
6158
|
+
].filter(Boolean).join(" - ");
|
|
6159
|
+
};
|
|
6151
6160
|
// src/EffectMerchantSelect/index.tsx
|
|
6152
6161
|
import { debounce as debounce6 } from "@xfe-repo/web-utils/tools";
|
|
6153
6162
|
import classnames11 from "classnames";
|
|
@@ -6174,7 +6183,7 @@ var defaultMerchantSearchSources = [
|
|
|
6174
6183
|
value: "name"
|
|
6175
6184
|
},
|
|
6176
6185
|
{
|
|
6177
|
-
label: "\
|
|
6186
|
+
label: "\u4E3B\u624B\u673A\u53F7",
|
|
6178
6187
|
value: "phone"
|
|
6179
6188
|
}
|
|
6180
6189
|
];
|
|
@@ -6321,19 +6330,18 @@ var defaultMerchantSearchSources2 = [
|
|
|
6321
6330
|
var defaultTransformMerchantOptions = function defaultTransformMerchantOptions(data, context) {
|
|
6322
6331
|
return (data.list || []).map(function(item) {
|
|
6323
6332
|
return {
|
|
6324
|
-
label:
|
|
6333
|
+
label: getMerchantSourceLabel2(item, context.source.value),
|
|
6325
6334
|
value: item.enterpriseNo,
|
|
6326
6335
|
raw: item
|
|
6327
6336
|
};
|
|
6328
6337
|
});
|
|
6329
6338
|
};
|
|
6330
|
-
var
|
|
6339
|
+
var getMerchantSourceLabel2 = function getMerchantSourceLabel2(item, sourceValue) {
|
|
6331
6340
|
var sourceLabelMap = {
|
|
6332
6341
|
enterpriseNo: item.enterpriseNo,
|
|
6333
6342
|
platformName: item.platformName,
|
|
6334
6343
|
name: item.name,
|
|
6335
|
-
|
|
6336
|
-
phone: ""
|
|
6344
|
+
phone: item.phone
|
|
6337
6345
|
};
|
|
6338
6346
|
return sourceLabelMap[sourceValue] || [
|
|
6339
6347
|
item.enterpriseNo,
|
|
@@ -7448,234 +7456,4 @@ var transformSelectedList = function transformSelectedList(selectedOptions) {
|
|
|
7448
7456
|
};
|
|
7449
7457
|
});
|
|
7450
7458
|
};
|
|
7451
|
-
|
|
7452
|
-
import { memo as memo39, useEffect as useEffect27, useState as useState32 } from "react";
|
|
7453
|
-
import { useUpdateEffect as useUpdateEffect18 } from "react-use";
|
|
7454
|
-
import classnames16 from "classnames";
|
|
7455
|
-
// src/EffectLabelSelect/hooks.ts
|
|
7456
|
-
import { useAsyncFn as useAsyncFn8, useDebounce as useDebounce2 } from "react-use";
|
|
7457
|
-
var useReqData = function useReqData(fn, reqParams, dependency) {
|
|
7458
|
-
var _useRequestConfig = useRequestConfig(), reqConfig = _useRequestConfig.config;
|
|
7459
|
-
var reqDataFn = function reqDataFn() {
|
|
7460
|
-
return _async_to_generator(function() {
|
|
7461
|
-
return _ts_generator(this, function(_state) {
|
|
7462
|
-
switch(_state.label){
|
|
7463
|
-
case 0:
|
|
7464
|
-
return [
|
|
7465
|
-
4,
|
|
7466
|
-
fn === null || fn === void 0 ? void 0 : fn(reqParams, reqConfig)
|
|
7467
|
-
];
|
|
7468
|
-
case 1:
|
|
7469
|
-
return [
|
|
7470
|
-
2,
|
|
7471
|
-
_state.sent()
|
|
7472
|
-
];
|
|
7473
|
-
}
|
|
7474
|
-
});
|
|
7475
|
-
})();
|
|
7476
|
-
};
|
|
7477
|
-
var _useAsyncFn8 = _sliced_to_array(useAsyncFn8(reqDataFn, [
|
|
7478
|
-
dependency
|
|
7479
|
-
]), 2), resState = _useAsyncFn8[0], fetchData = _useAsyncFn8[1];
|
|
7480
|
-
useDebounce2(function() {
|
|
7481
|
-
var shouldFetchData = Object.keys(JSON.parse(dependency || "{}")).length > 0;
|
|
7482
|
-
if (shouldFetchData) {
|
|
7483
|
-
void fetchData();
|
|
7484
|
-
}
|
|
7485
|
-
}, 600, [
|
|
7486
|
-
dependency
|
|
7487
|
-
]);
|
|
7488
|
-
return [
|
|
7489
|
-
resState,
|
|
7490
|
-
fetchData
|
|
7491
|
-
];
|
|
7492
|
-
};
|
|
7493
|
-
// src/EffectLabelSelect/index.module.less
|
|
7494
|
-
var index_module_default22 = {
|
|
7495
|
-
select_wrap: "index_module_select_wrap",
|
|
7496
|
-
select_label: "index_module_select_label",
|
|
7497
|
-
value_select: "index_module_value_select2",
|
|
7498
|
-
select: "index_module_select7"
|
|
7499
|
-
};
|
|
7500
|
-
// src/EffectLabelSelect/index.tsx
|
|
7501
|
-
import { Select as Select13, Space as Space6 } from "antd";
|
|
7502
|
-
import { jsx as jsx50, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7503
|
-
var EffectLabelSelect = memo39(function(props) {
|
|
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;
|
|
7505
|
-
var apiService = useRequestConfig().apiService;
|
|
7506
|
-
var _useState32 = _sliced_to_array(useState32(function() {
|
|
7507
|
-
var _transformObj2Options_, _transformObj2Options;
|
|
7508
|
-
var defaultLabelFromValue = customLabelInValue ? getSelectValue(value, "labelDicKey") : "";
|
|
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;
|
|
7510
|
-
return defaultLabel || defaultLabelFromValue || defaultLabelFromLabelDic || "";
|
|
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];
|
|
7516
|
-
var fetchDataFn = onFetchData || apiService.merchantList;
|
|
7517
|
-
var fetchDataDeps = _object_spread_props(_object_spread({}, fetchParams), _define_property({}, curSelectLabel, curSearchValue || void 0));
|
|
7518
|
-
var _useReqData = _sliced_to_array(useReqData(fetchDataFn, _object_spread({
|
|
7519
|
-
page: 1,
|
|
7520
|
-
pageSize: 20
|
|
7521
|
-
}, fetchDataDeps), JSON.stringify(fetchDataDeps)), 1), resState = _useReqData[0];
|
|
7522
|
-
useEffect27(function() {
|
|
7523
|
-
var _resState_value;
|
|
7524
|
-
if (resState.loading || !((_resState_value = resState.value) === null || _resState_value === void 0 ? void 0 : _resState_value.data.list)) return;
|
|
7525
|
-
var optionsData2 = resState.value.data.list.map(onTransformData);
|
|
7526
|
-
setOptionsData(optionsData2);
|
|
7527
|
-
}, [
|
|
7528
|
-
resState.loading,
|
|
7529
|
-
resState.value
|
|
7530
|
-
]);
|
|
7531
|
-
useUpdateEffect18(function() {
|
|
7532
|
-
var changedValue = (curSelectValue !== null && curSelectValue !== void 0 ? curSelectValue : "") === "" ? void 0 : String(curSelectValue);
|
|
7533
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(changedValue, curSelectItem);
|
|
7534
|
-
}, [
|
|
7535
|
-
curSelectValue
|
|
7536
|
-
]);
|
|
7537
|
-
var handleLabelChange = function handleLabelChange(param) {
|
|
7538
|
-
setCurSelectLabel(param);
|
|
7539
|
-
setCurSelectValue(void 0);
|
|
7540
|
-
handleValueClear();
|
|
7541
|
-
};
|
|
7542
|
-
var handleValueChange = function handleValueChange(valueParam, _option) {
|
|
7543
|
-
var option = _option;
|
|
7544
|
-
if (customLabelInValue) {
|
|
7545
|
-
setCurSelectValue(getStrValue("label", option === null || option === void 0 ? void 0 : option.value, option === null || option === void 0 ? void 0 : option.label, curSelectLabel));
|
|
7546
|
-
} else {
|
|
7547
|
-
setCurSelectValue(valueParam);
|
|
7548
|
-
}
|
|
7549
|
-
setCurSelectItem(option);
|
|
7550
|
-
};
|
|
7551
|
-
var handleValueSearch = function handleValueSearch(param) {
|
|
7552
|
-
setCurSearchValue(param);
|
|
7553
|
-
};
|
|
7554
|
-
var handleValueClear = function handleValueClear() {
|
|
7555
|
-
setCurSearchValue(void 0);
|
|
7556
|
-
setCurSelectValue(void 0);
|
|
7557
|
-
setOptionsData([]);
|
|
7558
|
-
};
|
|
7559
|
-
var selectLabelProps = {
|
|
7560
|
-
className: index_module_default22.select_label,
|
|
7561
|
-
disabled: disabled,
|
|
7562
|
-
defaultValue: curSelectLabel,
|
|
7563
|
-
options: transformObj2Options(labelDic),
|
|
7564
|
-
onChange: handleLabelChange,
|
|
7565
|
-
popupMatchSelectWidth: false
|
|
7566
|
-
};
|
|
7567
|
-
var labelText = labelDic[curSelectLabel] || "";
|
|
7568
|
-
var notFoundContent = resState.loading ? "\u641C\u7D22\u4E2D" : curSearchValue ? "输入的".concat(labelText, "未查询到信息") : "请输入".concat(labelText);
|
|
7569
|
-
var mergedValue = customLabelInValue ? getSelectValue(curSelectValue, optionsDisplayType) : curSelectValue;
|
|
7570
|
-
var mergedOptionsData = optionsDisplayType === "labelAndValue" ? optionsData.map(function(item) {
|
|
7571
|
-
return _object_spread_props(_object_spread({}, item), {
|
|
7572
|
-
label: getInitialValue(item.label, item.value)
|
|
7573
|
-
});
|
|
7574
|
-
}) : optionsData;
|
|
7575
|
-
var selectValueProps = {
|
|
7576
|
-
className: classnames16(index_module_default22.value_select, className),
|
|
7577
|
-
notFoundContent: notFoundContent,
|
|
7578
|
-
value: mergedValue,
|
|
7579
|
-
options: mergedOptionsData,
|
|
7580
|
-
disabled: disabled,
|
|
7581
|
-
loading: resState.loading,
|
|
7582
|
-
placeholder: "请输入".concat(labelText),
|
|
7583
|
-
onChange: handleValueChange,
|
|
7584
|
-
onSearch: handleValueSearch,
|
|
7585
|
-
onClear: handleValueClear,
|
|
7586
|
-
optionFilterProp: "label",
|
|
7587
|
-
showSearch: true,
|
|
7588
|
-
allowClear: true,
|
|
7589
|
-
defaultActiveFirstOption: false,
|
|
7590
|
-
filterOption: false,
|
|
7591
|
-
popupMatchSelectWidth: false
|
|
7592
|
-
};
|
|
7593
|
-
return /* @__PURE__ */ jsxs22(Space6.Compact, {
|
|
7594
|
-
className: index_module_default22.select_wrap,
|
|
7595
|
-
style: style,
|
|
7596
|
-
children: [
|
|
7597
|
-
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectLabelProps)),
|
|
7598
|
-
/* @__PURE__ */ jsx50(Select13, _object_spread({}, selectValueProps))
|
|
7599
|
-
]
|
|
7600
|
-
});
|
|
7601
|
-
});
|
|
7602
|
-
var defaultLabelDic = {
|
|
7603
|
-
businessNo: "\u5546\u6237\u53F7",
|
|
7604
|
-
name: "\u5546\u6237\u540D"
|
|
7605
|
-
};
|
|
7606
|
-
var defaultTransformDataFn = function defaultTransformDataFn(_0) {
|
|
7607
|
-
var name = _0.name, enterpriseNo = _0.enterpriseNo, otherParams = _object_without_properties(_0, [
|
|
7608
|
-
"name",
|
|
7609
|
-
"enterpriseNo"
|
|
7610
|
-
]);
|
|
7611
|
-
return {
|
|
7612
|
-
label: name,
|
|
7613
|
-
value: enterpriseNo,
|
|
7614
|
-
customFields: otherParams
|
|
7615
|
-
};
|
|
7616
|
-
};
|
|
7617
|
-
var transformObj2Options = function transformObj2Options(obj) {
|
|
7618
|
-
var options = [];
|
|
7619
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7620
|
-
try {
|
|
7621
|
-
for(var _iterator = Object.entries(obj)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7622
|
-
var _step_value = _sliced_to_array(_step.value, 2), value = _step_value[0], key = _step_value[1];
|
|
7623
|
-
options.push({
|
|
7624
|
-
value: value,
|
|
7625
|
-
label: key
|
|
7626
|
-
});
|
|
7627
|
-
}
|
|
7628
|
-
} catch (err) {
|
|
7629
|
-
_didIteratorError = true;
|
|
7630
|
-
_iteratorError = err;
|
|
7631
|
-
} finally{
|
|
7632
|
-
try {
|
|
7633
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7634
|
-
_iterator.return();
|
|
7635
|
-
}
|
|
7636
|
-
} finally{
|
|
7637
|
-
if (_didIteratorError) {
|
|
7638
|
-
throw _iteratorError;
|
|
7639
|
-
}
|
|
7640
|
-
}
|
|
7641
|
-
}
|
|
7642
|
-
return options;
|
|
7643
|
-
};
|
|
7644
|
-
var getStrValue = function getStrValue(displayType) {
|
|
7645
|
-
var value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "", label = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "", labelDicKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
7646
|
-
if (!value) {
|
|
7647
|
-
return void 0;
|
|
7648
|
-
}
|
|
7649
|
-
return "".concat(displayType, ";").concat(value, ";").concat(label, ";").concat(labelDicKey);
|
|
7650
|
-
};
|
|
7651
|
-
var getSelectValue = function getSelectValue(str, returnType) {
|
|
7652
|
-
if (str === "null" || typeof str === "undefined") {
|
|
7653
|
-
return void 0;
|
|
7654
|
-
}
|
|
7655
|
-
var _String_split = _sliced_to_array(String(str).split(";"), 4), displayType = _String_split[0], value = _String_split[1], label = _String_split[2], labelDicKey = _String_split[3];
|
|
7656
|
-
if (returnType === "labelAndValue") {
|
|
7657
|
-
return (label === null || label === void 0 ? void 0 : label.includes("-")) ? label : getInitialValue(label, value);
|
|
7658
|
-
} else if (returnType === "labelDicKey") {
|
|
7659
|
-
return labelDicKey;
|
|
7660
|
-
} else if (returnType === "value" || displayType === "value") {
|
|
7661
|
-
return value;
|
|
7662
|
-
} else if (returnType === "label" || displayType === "label") {
|
|
7663
|
-
return label;
|
|
7664
|
-
}
|
|
7665
|
-
return void 0;
|
|
7666
|
-
};
|
|
7667
|
-
var getInitialValue = function getInitialValue() {
|
|
7668
|
-
var label = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", value = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
7669
|
-
return label && value ? "".concat(value, " - ").concat(label) : value;
|
|
7670
|
-
};
|
|
7671
|
-
var getFirstValue = function getFirstValue() {
|
|
7672
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7673
|
-
var _str_split_, _str_split;
|
|
7674
|
-
return str === null || str === void 0 ? void 0 : (_str_split = str.split("-")) === null || _str_split === void 0 ? void 0 : (_str_split_ = _str_split[0]) === null || _str_split_ === void 0 ? void 0 : _str_split_.trim();
|
|
7675
|
-
};
|
|
7676
|
-
var getSecondValue = function getSecondValue() {
|
|
7677
|
-
var str = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
7678
|
-
var _this;
|
|
7679
|
-
return (_this = (str === null || str === void 0 ? void 0 : str.includes("-")) ? str.split("-")[1] : str) === null || _this === void 0 ? void 0 : _this.trim();
|
|
7680
|
-
};
|
|
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 };
|
|
7459
|
+
export { CInput, CTable, CVideo, Clock, ConfigContext, ConfigProvider, Countdown, Counter, Currency, EffectAddressCascade, EffectBrandSelect, EffectBrandTransfer, EffectCategoryCascade, EffectFileUpload, EffectMerchantSelect, EffectReservoirSelect, EffectScopeSelect, EffectSearchSelect, EffectSeriesSelect, EffectSeriesSelectV2, EffectShelveSelect, EffectSkuRecognize, EffectSkuSelect, EffectSkuTable, EffectSpuSelect, EffectStaffSelect, EffectWarehouseSelect, EffectWithFilePanel, FileUpload, Iconfont, ImageItem, Loading, MultiWindow, MultiWindowContents, OSSImage, PrivacyField, QRCode, QRCodeStatus, RichTextEditor, ScopeLevelEnum, SearchForm, SearchFormContent, SearchList, SelectDropdown, WithCVideoModal, WithModal, WithPanel, commonDatePickerGetValueProps, commonDatePickerNormalize, commonDateRangePickerGetValueProps, commonDateRangePickerNormalize, commonStatusSelectOptions, commonYesOrNoSelectOptions, commonYesOrNoSelectOptionsMap, defaultMerchantSearchSources, formatClock, formatDate, getCTable, getCommonSelectProps, getCommonTableProps, getNumberValue, isSingleTreeSelected, replaceRgbWithHex, saasApiService, transformOptionToSelectedList, transformSelectListToValues, transformSimpleFile2UploadFile, transformUploadFile2SimpleFile, transformValuesToSelectList, typedMemo, useMultiWindowContentsRef, useSearchFormStyle, useSseQrcode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/web-components",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"module": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": [
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"esbuild-plugin-less": "^1.3.9",
|
|
53
53
|
"eslint": "8.57.1",
|
|
54
54
|
"vitest": "^4.0.14",
|
|
55
|
-
"@xfe-repo/
|
|
56
|
-
"@xfe-repo/
|
|
55
|
+
"@xfe-repo/typescript-config": "1.6.1",
|
|
56
|
+
"@xfe-repo/eslint-config": "1.6.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@ant-design/icons": "^5.0.0",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"react-use": "^17.5.1",
|
|
65
65
|
"swr": "^2.2.5",
|
|
66
66
|
"@xfe-repo/web-micro": "1.7.0",
|
|
67
|
-
"@xfe-repo/web-service": "1.6.0",
|
|
68
67
|
"@xfe-repo/web-router": "1.6.1",
|
|
68
|
+
"@xfe-repo/web-service": "1.6.0",
|
|
69
69
|
"@xfe-repo/web-utils": "1.6.0"
|
|
70
70
|
},
|
|
71
71
|
"publishConfig": {
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
| EffectBrandTransfer | | ✅ TransferValueType | ✅ useBrandOptions | ✅ categoryId | | | ✅ | |
|
|
14
14
|
| EffectCategoryCascade | ✅ 多选/获取原始数据 | ✅ TreeValueType 等6个 | ✅ useCategoryTree | | | | ✅ | ✅ 级联起点 |
|
|
15
15
|
| EffectFileUpload | ✅ 自动上传/手动上传 | ✅ SimpleFileData, UploadResult | ✅ uploadUploadFile | | ✅ handleUpload等 | ✅ Group | ✅ | ✅ WithFilePanel |
|
|
16
|
-
| EffectLabelSelect | ✅ 自定义数据源 | ✅ SelectOptionItem, LabelDic | ✅ 可自定义 | | | | ✅ | ✅ SearchSelect |
|
|
17
16
|
| EffectMerchantSelect | ✅ 搜索源切换 | ✅ MerchantOptions | ✅ useMerchantOptions | | | | ✅ | |
|
|
18
17
|
| EffectReservoirSelect | | | ✅ reservoirList | ✅ warehouseId | | | ✅ | ✅ WarehouseSelect |
|
|
19
18
|
| EffectSearchSelect | ✅ 自定义接口/搜索源 | ✅ EffectSearchSelectProps | ✅ useSWRImmutable | | | | ✅ | ✅ Label/Merchant |
|
|
@@ -36,7 +36,6 @@ description: >-
|
|
|
36
36
|
| EffectScopeSelect | `references/EffectScopeSelect.md` | 商品范围选择(复合组件) |
|
|
37
37
|
| EffectAddressCascade | `references/EffectAddressCascade.md` | 地址级联选择 |
|
|
38
38
|
| EffectBrandTransfer | `references/EffectBrandTransfer.md` | 品牌穿梭框 |
|
|
39
|
-
| EffectLabelSelect | `references/EffectLabelSelect.md` | 标签维度双选择器(已废弃) |
|
|
40
39
|
| EffectMerchantSelect | `references/EffectMerchantSelect.md` | 商户选择器 |
|
|
41
40
|
| EffectReservoirSelect | `references/EffectReservoirSelect.md` | 库区选择器 |
|
|
42
41
|
| EffectSearchSelect | `references/EffectSearchSelect.md` | 搜索源联想选择器 |
|
|
@@ -87,7 +87,6 @@ type StaffResponse = {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
type StaffItem = StaffResponse['list'][number]
|
|
90
|
-
|
|
91
90
|
;<EffectSearchSelect<StaffParams, StaffResponse, StaffItem, number, 'name' | 'phone'>
|
|
92
91
|
sources={[
|
|
93
92
|
{ label: '员工名', value: 'name' },
|
|
@@ -256,7 +255,6 @@ export type EffectSearchSelectProps
|
|
|
256
255
|
|
|
257
256
|
| 场景 | 组件 | 说明 |
|
|
258
257
|
| -------------- | ---------------------- | ------------------------------------------------ |
|
|
259
|
-
| 旧版标签搜索 | `EffectLabelSelect` | 已废弃,保留兼容;新业务优先使用本组件 |
|
|
260
258
|
| 旧版商户选择 | `EffectMerchantSelect` | 固定商户搜索源的旧组件 |
|
|
261
259
|
| API 配置 | `ConfigProvider` | 提供 `apiService.merchantList` 或其他 Effect API |
|
|
262
260
|
| 搜索表单中使用 | `SearchForm` | 常与 Form.Item 搜索条件一起使用 |
|
|
@@ -170,87 +170,3 @@ export const commonDateRangePickerGetValueProps: (dateStrs: string[] | null) =>
|
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
> 日期格式默认为 `'YYYY-MM-DD HH:mm:ss'`。
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
### getSelectValue / getStrValue 系列
|
|
177
|
-
|
|
178
|
-
配合旧组件 `EffectLabelSelect` 的 `customLabelInValue` 模式使用的解析函数组。当 EffectLabelSelect 设置了 `customLabelInValue` 后,value 不再是简单的 ID,而是一个分号分隔的组合字符串。
|
|
179
|
-
|
|
180
|
-
> 新业务优先使用 `EffectSearchSelect`,只有兼容旧字段格式时才需要这些函数。
|
|
181
|
-
|
|
182
|
-
导入:
|
|
183
|
-
|
|
184
|
-
```tsx
|
|
185
|
-
import { getSelectValue, getStrValue, getInitialValue, getFirstValue, getSecondValue } from '@xfe-repo/web-components'
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
#### getStrValue
|
|
189
|
-
|
|
190
|
-
生成分号分隔的组合字符串,由 EffectLabelSelect 内部调用。
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
export const getStrValue: (displayType: 'label' | 'value', value?: string, label?: string, labelDicKey?: string) => string | undefined
|
|
194
|
-
|
|
195
|
-
// 示例
|
|
196
|
-
getStrValue('label', '123', '张三', 'phone')
|
|
197
|
-
// => 'label;123;张三;phone'
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
#### getSelectValue
|
|
201
|
-
|
|
202
|
-
从分号分隔字符串中解析指定字段。
|
|
203
|
-
|
|
204
|
-
```typescript
|
|
205
|
-
type ReturnType = 'label' | 'value' | 'labelDicKey' | 'labelAndValue'
|
|
206
|
-
|
|
207
|
-
export const getSelectValue: (str?: string | null | number, returnType?: ReturnType) => string | undefined
|
|
208
|
-
|
|
209
|
-
// 示例
|
|
210
|
-
const str = 'label;123;张三;phone'
|
|
211
|
-
getSelectValue(str, 'value') // => '123'
|
|
212
|
-
getSelectValue(str, 'label') // => '张三'
|
|
213
|
-
getSelectValue(str, 'labelDicKey') // => 'phone'
|
|
214
|
-
getSelectValue(str, 'labelAndValue') // => '123 - 张三'
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
#### getInitialValue
|
|
218
|
-
|
|
219
|
-
拼接 `value - label` 展示格式。
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
export const getInitialValue: (label?: string, value?: string) => string
|
|
223
|
-
// getInitialValue('张三', '123') => '123 - 张三'
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
#### getFirstValue / getSecondValue
|
|
227
|
-
|
|
228
|
-
从 `value - label` 格式中提取各部分。
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
export const getFirstValue: (str?: string) => string // 提取 value
|
|
232
|
-
export const getSecondValue: (str?: string) => string // 提取 label
|
|
233
|
-
|
|
234
|
-
// getFirstValue('123 - 张三') => '123'
|
|
235
|
-
// getSecondValue('123 - 张三') => '张三'
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### 典型业务使用
|
|
239
|
-
|
|
240
|
-
配合 EffectLabelSelect 的 customLabelInValue 模式:
|
|
241
|
-
|
|
242
|
-
```tsx
|
|
243
|
-
// 搜索表单中使用 EffectLabelSelect
|
|
244
|
-
;<Form.Item name="merchantStr" noStyle>
|
|
245
|
-
<EffectLabelSelect customLabelInValue optionsDisplayType="labelAndValue" labelDic={{ phone: '手机号', name: '商户名' }} />
|
|
246
|
-
</Form.Item>
|
|
247
|
-
|
|
248
|
-
// 提交时解析值
|
|
249
|
-
const handleSubmit = (values) => {
|
|
250
|
-
const params = {
|
|
251
|
-
merchantId: getSelectValue(values.merchantStr, 'value'),
|
|
252
|
-
merchantName: getSelectValue(values.merchantStr, 'label'),
|
|
253
|
-
}
|
|
254
|
-
dispatch(fetchList(params))
|
|
255
|
-
}
|
|
256
|
-
```
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
# EffectLabelSelect
|
|
2
|
-
|
|
3
|
-
> 标签维度双选择器。左侧选择搜索维度,右侧根据选中维度远程搜索并选择具体值。该组件已在源码中标记为 `@deprecated`,新业务优先使用 `EffectSearchSelect`。
|
|
4
|
-
|
|
5
|
-
## 导入
|
|
6
|
-
|
|
7
|
-
```tsx
|
|
8
|
-
import { EffectLabelSelect } from '@xfe-repo/web-components'
|
|
9
|
-
import type { SelectOptionItem, LabelDic } from '@xfe-repo/web-components'
|
|
10
|
-
// 工具函数
|
|
11
|
-
import { getStrValue, getSelectValue, getInitialValue, getFirstValue, getSecondValue } from '@xfe-repo/web-components'
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## 基本用法
|
|
15
|
-
|
|
16
|
-
### 标准三件套模式
|
|
17
|
-
|
|
18
|
-
业务中最常见的使用方式 — 同时使用 `customLabelInValue` + `optionsDisplayType` + `labelDic`:
|
|
19
|
-
|
|
20
|
-
```tsx
|
|
21
|
-
<Form.Item name="merchantStr" noStyle>
|
|
22
|
-
<EffectLabelSelect customLabelInValue optionsDisplayType="labelAndValue" labelDic={{ phone: '手机号', name: '商户名称' }} />
|
|
23
|
-
</Form.Item>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
> 💡 三件套的含义:
|
|
27
|
-
>
|
|
28
|
-
> - `customLabelInValue`:value 格式为分号分隔字符串(`displayType;value;label;labelDicKey`)
|
|
29
|
-
> - `optionsDisplayType`:下拉选项展示格式(`labelAndValue` 显示为 `value - label`)
|
|
30
|
-
> - `labelDic`:自定义 label 字典,根据 `labelDicKey` 动态切换显示文案
|
|
31
|
-
|
|
32
|
-
### 独立受控模式
|
|
33
|
-
|
|
34
|
-
使用默认的商户号/商户名维度搜索商户列表:
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
import { EffectLabelSelect } from '@xfe-repo/web-components'
|
|
38
|
-
|
|
39
|
-
function MyForm() {
|
|
40
|
-
const [value, setValue] = useState<string>()
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<EffectLabelSelect
|
|
44
|
-
value={value}
|
|
45
|
-
onChange={(val, option) => {
|
|
46
|
-
setValue(val)
|
|
47
|
-
console.log('选中项:', option) // { label, value, customFields }
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## 进阶用法
|
|
55
|
-
|
|
56
|
-
### 自定义搜索维度
|
|
57
|
-
|
|
58
|
-
通过 `labelDic` 自定义左侧维度选项:
|
|
59
|
-
|
|
60
|
-
```tsx
|
|
61
|
-
const customLabelDic: LabelDic = {
|
|
62
|
-
phone: '手机号',
|
|
63
|
-
email: '邮箱',
|
|
64
|
-
name: '姓名',
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
<EffectLabelSelect
|
|
68
|
-
labelDic={customLabelDic}
|
|
69
|
-
defaultLabel="phone"
|
|
70
|
-
onFetchData={mySearchApi}
|
|
71
|
-
onTransformData={({ phone, email, name, ...rest }) => ({
|
|
72
|
-
label: name,
|
|
73
|
-
value: phone,
|
|
74
|
-
customFields: rest,
|
|
75
|
-
})}
|
|
76
|
-
onChange={(value) => console.log(value)}
|
|
77
|
-
/>
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### customLabelInValue 模式
|
|
81
|
-
|
|
82
|
-
当 `customLabelInValue` 为 `true` 时,value 会编码为 `展示类型;ID;名称;labelDicKey` 格式的字符串:
|
|
83
|
-
|
|
84
|
-
```tsx
|
|
85
|
-
<EffectLabelSelect
|
|
86
|
-
customLabelInValue
|
|
87
|
-
onChange={(value) => {
|
|
88
|
-
// value 格式如 "label;123;某某商户;businessNo"
|
|
89
|
-
console.log(value)
|
|
90
|
-
}}
|
|
91
|
-
/>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### 显示 ID + 名称
|
|
95
|
-
|
|
96
|
-
```tsx
|
|
97
|
-
<EffectLabelSelect optionsDisplayType="labelAndValue" />
|
|
98
|
-
// 选项显示为 "123456 - 某某商户"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 自定义 labelDic 文案
|
|
102
|
-
|
|
103
|
-
通过前缀区分不同场景的同类搜索:
|
|
104
|
-
|
|
105
|
-
```tsx
|
|
106
|
-
// 买家商户搜索
|
|
107
|
-
<EffectLabelSelect
|
|
108
|
-
customLabelInValue
|
|
109
|
-
optionsDisplayType="labelAndValue"
|
|
110
|
-
labelDic={{ phone: '买家手机号', name: '买家商户名' }}
|
|
111
|
-
/>
|
|
112
|
-
|
|
113
|
-
// 卖家商户搜索
|
|
114
|
-
<EffectLabelSelect
|
|
115
|
-
customLabelInValue
|
|
116
|
-
optionsDisplayType="labelAndValue"
|
|
117
|
-
labelDic={{ phone: '卖家手机号', name: '卖家商户名' }}
|
|
118
|
-
/>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Props
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
interface EffectLabelSelectProps extends Omit<SelectProps, 'onChange'> {
|
|
125
|
-
onChange?: (value?: string, selectedOptionItem?: SelectOptionItem) => void
|
|
126
|
-
defaultLabel?: string
|
|
127
|
-
labelDic?: LabelDic
|
|
128
|
-
value?: string
|
|
129
|
-
customLabelInValue?: boolean
|
|
130
|
-
onFetchData?: (params: any, config: any) => Promise<any>
|
|
131
|
-
onTransformData?: (params: Record<string, string>) => SelectOptionItem
|
|
132
|
-
fetchParams?: Object
|
|
133
|
-
optionsDisplayType?: 'labelAndValue'
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
138
|
-
| ------------------ | --------------------------------------- | ---- | ------------------------------------------ | --------------------------------------------------------- |
|
|
139
|
-
| value | `string` | 否 | - | 受控值 |
|
|
140
|
-
| onChange | `(value?, selectedOptionItem?) => void` | 否 | - | 值变化回调 |
|
|
141
|
-
| defaultLabel | `string` | 否 | `labelDic` 第一个 key | 默认选中的搜索维度 key |
|
|
142
|
-
| labelDic | `LabelDic` | 否 | `{ businessNo: '商户号', name: '商户名' }` | 搜索维度配置,key 为请求参数名,value 为显示文案 |
|
|
143
|
-
| customLabelInValue | `boolean` | 否 | `false` | 是否将 value 编码为 `展示类型;ID;名称;labelDicKey` 格式 |
|
|
144
|
-
| onFetchData | `(params, config) => Promise` | 否 | `apiService.merchantList` | 自定义数据请求函数 |
|
|
145
|
-
| onTransformData | `(params) => SelectOptionItem` | 否 | 默认转换函数 | 将接口返回的列表项转换为 `{ label, value, customFields }` |
|
|
146
|
-
| fetchParams | `Object` | 否 | `{}` | 额外请求参数,会合并到请求中 |
|
|
147
|
-
| optionsDisplayType | `'labelAndValue'` | 否 | - | 选项显示格式,设置后显示 `value - label` |
|
|
148
|
-
| disabled | `boolean` | 否 | - | 禁用状态 |
|
|
149
|
-
| className | `string` | 否 | - | 右侧 Select 的自定义样式类名 |
|
|
150
|
-
| style | `React.CSSProperties` | 否 | - | 自定义行内样式 |
|
|
151
|
-
|
|
152
|
-
## 导出类型
|
|
153
|
-
|
|
154
|
-
```typescript
|
|
155
|
-
// 选项数据结构
|
|
156
|
-
export type SelectOptionItem = {
|
|
157
|
-
value: string
|
|
158
|
-
label: string
|
|
159
|
-
customFields?: Object | null
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 搜索维度配置
|
|
163
|
-
export type LabelDic = Record<string, string>
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## 导出工具函数
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
// 编码 customLabelInValue 的值
|
|
170
|
-
export const getStrValue = (displayType: 'label' | 'value', value?: string, label?: string, labelDicKey?: string) => string | undefined
|
|
171
|
-
|
|
172
|
-
// 解码 customLabelInValue 的值
|
|
173
|
-
export const getSelectValue = (str?: string | null | number, returnType?: 'label' | 'value' | 'labelDicKey' | 'labelAndValue') =>
|
|
174
|
-
string | undefined
|
|
175
|
-
|
|
176
|
-
// 拼接 "value - label" 显示文本
|
|
177
|
-
export const getInitialValue = (label?: string, value?: string) => string
|
|
178
|
-
|
|
179
|
-
// 从 "value - label" 格式中取 value
|
|
180
|
-
export const getFirstValue = (str?: string) => string
|
|
181
|
-
|
|
182
|
-
// 从 "value - label" 格式中取 label
|
|
183
|
-
export const getSecondValue = (str?: string) => string
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
## API 数据源
|
|
187
|
-
|
|
188
|
-
- **内部 Hook**:`useReqData`(基于 `useAsyncFn` + `useDebounce`,600ms 防抖)
|
|
189
|
-
- **默认接口**:`apiService.merchantList`
|
|
190
|
-
- **请求参数**:`{ page: 1, pageSize: 20, [curSelectLabel]: curSearchValue, ...fetchParams }`
|
|
191
|
-
- **可覆盖**:通过 `onFetchData` prop 传入自定义请求函数,或通过 `<ConfigProvider apiService={{ merchantList: customFn }}>` 替换默认实现
|
|
192
|
-
|
|
193
|
-
## 常见陷阱
|
|
194
|
-
|
|
195
|
-
- ❌ 切换左侧维度后期望保留右侧已选值:
|
|
196
|
-
```tsx
|
|
197
|
-
// 切换维度时组件会自动清空右侧选择值和搜索结果
|
|
198
|
-
```
|
|
199
|
-
- ✅ 在 `onChange` 中处理值可能为 `undefined` 的情况
|
|
200
|
-
|
|
201
|
-
- ❌ 使用 `customLabelInValue` 模式时直接展示 value:
|
|
202
|
-
```tsx
|
|
203
|
-
// value 格式为 "label;123;某某商户;businessNo",不可直接展示
|
|
204
|
-
```
|
|
205
|
-
- ✅ 使用 `getSelectValue` 解析所需字段:
|
|
206
|
-
|
|
207
|
-
```tsx
|
|
208
|
-
const displayText = getSelectValue(value, 'label') // "某某商户"
|
|
209
|
-
const id = getSelectValue(value, 'value') // "123"
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
- ❌ 忘记提供 `onTransformData` 而使用非商户接口
|
|
213
|
-
- ✅ 当自定义 `onFetchData` 时,务必同时提供 `onTransformData` 确保数据格式正确
|
|
214
|
-
|
|
215
|
-
- ⚠️ 使用 `customLabelInValue` 时,初始值必须是分号分隔格式字符串(`displayType;value;label;labelDicKey`),不能直接传普通字符串或数字。
|
|
216
|
-
|
|
217
|
-
## 相关组件
|
|
218
|
-
|
|
219
|
-
| 场景 | 组件 | 说明 |
|
|
220
|
-
| ---------------- | ---------------------- | --------------------------------------- |
|
|
221
|
-
| 新版通用搜索联想 | `EffectSearchSelect` | 推荐使用,支持默认商户接口和自定义接口 |
|
|
222
|
-
| 商户选择旧组件 | `EffectMerchantSelect` | 固定商户搜索源的旧组件 |
|
|
223
|
-
| API 配置 | `ConfigProvider` | 提供 `apiService.merchantList` 接口实现 |
|