@bit-sun/business-component 4.0.13-alpha.1 → 4.0.13-alpha.11
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/components/Functional/SearchSelect/utils.d.ts +2 -0
- package/dist/index.esm.js +147 -69
- package/dist/index.js +147 -69
- package/package.json +2 -1
- package/src/components/Business/BsSulaQueryTable/setting.tsx +3 -3
- package/src/components/Business/BsSulaQueryTable/utils.tsx +2 -1
- package/src/components/Business/SearchSelect/BusinessUtils.tsx +14 -4
- package/src/components/Business/SearchSelect/index.md +1 -1
- package/src/components/Functional/DataValidation/index.tsx +1 -0
- package/src/components/Functional/QueryMutipleSelect/index.md +2 -3
- package/src/components/Functional/QueryMutipleSelect/index.tsx +3 -6
- package/src/components/Functional/SearchSelect/index.less +12 -6
- package/src/components/Functional/SearchSelect/index.tsx +12 -37
- package/src/components/Functional/SearchSelect/utils.tsx +40 -2
|
@@ -73,11 +73,6 @@
|
|
|
73
73
|
&_dropdown_table {
|
|
74
74
|
// padding: 4px 10px 6px;
|
|
75
75
|
|
|
76
|
-
// 下拉table 复选框为单选时候隐藏
|
|
77
|
-
.ant-table-cell .ant-table-selection-column .ant-radio,table tr td.ant-table-selection-column .ant-radio-wrapper {
|
|
78
|
-
display: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
76
|
// 下拉table 表头表体样式
|
|
82
77
|
.ant-table.ant-table-bordered > .ant-table-container > .ant-table-header > table {
|
|
83
78
|
font-family: MiSans-Regular;
|
|
@@ -103,7 +98,18 @@
|
|
|
103
98
|
.ant-table.ant-table-bordered > .ant-table-container {
|
|
104
99
|
.ant-table-body > table > tbody > tr > td.ant-table-selection-column,
|
|
105
100
|
.ant-table-header > table > thead > tr > th.ant-table-selection-column {
|
|
106
|
-
display: none;
|
|
101
|
+
visibility: hidden; // 不使用 display: none; 是因为此设置不占位,会导致表格scroll.x: 'max-content' 计算不准确
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: 0;
|
|
104
|
+
width: 0;
|
|
105
|
+
height: 0;
|
|
106
|
+
min-width: 0;
|
|
107
|
+
min-height: 0;
|
|
108
|
+
border: none;
|
|
109
|
+
|
|
110
|
+
.ant-radio-wrapper {
|
|
111
|
+
display: none;
|
|
112
|
+
}
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
}
|
|
@@ -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, handleTableColumns } 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,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
21
21
|
selectProps = {},
|
|
22
22
|
modalTableProps = {},
|
|
23
23
|
labelInValue = false,
|
|
24
|
-
|
|
24
|
+
needTopSelectedSource,
|
|
25
|
+
requestConfig:rCTemp,
|
|
25
26
|
ctx,
|
|
26
27
|
onlyShowStr = false,
|
|
27
28
|
sourceName,
|
|
@@ -51,7 +52,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
51
52
|
noOperate, // 级联禁用按钮设置字段
|
|
52
53
|
viewShowValueStr, // 详情展示值,不传展示组件处理的默认值
|
|
53
54
|
searchStartLength, // 默认不校验长度去搜索,如果配置了,则按照配置项长度进行处理搜索
|
|
54
|
-
} =
|
|
55
|
+
} = rCTemp || {};
|
|
56
|
+
const requestConfig = {url,method,otherParams,isMap,fixedparameter,fieldValToParam,fixedparamsDisabled,mappingTextField,mappingTextShowKeyField,mappingValueField,mappingTextShowTextField,init,extralHeaders,specialBracket,noNeedSplit,noOperate,viewShowValueStr,searchStartLength,...rCTemp};
|
|
55
57
|
const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
|
|
56
58
|
|
|
57
59
|
const selectMode = selectProps?.mode // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
|
|
@@ -80,7 +82,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
80
82
|
|
|
81
83
|
const initPagination = { showQuickJumper: true, showSizeChanger: true, showTotal: (total: any) => `共 ${total} 条`, pageSize: tableInitPageSize }
|
|
82
84
|
const tableInitPagination = { ...initPagination, total: 0, current: 1 }
|
|
83
|
-
const disabled = noOperate || selectProps?.disabled || props?.disabled;
|
|
85
|
+
const disabled = !!noOperate || selectProps?.disabled || props?.disabled;
|
|
84
86
|
const isHaveDependency = fixedparameter && fieldValToParam && ctx;
|
|
85
87
|
const isHaveDValue = () => {
|
|
86
88
|
let formValueList = [];
|
|
@@ -139,7 +141,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
139
141
|
const [indeterminate, setIndeterminate] = useState(false)
|
|
140
142
|
const [tableFormParams, setTableFormParams] = useState({});
|
|
141
143
|
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
142
|
-
const [tableShowColumns, setTabletShowColumns] = useState(modalTableProps?.tableColumns
|
|
144
|
+
const [tableShowColumns, setTabletShowColumns] = useState(handleTableColumns(modalTableProps?.tableColumns)); // 默认展示表头-modalTableProps?.tableColumns
|
|
143
145
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
144
146
|
const [modalSearched, setModalSearched]=useState(false);
|
|
145
147
|
|
|
@@ -233,7 +235,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
233
235
|
}
|
|
234
236
|
|
|
235
237
|
let getRequest;
|
|
236
|
-
const methodName = method?.toLocaleLowerCase();
|
|
238
|
+
const methodName = method?.toLocaleLowerCase?.();
|
|
237
239
|
if(['post','patch','put'].includes(methodName)) {
|
|
238
240
|
getRequest = request[methodName](`${url}${convertUrlQueryParams(queryParams)}`,convertBodyParams(queryParams))
|
|
239
241
|
} else {
|
|
@@ -250,7 +252,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
250
252
|
return;
|
|
251
253
|
}
|
|
252
254
|
const res = result.data;
|
|
253
|
-
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams });
|
|
255
|
+
const source: any = convertResData(requestConfig, res, { selectMode, labelInValue, value, type, items, queryParams, needTopSelectedSource });
|
|
254
256
|
|
|
255
257
|
if(callback) {
|
|
256
258
|
callback(source)
|
|
@@ -321,6 +323,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
321
323
|
|
|
322
324
|
useEffect(() => {
|
|
323
325
|
setUniqueValue(makeUniqueValue());
|
|
326
|
+
setTabletShowColumns(handleTableColumns(modalTableProps?.tableColumns));
|
|
324
327
|
}, [resultSourceKey])
|
|
325
328
|
|
|
326
329
|
useEffect(() => {
|
|
@@ -811,34 +814,6 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
811
814
|
);
|
|
812
815
|
}
|
|
813
816
|
|
|
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
817
|
const isShouldShowStr = (props.disabled && ctx) || ctx?.mode == 'view';
|
|
843
818
|
return (
|
|
844
819
|
<div className={'search_select'}>
|
|
@@ -853,8 +828,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
|
|
|
853
828
|
</div>
|
|
854
829
|
) : (
|
|
855
830
|
isShouldShowStr ?
|
|
856
|
-
(<div title={getShowStr()} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
857
|
-
{getShowStr()}
|
|
831
|
+
(<div title={getShowStr({ viewShowValueStr, labelInValue, selectMode, value, items })} style={{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'}} className={'search_select_show'}>
|
|
832
|
+
{getShowStr({viewShowValueStr, labelInValue, selectMode, value, items })}
|
|
858
833
|
</div>) :
|
|
859
834
|
<div
|
|
860
835
|
className={`${isFormPage ? '' : 'search_select_show_list'} search_select_show`}
|
|
@@ -366,7 +366,6 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
|
|
|
366
366
|
}
|
|
367
367
|
return (
|
|
368
368
|
<Tooltip
|
|
369
|
-
open={true}
|
|
370
369
|
overlayClassName='searchSelectMaxTagToolTip'
|
|
371
370
|
destroyTooltipOnHide
|
|
372
371
|
placement="topRight"
|
|
@@ -398,4 +397,43 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
|
|
|
398
397
|
)
|
|
399
398
|
}
|
|
400
399
|
|
|
401
|
-
//
|
|
400
|
+
// 弹窗数据表头处理
|
|
401
|
+
export const handleTableColumns = (tableColumns: any) => {
|
|
402
|
+
// 按照默认设置排序 > 没有排序字段的展示所有列表头 > 没有表头列不展示
|
|
403
|
+
const showTableColumns = tableColumns?.filter((s: any) => typeof s.defaultSort == 'number')||tableColumns||[];
|
|
404
|
+
return showTableColumns?.sort((a: any,b: any)=> a.defaultSort-b.defaultSort)||[]
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
// ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
|
|
412
|
+
const getShowLabelTextStr = ({ kongValue, selectMode, value, items }: any) => {
|
|
413
|
+
if (selectMode) {
|
|
414
|
+
return Array.isArray(value) && value?.map(item => item.label || item.text || '')?.join(',') || kongValue;
|
|
415
|
+
}
|
|
416
|
+
return (value?.label || value?.text || kongValue) as string;
|
|
417
|
+
};
|
|
418
|
+
const getSelectValueText = (v: any, items: any) => {
|
|
419
|
+
return (items || []).filter((item: any) => item.value === v)?.[0]?.text || v || '';
|
|
420
|
+
}
|
|
421
|
+
const getShowValueStr = ({ kongValue, selectMode, value, items }: any): string => {
|
|
422
|
+
if (selectMode) {
|
|
423
|
+
return Array.isArray(value) && value?.map(item => getSelectValueText(item, items))?.join(',') || kongValue;
|
|
424
|
+
}
|
|
425
|
+
return (getSelectValueText(value, items) || kongValue) as string;
|
|
426
|
+
}
|
|
427
|
+
export const getShowStr = ({ viewShowValueStr, labelInValue, selectMode, value, items }: any) => {
|
|
428
|
+
// 优先使用业务使用传入的展示
|
|
429
|
+
if(viewShowValueStr) return viewShowValueStr;
|
|
430
|
+
|
|
431
|
+
const kongValue = '无'
|
|
432
|
+
// 先判断labelInValue与否,labelInValue可以直接去value中获取字段名称,否则去下拉框数据里面去拿;
|
|
433
|
+
// 再判断是单选还是多选,数据类型不同取值方式也不同
|
|
434
|
+
if (labelInValue) {
|
|
435
|
+
return getShowLabelTextStr({ kongValue, selectMode, value, items});
|
|
436
|
+
}
|
|
437
|
+
return getShowValueStr({ kongValue, selectMode, value, items });
|
|
438
|
+
}
|
|
439
|
+
// ------------------------------------------ 选中数据展示 相关处理--结束---------------------------------------
|