@bit-sun/business-component 4.0.13-alpha.5 → 4.0.13-alpha.6

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.
@@ -25,4 +25,5 @@ export declare const convertResData: (requestConfig: any, res: any, selectProps:
25
25
  export declare const handleSelectOptionsShowValue: (specialBracket: boolean, noNeedSplit: boolean, item: any) => any;
26
26
  export declare const LightHeightOption: (props: any) => React.JSX.Element;
27
27
  export declare const maxTagPlaceholder: (selectedValues: any, { selectProps, onChange, value, setIsMaxTagsOpen }: any) => React.JSX.Element;
28
+ export declare const handleTableColumns: (tableColumns: any) => any;
28
29
  export declare const getShowStr: ({ viewShowValueStr, labelInValue, selectMode, value, items }: any) => any;
package/dist/index.esm.js CHANGED
@@ -4465,6 +4465,16 @@ var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref3) {
4465
4465
  })))
4466
4466
  }, "+ ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length));
4467
4467
  };
4468
+ // 弹窗数据表头处理
4469
+ var handleTableColumns = function handleTableColumns(tableColumns) {
4470
+ // 按照默认设置排序 > 没有排序字段的展示所有列表头 > 没有表头列不展示
4471
+ var showTableColumns = (tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.filter(function (s) {
4472
+ return typeof s.defaultSort == 'number';
4473
+ })) || tableColumns || [];
4474
+ return (showTableColumns === null || showTableColumns === void 0 ? void 0 : showTableColumns.sort(function (a, b) {
4475
+ return a.defaultSort - b.defaultSort;
4476
+ })) || [];
4477
+ };
4468
4478
  // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
4469
4479
  // ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
4470
4480
  var getShowLabelTextStr = function getShowLabelTextStr(_ref4) {
@@ -5223,7 +5233,7 @@ var PropertySelector = function PropertySelector(_ref) {
5223
5233
 
5224
5234
  var Option$1 = Select.Option;
5225
5235
  var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5226
- var _pathname$match, _modalTableProps$tabl, _modalTableProps$tabl2;
5236
+ var _pathname$match;
5227
5237
  var value = props.value,
5228
5238
  onChangeTemp = props.onChange,
5229
5239
  _props$selectProps = props.selectProps,
@@ -5446,14 +5456,10 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5446
5456
  _useState40 = _slicedToArray(_useState39, 2),
5447
5457
  tooltipVisible = _useState40[0],
5448
5458
  setTooltipVisible = _useState40[1];
5449
- var _useState41 = useState((modalTableProps === null || modalTableProps === void 0 ? void 0 : (_modalTableProps$tabl = modalTableProps.tableColumns) === null || _modalTableProps$tabl === void 0 ? void 0 : (_modalTableProps$tabl2 = _modalTableProps$tabl.filter(function (s) {
5450
- return typeof s.defaultSort == 'number';
5451
- })) === null || _modalTableProps$tabl2 === void 0 ? void 0 : _modalTableProps$tabl2.sort(function (a, b) {
5452
- return a.defaultSort - b.defaultSort;
5453
- })) || []),
5459
+ var _useState41 = useState(handleTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns)),
5454
5460
  _useState42 = _slicedToArray(_useState41, 2),
5455
5461
  tableShowColumns = _useState42[0],
5456
- setTabletShowColumns = _useState42[1];
5462
+ setTabletShowColumns = _useState42[1]; // 默认展示表头-modalTableProps?.tableColumns
5457
5463
  var _useState43 = useState(false),
5458
5464
  _useState44 = _slicedToArray(_useState43, 2),
5459
5465
  confirmLoading = _useState44[0],
@@ -5655,6 +5661,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5655
5661
  }, [value]);
5656
5662
  useEffect(function () {
5657
5663
  setUniqueValue(makeUniqueValue());
5664
+ setTabletShowColumns(handleTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns));
5658
5665
  }, [resultSourceKey]);
5659
5666
  useEffect(function () {
5660
5667
  if (init) {
package/dist/index.js CHANGED
@@ -4488,6 +4488,16 @@ var maxTagPlaceholder = function maxTagPlaceholder(selectedValues, _ref3) {
4488
4488
  })))
4489
4489
  }, "+ ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.length));
4490
4490
  };
