@bit-sun/business-component 4.2.1-alpha.29-aiwei → 4.2.1-alpha.30-aiwei

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.esm.js CHANGED
@@ -19784,6 +19784,13 @@ var css_248z$j = "#bs-sula-query-table .ant-table-title + .ant-table-container t
19784
19784
  styleInject(css_248z$j);
19785
19785
 
19786
19786
  var _excluded$i = ["onResize", "width"];
19787
+ /**
19788
+ * 获取列或搜索字段的稳定标识,用于过滤已经从最新配置中删除的项目。
19789
+ */
19790
+ var getConfigItemKey = function getConfigItemKey(item, type) {
19791
+ var value = type === 'columns' ? (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.dataIndex) : item === null || item === void 0 ? void 0 : item.name;
19792
+ return Array.isArray(value) ? JSON.stringify(value) : value || '';
19793
+ };
19787
19794
  var MemoQueryTable = /*#__PURE__*/React$1.memo(QueryTable);
19788
19795
  var Text$2 = Typography.Text;
19789
19796
  var ResizeableTitle$2 = function ResizeableTitle(props) {
@@ -19998,6 +20005,12 @@ var BsSulaQueryTable = (function (props) {
19998
20005
  var value = props;
19999
20006
  var _props$fields = props.fields,
20000
20007
  fields = _props$fields === void 0 ? [] : _props$fields;
20008
+ var columnsStructureKey = JSON.stringify((props.columns || []).map(function (item) {
20009
+ return getConfigItemKey(item, 'columns');
20010
+ }));
20011
+ var fieldsStructureKey = JSON.stringify((props.fields || []).map(function (item) {
20012
+ return getConfigItemKey(item, 'searchFields');
20013
+ }));
20001
20014
  var _useState11 = useState([]),
20002
20015
  _useState12 = _slicedToArray(_useState11, 2),
20003
20016
  showColumn = _useState12[0],
@@ -20116,35 +20129,21 @@ var BsSulaQueryTable = (function (props) {
20116
20129
  //组件初始挂载
20117
20130
  useEffect(function () {
20118
20131
  // getTableHeight();
20119
- setInitialTableInfo();
20120
- setInitialSearchFieldsInfo();
20121
20132
  window.addEventListener('resize', function (e) {
20122
20133
  watchWinResize();
20123
20134
  });
20124
20135
  setPagePath(pathname); // 做处理,记录当前页面渲染的初始pathname,用于进行判断当前列表页面数据是否需要重新渲染
20125
20136
  }, []);
20126
20137
  useEffect(function () {
20127
- if ((props === null || props === void 0 ? void 0 : props.columns) && (value === null || value === void 0 ? void 0 : value.columns)) {
20128
- var newKeys = props.columns.map(function (d) {
20129
- return Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : d.key || d.dataIndex;
20130
- });
20131
- var oldKeys = value.columns.map(function (d) {
20132
- return Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : d.key || d.dataIndex;
20133
- });
20134
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialTableInfo();
20138
+ if (props === null || props === void 0 ? void 0 : props.columns) {
20139
+ setInitialTableInfo();
20135
20140
  }
20136
- }, [props === null || props === void 0 ? void 0 : props.columns]);
20141
+ }, [columnsStructureKey]);
20137
20142
  useEffect(function () {
20138
- if ((props === null || props === void 0 ? void 0 : props.fields) && (value === null || value === void 0 ? void 0 : value.fields)) {
20139
- var newKeys = props.fields.map(function (d) {
20140
- return Array.isArray(d.name) ? JSON.stringify(d.name) : d.name;
20141
- });
20142
- var oldKeys = value.fields.map(function (d) {
20143
- return Array.isArray(d.name) ? JSON.stringify(d.name) : d.name;
20144
- });
20145
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialSearchFieldsInfo();
20143
+ if (props === null || props === void 0 ? void 0 : props.fields) {
20144
+ setInitialSearchFieldsInfo();
20146
20145
  }
20147
- }, [props === null || props === void 0 ? void 0 : props.fields]);
20146
+ }, [fieldsStructureKey]);
20148
20147
  useEffect(function () {
20149
20148
  setInitialTableInfo();
20150
20149
  }, [props === null || props === void 0 ? void 0 : props.refreshColumns]);
@@ -20387,9 +20386,15 @@ var BsSulaQueryTable = (function (props) {
20387
20386
  };
20388
20387
  var getColumns = function getColumns() {
20389
20388
  // 优化一下 减少复杂度
20390
- var titleMap = toMapByKey(value.columns, 'title');
20389
+ var currentColumns = value.columns || [];
20390
+ var currentColumnKeys = new Set(currentColumns.map(function (item) {
20391
+ return getConfigItemKey(item, 'columns');
20392
+ }));
20393
+ var titleMap = toMapByKey(currentColumns, 'title');
20391
20394
  // 加上排序
20392
- var cols = showColumn.map(function (i) {
20395
+ var cols = showColumn.filter(function (i) {
20396
+ return currentColumnKeys.has(getConfigItemKey(i, 'columns'));
20397
+ }).map(function (i) {
20393
20398
  var _titleMap$renderToStr, _titleMap$renderToStr2;
20394
20399
  return _objectSpread2(_objectSpread2({}, i), {}, {
20395
20400
  isPermissionColumn: (_titleMap$renderToStr = titleMap[renderToString(i.title)]) === null || _titleMap$renderToStr === void 0 ? void 0 : _titleMap$renderToStr.isPermissionColumn,
@@ -20460,7 +20465,11 @@ var BsSulaQueryTable = (function (props) {
20460
20465
  }
20461
20466
  }) : false,
20462
20467
  columns: _toConsumableArray(getColumns()),
20463
- fields: _toConsumableArray(showSearchFields),
20468
+ fields: _toConsumableArray(showSearchFields.filter(function (item) {
20469
+ return new Set((value.fields || []).map(function (field) {
20470
+ return getConfigItemKey(field, 'searchFields');
20471
+ })).has(getConfigItemKey(item, 'searchFields'));
20472
+ })),
20464
20473
  ref: props.forwardedRef || refs,
20465
20474
  isFullScreen: isFullScreen
20466
20475
  });
@@ -36577,7 +36586,7 @@ var RuleField = /*#__PURE__*/function (_Component) {
36577
36586
  });
36578
36587
  }
36579
36588
  }
36580
- // 库存组织选择器
36589
+ // 库存组织选择器(与结算组织 290 对齐:不加 treeCheckStrictly,避免 labelInValue 回传结构异常导致 params 为空)
36581
36590
  if (dataChoiceBusinessType == 280) {
36582
36591
  if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
36583
36592
  return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement(BusinessTreeSearchSelect$1, {
@@ -36587,7 +36596,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36587
36596
  labelInValue: true,
36588
36597
  value: dataInputBusinessType === 12 ? values : values[0],
36589
36598
  style: styleCommon,
36590
- treeCheckStrictly: true,
36591
36599
  onChange: function onChange(value) {
36592
36600
  if (dataInputBusinessType === 12) {
36593
36601
  values[0] = value.map(function (i) {
@@ -36612,7 +36620,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36612
36620
  labelInValue: true,
36613
36621
  value: dataInputBusinessType === 12 ? values : values[0],
36614
36622
  style: styleCommon,
36615
- treeCheckStrictly: true,
36616
36623
  onChange: function onChange(value) {
36617
36624
  if (dataInputBusinessType === 12) {
36618
36625
  values[1] = value.map(function (i) {
@@ -36639,7 +36646,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36639
36646
  labelInValue: true,
36640
36647
  value: dataInputBusinessType === 12 ? values : values[0],
36641
36648
  style: styleCommon,
36642
- treeCheckStrictly: true,
36643
36649
  onChange: function onChange(value) {
36644
36650
  if (dataInputBusinessType === 12) {
36645
36651
  values = value.map(function (i) {
package/dist/index.js CHANGED
@@ -19807,6 +19807,13 @@ var css_248z$j = "#bs-sula-query-table .ant-table-title + .ant-table-container t
19807
19807
  styleInject(css_248z$j);
19808
19808
 
19809
19809
  var _excluded$i = ["onResize", "width"];
19810
+ /**
19811
+ * 获取列或搜索字段的稳定标识,用于过滤已经从最新配置中删除的项目。
19812
+ */
19813
+ var getConfigItemKey = function getConfigItemKey(item, type) {
19814
+ var value = type === 'columns' ? (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.dataIndex) : item === null || item === void 0 ? void 0 : item.name;
19815
+ return Array.isArray(value) ? JSON.stringify(value) : value || '';
19816
+ };
19810
19817
  var MemoQueryTable = /*#__PURE__*/React__default['default'].memo(bssula.QueryTable);
19811
19818
  var Text$2 = antd.Typography.Text;
19812
19819
  var ResizeableTitle$2 = function ResizeableTitle(props) {
@@ -20021,6 +20028,12 @@ var BsSulaQueryTable = (function (props) {
20021
20028
  var value = props;
20022
20029
  var _props$fields = props.fields,
20023
20030
  fields = _props$fields === void 0 ? [] : _props$fields;
20031
+ var columnsStructureKey = JSON.stringify((props.columns || []).map(function (item) {
20032
+ return getConfigItemKey(item, 'columns');
20033
+ }));
20034
+ var fieldsStructureKey = JSON.stringify((props.fields || []).map(function (item) {
20035
+ return getConfigItemKey(item, 'searchFields');
20036
+ }));
20024
20037
  var _useState11 = React$1.useState([]),
20025
20038
  _useState12 = _slicedToArray(_useState11, 2),
20026
20039
  showColumn = _useState12[0],
@@ -20139,35 +20152,21 @@ var BsSulaQueryTable = (function (props) {
20139
20152
  //组件初始挂载
20140
20153
  React$1.useEffect(function () {
20141
20154
  // getTableHeight();
20142
- setInitialTableInfo();
20143
- setInitialSearchFieldsInfo();
20144
20155
  window.addEventListener('resize', function (e) {
20145
20156
  watchWinResize();
20146
20157
  });
20147
20158
  setPagePath(pathname); // 做处理,记录当前页面渲染的初始pathname,用于进行判断当前列表页面数据是否需要重新渲染
20148
20159
  }, []);
20149
20160
  React$1.useEffect(function () {
20150
- if ((props === null || props === void 0 ? void 0 : props.columns) && (value === null || value === void 0 ? void 0 : value.columns)) {
20151
- var newKeys = props.columns.map(function (d) {
20152
- return Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : d.key || d.dataIndex;
20153
- });
20154
- var oldKeys = value.columns.map(function (d) {
20155
- return Array.isArray(d.key || d.dataIndex) ? JSON.stringify(d.key || d.dataIndex) : d.key || d.dataIndex;
20156
- });
20157
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialTableInfo();
20161
+ if (props === null || props === void 0 ? void 0 : props.columns) {
20162
+ setInitialTableInfo();
20158
20163
  }
20159
- }, [props === null || props === void 0 ? void 0 : props.columns]);
20164
+ }, [columnsStructureKey]);
20160
20165
  React$1.useEffect(function () {
20161
- if ((props === null || props === void 0 ? void 0 : props.fields) && (value === null || value === void 0 ? void 0 : value.fields)) {
20162
- var newKeys = props.fields.map(function (d) {
20163
- return Array.isArray(d.name) ? JSON.stringify(d.name) : d.name;
20164
- });
20165
- var oldKeys = value.fields.map(function (d) {
20166
- return Array.isArray(d.name) ? JSON.stringify(d.name) : d.name;
20167
- });
20168
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) && setInitialSearchFieldsInfo();
20166
+ if (props === null || props === void 0 ? void 0 : props.fields) {
20167
+ setInitialSearchFieldsInfo();
20169
20168
  }
20170
- }, [props === null || props === void 0 ? void 0 : props.fields]);
20169
+ }, [fieldsStructureKey]);
20171
20170
  React$1.useEffect(function () {
20172
20171
  setInitialTableInfo();
20173
20172
  }, [props === null || props === void 0 ? void 0 : props.refreshColumns]);
@@ -20410,9 +20409,15 @@ var BsSulaQueryTable = (function (props) {
20410
20409
  };
20411
20410
  var getColumns = function getColumns() {
20412
20411
  // 优化一下 减少复杂度
20413
- var titleMap = toMapByKey(value.columns, 'title');
20412
+ var currentColumns = value.columns || [];
20413
+ var currentColumnKeys = new Set(currentColumns.map(function (item) {
20414
+ return getConfigItemKey(item, 'columns');
20415
+ }));
20416
+ var titleMap = toMapByKey(currentColumns, 'title');
20414
20417
  // 加上排序
20415
- var cols = showColumn.map(function (i) {
20418
+ var cols = showColumn.filter(function (i) {
20419
+ return currentColumnKeys.has(getConfigItemKey(i, 'columns'));
20420
+ }).map(function (i) {
20416
20421
  var _titleMap$renderToStr, _titleMap$renderToStr2;
20417
20422
  return _objectSpread2(_objectSpread2({}, i), {}, {
20418
20423
  isPermissionColumn: (_titleMap$renderToStr = titleMap[renderToString(i.title)]) === null || _titleMap$renderToStr === void 0 ? void 0 : _titleMap$renderToStr.isPermissionColumn,
@@ -20483,7 +20488,11 @@ var BsSulaQueryTable = (function (props) {
20483
20488
  }
20484
20489
  }) : false,
20485
20490
  columns: _toConsumableArray(getColumns()),
20486
- fields: _toConsumableArray(showSearchFields),
20491
+ fields: _toConsumableArray(showSearchFields.filter(function (item) {
20492
+ return new Set((value.fields || []).map(function (field) {
20493
+ return getConfigItemKey(field, 'searchFields');
20494
+ })).has(getConfigItemKey(item, 'searchFields'));
20495
+ })),
20487
20496
  ref: props.forwardedRef || refs,
20488
20497
  isFullScreen: isFullScreen
20489
20498
  });
@@ -36600,7 +36609,7 @@ var RuleField = /*#__PURE__*/function (_Component) {
36600
36609
  });
36601
36610
  }
36602
36611
  }
36603
- // 库存组织选择器
36612
+ // 库存组织选择器(与结算组织 290 对齐:不加 treeCheckStrictly,避免 labelInValue 回传结构异常导致 params 为空)
36604
36613
  if (dataChoiceBusinessType == 280) {
36605
36614
  if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
36606
36615
  return /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(BusinessTreeSearchSelect$1, {
@@ -36610,7 +36619,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36610
36619
  labelInValue: true,
36611
36620
  value: dataInputBusinessType === 12 ? values : values[0],
36612
36621
  style: styleCommon,
36613
- treeCheckStrictly: true,
36614
36622
  onChange: function onChange(value) {
36615
36623
  if (dataInputBusinessType === 12) {
36616
36624
  values[0] = value.map(function (i) {
@@ -36635,7 +36643,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36635
36643
  labelInValue: true,
36636
36644
  value: dataInputBusinessType === 12 ? values : values[0],
36637
36645
  style: styleCommon,
36638
- treeCheckStrictly: true,
36639
36646
  onChange: function onChange(value) {
36640
36647
  if (dataInputBusinessType === 12) {
36641
36648
  values[1] = value.map(function (i) {
@@ -36662,7 +36669,6 @@ var RuleField = /*#__PURE__*/function (_Component) {
36662
36669
  labelInValue: true,
36663
36670
  value: dataInputBusinessType === 12 ? values : values[0],
36664
36671
  style: styleCommon,
36665
- treeCheckStrictly: true,
36666
36672
  onChange: function onChange(value) {
36667
36673
  if (dataInputBusinessType === 12) {
36668
36674
  values = value.map(function (i) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "4.2.1-alpha.29-aiwei",
3
+ "version": "4.2.1-alpha.30-aiwei",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -38,6 +38,14 @@ interface Field {
38
38
  field: any;
39
39
  }
40
40
 
41
+ /**
42
+ * 获取列或搜索字段的稳定标识,用于过滤已经从最新配置中删除的项目。
43
+ */
44
+ const getConfigItemKey = (item: any, type: 'columns' | 'searchFields') => {
45
+ const value = type === 'columns' ? item?.key || item?.dataIndex : item?.name;
46
+ return Array.isArray(value) ? JSON.stringify(value) : value || '';
47
+ };
48
+
41
49
  const MemoQueryTable = React.memo(QueryTable);
42
50
  const { Text } = Typography;
43
51
 
@@ -267,6 +275,16 @@ export default (props: any) => {
267
275
  // @ts-nocheck
268
276
  const value = props;
269
277
  const { fields = [] } = props;
278
+ const columnsStructureKey = JSON.stringify(
279
+ (props.columns || []).map((item: any) =>
280
+ getConfigItemKey(item, 'columns'),
281
+ ),
282
+ );
283
+ const fieldsStructureKey = JSON.stringify(
284
+ (props.fields || []).map((item: any) =>
285
+ getConfigItemKey(item, 'searchFields'),
286
+ ),
287
+ );
270
288
  const [showColumn, setShowColumns] = useState([]); // 列字段
271
289
  const originSearchFields = getSettingFieldOrColumn(
272
290
  getConfigFromlocalstorage(ENUM.BROWSER_CACHE.SEARCH_FIELDS_CONDITION),
@@ -446,8 +464,6 @@ export default (props: any) => {
446
464
  //组件初始挂载
447
465
  useEffect(() => {
448
466
  // getTableHeight();
449
- setInitialTableInfo();
450
- setInitialSearchFieldsInfo();
451
467
  window.addEventListener('resize', (e) => {
452
468
  watchWinResize();
453
469
  });
@@ -456,34 +472,16 @@ export default (props: any) => {
456
472
  }, []);
457
473
 
458
474
  useEffect(() => {
459
- if (props?.columns && value?.columns) {
460
- let newKeys = props.columns.map((d: any) =>
461
- Array.isArray(d.key || d.dataIndex)
462
- ? JSON.stringify(d.key || d.dataIndex)
463
- : d.key || d.dataIndex,
464
- );
465
- let oldKeys = value.columns.map((d: any) =>
466
- Array.isArray(d.key || d.dataIndex)
467
- ? JSON.stringify(d.key || d.dataIndex)
468
- : d.key || d.dataIndex,
469
- );
470
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) &&
471
- setInitialTableInfo();
475
+ if (props?.columns) {
476
+ setInitialTableInfo();
472
477
  }
473
- }, [props?.columns]);
478
+ }, [columnsStructureKey]);
474
479
 
475
480
  useEffect(() => {
476
- if (props?.fields && value?.fields) {
477
- let newKeys = props.fields.map((d: any) =>
478
- Array.isArray(d.name) ? JSON.stringify(d.name) : d.name,
479
- );
480
- let oldKeys = value.fields.map((d: any) =>
481
- Array.isArray(d.name) ? JSON.stringify(d.name) : d.name,
482
- );
483
- JSON.stringify(newKeys) !== JSON.stringify(oldKeys) &&
484
- setInitialSearchFieldsInfo();
481
+ if (props?.fields) {
482
+ setInitialSearchFieldsInfo();
485
483
  }
486
- }, [props?.fields]);
484
+ }, [fieldsStructureKey]);
487
485
 
488
486
  useEffect(() => {
489
487
  setInitialTableInfo();
@@ -771,9 +769,15 @@ export default (props: any) => {
771
769
  };
772
770
  const getColumns = () => {
773
771
  // 优化一下 减少复杂度
774
- const titleMap = toMapByKey(value.columns, 'title');
772
+ const currentColumns = value.columns || [];
773
+ const currentColumnKeys = new Set(
774
+ currentColumns.map((item: any) => getConfigItemKey(item, 'columns')),
775
+ );
776
+ const titleMap = toMapByKey(currentColumns, 'title');
775
777
  // 加上排序
776
- const cols = showColumn.map((i) => ({
778
+ const cols = showColumn.filter((i: any) =>
779
+ currentColumnKeys.has(getConfigItemKey(i, 'columns')),
780
+ ).map((i) => ({
777
781
  ...i,
778
782
  isPermissionColumn: titleMap[renderToString(i.title)]?.isPermissionColumn,
779
783
  render: titleMap[renderToString(i.title)]?.render,
@@ -846,7 +850,15 @@ export default (props: any) => {
846
850
  },
847
851
  } : false,
848
852
  columns: [...getColumns()],
849
- fields: [...showSearchFields],
853
+ fields: [
854
+ ...showSearchFields.filter((item: any) =>
855
+ new Set(
856
+ (value.fields || []).map((field: any) =>
857
+ getConfigItemKey(field, 'searchFields'),
858
+ ),
859
+ ).has(getConfigItemKey(item, 'searchFields')),
860
+ ),
861
+ ],
850
862
  ref: props.forwardedRef || refs,
851
863
  isFullScreen,
852
864
  };
@@ -1804,7 +1804,7 @@ export default class RuleField extends Component {
1804
1804
  );
1805
1805
  }
1806
1806
  }
1807
- // 库存组织选择器
1807
+ // 库存组织选择器(与结算组织 290 对齐:不加 treeCheckStrictly,避免 labelInValue 回传结构异常导致 params 为空)
1808
1808
  if (dataChoiceBusinessType == 280) {
1809
1809
  if (INTERVAL_TYPE.indexOf(selectOperation) > -1) {
1810
1810
  return (
@@ -1816,7 +1816,6 @@ export default class RuleField extends Component {
1816
1816
  labelInValue={true}
1817
1817
  value={dataInputBusinessType === 12 ? values : values[0]}
1818
1818
  style={styleCommon}
1819
- treeCheckStrictly={true}
1820
1819
  onChange={(value) => {
1821
1820
  if (dataInputBusinessType === 12) {
1822
1821
  values[0] = value.map((i) => i.key);
@@ -1837,7 +1836,6 @@ export default class RuleField extends Component {
1837
1836
  labelInValue={true}
1838
1837
  value={dataInputBusinessType === 12 ? values : values[0]}
1839
1838
  style={styleCommon}
1840
- treeCheckStrictly={true}
1841
1839
  onChange={(value) => {
1842
1840
  if (dataInputBusinessType === 12) {
1843
1841
  values[1] = value.map((i) => i.key);
@@ -1861,7 +1859,6 @@ export default class RuleField extends Component {
1861
1859
  labelInValue={true}
1862
1860
  value={dataInputBusinessType === 12 ? values : values[0]}
1863
1861
  style={styleCommon}
1864
- treeCheckStrictly={true}
1865
1862
  onChange={(value) => {
1866
1863
  if (dataInputBusinessType === 12) {
1867
1864
  values = value.map((i) => i.key)||[];