@bit-sun/business-component 4.0.13-alpha.2 → 4.0.13-alpha.4
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/Untitled-1 +0 -0
- package/dist/components/Business/BsSulaQueryTable/utils.d.ts +1 -1
- package/dist/components/Functional/SearchSelect/utils.d.ts +1 -0
- package/dist/index.esm.js +514 -495
- package/dist/index.js +515 -496
- package/package.json +1 -1
- package/src/components/Business/BsSulaQueryTable/utils.tsx +1 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +5 -0
- package/src/components/Business/SearchSelect/index.md +1 -1
- package/src/components/Functional/QueryMutipleSelect/index.tsx +1 -1
- package/src/components/Functional/SearchSelect/index.tsx +8 -35
- package/src/components/Functional/SearchSelect/utils.tsx +33 -1
package/package.json
CHANGED
|
@@ -30,7 +30,6 @@ import { getMenuAuthDataKey } from '@/utils/LocalstorageUtils';
|
|
|
30
30
|
import noImg from '../../../assets/list-no-img.svg';
|
|
31
31
|
import qs from 'qs';
|
|
32
32
|
import { shouldUseAuth } from '@/utils';
|
|
33
|
-
import * as ReactDOMServer from 'react-dom/server';
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
export const handleStatusBadge = (text: any, color: any) => {
|
|
@@ -723,6 +722,7 @@ export const authFn = (code?: any) => {
|
|
|
723
722
|
export const renderToString = (
|
|
724
723
|
render: ReactElement<any, string | JSXElementConstructor<any>> | string,
|
|
725
724
|
) => {
|
|
725
|
+
return render;
|
|
726
726
|
return typeof render === 'string'
|
|
727
727
|
? render
|
|
728
728
|
: ReactDOMServer.renderToString(render);
|
|
@@ -342,6 +342,7 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
342
342
|
specialBracket: true,
|
|
343
343
|
otherParams: {
|
|
344
344
|
'ownOrgSign': getCurrentTargetBgId(),
|
|
345
|
+
'ctl-count': true
|
|
345
346
|
}, // 默认参数
|
|
346
347
|
},
|
|
347
348
|
}
|
|
@@ -360,6 +361,10 @@ export function commonFun (type?: string, prefixUrl: any, parentProps?:any) {
|
|
|
360
361
|
mappingValueField: 'itemCode',
|
|
361
362
|
sourceName: 'qp-itemCode-in',
|
|
362
363
|
specialBracket: true,
|
|
364
|
+
otherParams: {
|
|
365
|
+
'ownOrgSign': getCurrentTargetBgId(),
|
|
366
|
+
'ctl-count': true
|
|
367
|
+
}, // 默认参数
|
|
363
368
|
},
|
|
364
369
|
}
|
|
365
370
|
} },
|
|
@@ -167,7 +167,7 @@ const QueryMutipleSearchSelect = ({ onValueChange, requestConfig={}, selectProps
|
|
|
167
167
|
<Spin size="small" className='searchSelectSpin' />
|
|
168
168
|
) : (
|
|
169
169
|
<div style={{ textAlign: 'center' }}>
|
|
170
|
-
<div>{searchValue?'无匹配结果,请更换其他内容再试'
|
|
170
|
+
<div>{searchValue?'无匹配结果,请更换其他内容再试': (selectProps?.notFoundText||`请录入编码/名称模糊查询`)}</div>
|
|
171
171
|
</div>
|
|
172
172
|
)
|
|
173
173
|
}
|
|
@@ -7,7 +7,7 @@ import request from '@/utils/request';
|
|
|
7
7
|
import _, { escapeRegExp, isNil, values } from "lodash"
|
|
8
8
|
import './index.less';
|
|
9
9
|
import { BusinessSearchSelect, QueryMutipleInput, QueryMutipleSearchSelect } from '@/index';
|
|
10
|
-
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder } from './utils';
|
|
10
|
+
import { handleSourceName, getFormRowInfo, hasMoreQueryFields, defaultVisibleFieldsCount, getRealStr, ColSpan, getTableHeigth, getCurrentSRKs, getRenderSource, handleParams, convertUrlQueryParams, convertBodyParams, formatSelectedValue, convertResData, makeUniqueValue, handleSelectOptionsShowValue, LightHeightOption, maxTagPlaceholder, getShowStr } from './utils';
|
|
11
11
|
import { judgeIsRequestError } from '@/utils/requestUtils';
|
|
12
12
|
import zhankaitiaojian from '../../../assets/zhankaitiaojian-icon.svg';
|
|
13
13
|
import PropertySelector from '@/components/Business/PropertyModal';
|
|
@@ -21,7 +21,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
21
21
|
selectProps = {},
|
|
22
22
|
modalTableProps = {},
|
|
23
23
|
labelInValue = false,
|
|
24
|
-
requestConfig,
|
|
24
|
+
requestConfig:rCTemp,
|
|
25
25
|
ctx,
|
|
26
26
|
onlyShowStr = false,
|
|
27
27
|
sourceName,
|
|
@@ -51,7 +51,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
51
51
|
noOperate, // 级联禁用按钮设置字段
|
|
52
52
|
viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
|
|
53
53
|
searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
|
|
54
|
-
} =
|
|
54
|
+
} = rCTemp || {};
|
|
55
|
+
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
55
56
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
56
57
|
|
|
57
58
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -80,7 +81,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
80
81
|
|
|
81
82
|
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
|
|
82
83
|
const tableInitPagination = { ...initPagination, total: 0, current: 1 }
|
|
83
|
-
const disabled = noOperate || selectProps?.disabled || props?.disabled;
|
|
84
|
+
const disabled = !!noOperate || selectProps?.disabled || props?.disabled;
|
|
84
85
|
const isHaveDependency = fixedparameter && fieldValToParam && ctx;
|
|
85
86
|
const isHaveDValue = () => {
|
|
86
87
|
let formValueList = [];
|
|
@@ -233,7 +234,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
let getRequest;
|
|
236
|
-
const methodName = method?.toLocaleLowerCase();
|
|
237
|
+
const methodName = method?.toLocaleLowerCase?.();
|
|
237
238
|
if(['post','patch','put'].includes(methodName)) {
|
|
238
239
|
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
239
240
|
} else {
|
|
@@ -811,34 +812,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
811
812
|
);
|
|
812
813
|
}
|
|
813
814
|
|
|
814
|
-
const getShowLabelTextStr = (kongValue): string => {
|
|
815
|
-
if (selectMode) {
|
|
816
|
-
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
817
|
-
}
|
|
818
|
-
return (value?.label || value?.text || kongValue) as string;
|
|
819
|
-
};
|
|
820
|
-
const getSelectValueText = (v: any) => {
|
|
821
|
-
return (items || []).filter(item => item.value === v)?.[0]?.text || v || '';
|
|
822
|
-
}
|
|
823
|
-
const getShowValueStr = (kongValue): string => {
|
|
824
|
-
if (selectMode) {
|
|
825
|
-
return Array.isArray(value) && value?.map(item => getSelectValueText(item))?.join(',') || kongValue;
|
|
826
|
-
}
|
|
827
|
-
return (getSelectValueText(value) || kongValue) as string;
|
|
828
|
-
}
|
|
829
|
-
const getShowStr = () => {
|
|
830
|
-
// 优先使用业务使用传入的展示
|
|
831
|
-
if(viewShowValueStr) return viewShowValueStr;
|
|
832
|
-
|
|
833
|
-
const kongValue = '无'
|
|
834
|
-
// 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
|
|
835
|
-
// 再判断是单选还是多选,数据类型不同取值方式也不同
|
|
836
|
-
if (labelInValue) {
|
|
837
|
-
return getShowLabelTextStr(kongValue);
|
|
838
|
-
}
|
|
839
|
-
return getShowValueStr(kongValue);
|
|
840
|
-
}
|
|
841
|
-
|
|
842
815
|
const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
|
|
843
816
|
return (
|
|
844
817
|
<div className={'search_select'}>
|
|
@@ -853,8 +826,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
853
826
|
</div>
|
|
854
827
|
) : (
|
|
855
828
|
isShouldShowStr ?
|
|
856
|
-
(<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
857
|
-
{getShowStr()}
|
|
829
|
+
(<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
830
|
+
{getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
|
|
858
831
|
</div>) :
|
|
859
832
|
<div
|
|
860
833
|
className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
|
|
@@ -397,4 +397,36 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
|
|
|
397
397
|
)
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
// ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
|
|
400
|
+
// ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
// ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
|
|
405
|
+
const getShowLabelTextStr = ({ kongValue, selectMode, value, items }: any) => {
|
|
406
|
+
if (selectMode) {
|
|
407
|
+
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
408
|
+
}
|
|
409
|
+
return (value?.label || value?.text || kongValue) as string;
|
|
410
|
+
};
|
|
411
|
+
const getSelectValueText = (v: any, items: any) => {
|
|
412
|
+
return (items || []).filter((item: any) => item.value === v)?.[0]?.text || v || '';
|
|
413
|
+
}
|
|
414
|
+
const getShowValueStr = ({ kongValue, selectMode, value, items }: any): string => {
|
|
415
|
+
if (selectMode) {
|
|
416
|
+
return Array.isArray(value) && value?.map(item => getSelectValueText(item, items))?.join(',') || kongValue;
|
|
417
|
+
}
|
|
418
|
+
return (getSelectValueText(value, items) || kongValue) as string;
|
|
419
|
+
}
|
|
420
|
+
export const getShowStr = ({ viewShowValueStr, labelInValue, selectMode, value, items }: any) => {
|
|
421
|
+
// 优先使用业务使用传入的展示
|
|
422
|
+
if(viewShowValueStr) return viewShowValueStr;
|
|
423
|
+
|
|
424
|
+
const kongValue = '无'
|
|
425
|
+
// 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
|
|
426
|
+
// 再判断是单选还是多选,数据类型不同取值方式也不同
|
|
427
|
+
if (labelInValue) {
|
|
428
|
+
return getShowLabelTextStr({ kongValue, selectMode, value, items});
|
|
429
|
+
}
|
|
430
|
+
return getShowValueStr({ kongValue, selectMode, value, items });
|
|
431
|
+
}
|
|
432
|
+
// ------------------------------------------ 选中数据展示 相关处理--结束---------------------------------------
|