4491
+ // 弹窗数据表头处理
4492
+ var handleTableColumns = function handleTableColumns(tableColumns) {
4493
+ // 按照默认设置排序 > 没有排序字段的展示所有列表头 > 没有表头列不展示
4494
+ var showTableColumns = (tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.filter(function (s) {
4495
+ return typeof s.defaultSort == 'number';
4496
+ })) || tableColumns || [];
4497
+ return (showTableColumns === null || showTableColumns === void 0 ? void 0 : showTableColumns.sort(function (a, b) {
4498
+ return a.defaultSort - b.defaultSort;
4499
+ })) || [];
4500
+ };
4491
4501
  // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
4492
4502
  // ------------------------------------------ 选中数据展示 相关处理--开始----------------------------------------
4493
4503
  var getShowLabelTextStr = function getShowLabelTextStr(_ref4) {
@@ -5246,7 +5256,7 @@ var PropertySelector = function PropertySelector(_ref) {
5246
5256
 
5247
5257
  var Option$1 = antd.Select.Option;
5248
5258
  var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5249
- var _pathname$match, _modalTableProps$tabl, _modalTableProps$tabl2;
5259
+ var _pathname$match;
5250
5260
  var value = props.value,
5251
5261
  onChangeTemp = props.onChange,
5252
5262
  _props$selectProps = props.selectProps,
@@ -5469,14 +5479,10 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5469
5479
  _useState40 = _slicedToArray(_useState39, 2),
5470
5480
  tooltipVisible = _useState40[0],
5471
5481
  setTooltipVisible = _useState40[1];
5472
- var _useState41 = React$1.useState((modalTableProps === null || modalTableProps === void 0 ? void 0 : (_modalTableProps$tabl = modalTableProps.tableColumns) === null || _modalTableProps$tabl === void 0 ? void 0 : (_modalTableProps$tabl2 = _modalTableProps$tabl.filter(function (s) {
5473
- return typeof s.defaultSort == 'number';
5474
- })) === null || _modalTableProps$tabl2 === void 0 ? void 0 : _modalTableProps$tabl2.sort(function (a, b) {
5475
- return a.defaultSort - b.defaultSort;
5476
- })) || []),
5482
+ var _useState41 = React$1.useState(handleTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns)),
5477
5483
  _useState42 = _slicedToArray(_useState41, 2),
5478
5484
  tableShowColumns = _useState42[0],
5479
- setTabletShowColumns = _useState42[1];
5485
+ setTabletShowColumns = _useState42[1]; // 默认展示表头-modalTableProps?.tableColumns
5480
5486
  var _useState43 = React$1.useState(false),
5481
5487
  _useState44 = _slicedToArray(_useState43, 2),
5482
5488
  confirmLoading = _useState44[0],
@@ -5678,6 +5684,7 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5678
5684
  }, [value]);
5679
5685
  React$1.useEffect(function () {
5680
5686
  setUniqueValue(makeUniqueValue());
5687
+ setTabletShowColumns(handleTableColumns(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.tableColumns));
5681
5688
  }, [resultSourceKey]);
5682
5689
  React$1.useEffect(function () {
5683
5690
  if (init) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.0.13-alpha.5",
3
+ "version": "4.0.13-alpha.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -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, getShowStr } 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';
@@ -140,7 +140,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
140
140
  const [indeterminate, setIndeterminate] = useState(false)
141
141
  const [tableFormParams, setTableFormParams] = useState({});
142
142
  const [tooltipVisible, setTooltipVisible] = useState(false);
143
- const [tableShowColumns, setTabletShowColumns] = useState(modalTableProps?.tableColumns?.filter(s => typeof s.defaultSort == 'number')?.sort((a,b)=> a.defaultSort-b.defaultSort)||[]);
143
+ const [tableShowColumns, setTabletShowColumns] = useState(handleTableColumns(modalTableProps?.tableColumns)); // 默认展示表头-modalTableProps?.tableColumns
144
144
  const [confirmLoading, setConfirmLoading] = useState(false);
145
145
  const [modalSearched, setModalSearched]=useState(false);
146
146
 
@@ -322,6 +322,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
322
322
 
323
323
  useEffect(() => {
324
324
  setUniqueValue(makeUniqueValue());
325
+ setTabletShowColumns(handleTableColumns(modalTableProps?.tableColumns));
325
326
  }, [resultSourceKey])
326
327
 
327
328
  useEffect(() => {
@@ -397,6 +397,13 @@ export const maxTagPlaceholder = (selectedValues: any, { selectProps, onChange,
397
397
  )
398
398
  }
399
399
 
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
+
400
407
  // ------------------------------------------ 数据源展示 相关处理--结束----------------------------------------
401
408
 
402
409