@bit-sun/business-component 2.2.0-alpha.25 → 2.2.0-alpha.26

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
@@ -2701,9 +2701,11 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2701
2701
  sksResult = selectRows.map(function (i) {
2702
2702
  return i.value;
2703
2703
  });
2704
- // 单选直接选中 不需要确定
2705
- handleSelectOver(filterRows);
2706
- handleCancel();
2704
+ // 单选 默认直接选中 不需要确定 配置了modalRadioNeedFooter就需要确定
2705
+ if (!(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter)) {
2706
+ handleSelectOver(filterRows);
2707
+ handleCancel();
2708
+ }
2707
2709
  }
2708
2710
  setSelectedRowKeys(sksResult);
2709
2711
  setPopValue(filterRows);
@@ -2916,8 +2918,8 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2916
2918
  placeholder: "\u8BF7\u9009\u62E9",
2917
2919
  maxTagPlaceholder: maxTagPlaceholder
2918
2920
  }, currentSelectProps), {}, {
2919
- getPopupContainer: function getPopupContainer() {
2920
- return _getPopupContainer && _getPopupContainer() || document.getElementById("search_select_div_".concat(uniqueValue));
2921
+ getPopupContainer: function getPopupContainer(triggerNode) {
2922
+ return _getPopupContainer && _getPopupContainer(triggerNode) || triggerNode.parentElement;
2921
2923
  }
2922
2924
  }), items.map(function (item) {
2923
2925
  return /*#__PURE__*/React.createElement(Option, {
@@ -2935,13 +2937,13 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2935
2937
  },
2936
2938
  onClick: showModal,
2937
2939
  type: "primary"
2938
- }, /*#__PURE__*/React.createElement(SearchOutlined, null))), needModalTable && isModalVisible && /*#__PURE__*/React.createElement(Modal, {
2940
+ }, /*#__PURE__*/React.createElement(SearchOutlined, null))), needModalTable && isModalVisible && /*#__PURE__*/React.createElement(Modal, _objectSpread2({
2939
2941
  width: '80%',
2940
2942
  title: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalTableTitle,
2941
2943
  visible: isModalVisible,
2942
2944
  onOk: handleOk,
2943
2945
  onCancel: handleCancel,
2944
- footer: selectMode ? [/*#__PURE__*/React.createElement(Button, {
2946
+ footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [/*#__PURE__*/React.createElement(Button, {
2945
2947
  key: "back",
2946
2948
  onClick: handleCancel
2947
2949
  }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
@@ -2950,7 +2952,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
2950
2952
  onClick: handleOk,
2951
2953
  disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
2952
2954
  }, "\u786E\u5B9A")] : null
2953
- }, /*#__PURE__*/React.createElement("div", {
2955
+ }, (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalProps) || {}), /*#__PURE__*/React.createElement("div", {
2954
2956
  className: 'search_select_wrapper'
2955
2957
  }, /*#__PURE__*/React.createElement("div", {
2956
2958
  className: 'search_select_wrapper_click_flag',
@@ -10218,15 +10220,22 @@ var AddSelect = function AddSelect(props) {
10218
10220
  return _ref4.apply(this, arguments);
10219
10221
  };
10220
10222
  }();
10221
- var setBusinessDefaultValue = function setBusinessDefaultValue(list, record) {
10222
- var _record$colorValues;
10223
+ var setBusinessDefaultValue = function setBusinessDefaultValue(list, recordList) {
10223
10224
  var result = list;
10224
- if (businessType == 'spu' && (record === null || record === void 0 ? void 0 : (_record$colorValues = record.colorValues) === null || _record$colorValues === void 0 ? void 0 : _record$colorValues.length) == 1) {
10225
+ if (businessType == 'spu' && ((recordList === null || recordList === void 0 ? void 0 : recordList.some(function (i) {
10226
+ var _i$colorValues;
10227
+ return (i === null || i === void 0 ? void 0 : (_i$colorValues = i.colorValues) === null || _i$colorValues === void 0 ? void 0 : _i$colorValues.length) == 1;
10228
+ })) || (recordList === null || recordList === void 0 ? void 0 : recordList.some(function (i) {
10229
+ return i === null || i === void 0 ? void 0 : i.defaultMatchingCode;
10230
+ })))) {
10225
10231
  result = list.map(function (i) {
10226
- if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
10227
- var _record$colorValues$;
10228
- i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
10229
- }
10232
+ recordList.forEach(function (record) {
10233
+ if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
10234
+ var _record$colorValues$;
10235
+ i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
10236
+ i.selectPropertyGroupCode = record === null || record === void 0 ? void 0 : record.defaultMatchingCode;
10237
+ }
10238
+ });
10230
10239
  return i;
10231
10240
  });
10232
10241
  }
@@ -10835,16 +10844,15 @@ var AddSelect = function AddSelect(props) {
10835
10844
  }
10836
10845
  }
10837
10846
  if (isAllowRepeatedSelect) {
10838
- var newUuid = uuid();
10839
- var list = popvalue.concat(selectRows).map(function (i) {
10847
+ var handleSelectRows = selectRows.map(function (i) {
10848
+ var newUuid = uuid();
10840
10849
  return _objectSpread2(_objectSpread2({}, i), {}, {
10841
- uuid: i.uuid || newUuid
10850
+ uuid: newUuid
10842
10851
  });
10843
10852
  });
10844
- var recordItem = _objectSpread2(_objectSpread2({}, selectRows[0]), {}, {
10845
- uuid: newUuid
10846
- });
10847
- setPopValue(setBusinessDefaultValue(list, recordItem));
10853
+ var list = popvalue.concat(handleSelectRows);
10854
+ var recordList = handleSelectRows;
10855
+ setPopValue(setBusinessDefaultValue(list, recordList));
10848
10856
  setSelectedRowKeys([]);
10849
10857
  } else {
10850
10858
  setPopValue(selectRows);
@@ -14920,6 +14928,7 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
14920
14928
  filter: 'qp-itemCode,name-orGroup,like',
14921
14929
  otherParams: {
14922
14930
  'qp-approveStatus-eq': 1,
14931
+ 'qp-status-eq': 1,
14923
14932
  sorter: 'desc-id'
14924
14933
  },
14925
14934
  mappingTextField: 'name',
@@ -15436,8 +15445,8 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
15436
15445
  maxTagPlaceholder: maxTagPlaceholder,
15437
15446
  onChange: handleChange,
15438
15447
  disabled: disabled || mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
15439
- getPopupContainer: function getPopupContainer() {
15440
- return _getPopupContainer && _getPopupContainer() || document.body;
15448
+ getPopupContainer: function getPopupContainer(triggerNode) {
15449
+ return _getPopupContainer && _getPopupContainer(triggerNode) || document.body;
15441
15450
  }
15442
15451
  })));
15443
15452
  };
package/dist/index.js CHANGED
@@ -2719,9 +2719,11 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2719
2719
  sksResult = selectRows.map(function (i) {
2720
2720
  return i.value;
2721
2721
  });
2722
- // 单选直接选中 不需要确定
2723
- handleSelectOver(filterRows);
2724
- handleCancel();
2722
+ // 单选 默认直接选中 不需要确定 配置了modalRadioNeedFooter就需要确定
2723
+ if (!(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter)) {
2724
+ handleSelectOver(filterRows);
2725
+ handleCancel();
2726
+ }
2725
2727
  }
2726
2728
  setSelectedRowKeys(sksResult);
2727
2729
  setPopValue(filterRows);
@@ -2934,8 +2936,8 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2934
2936
  placeholder: "\u8BF7\u9009\u62E9",
2935
2937
  maxTagPlaceholder: maxTagPlaceholder
2936
2938
  }, currentSelectProps), {}, {
2937
- getPopupContainer: function getPopupContainer() {
2938
- return _getPopupContainer && _getPopupContainer() || document.getElementById("search_select_div_".concat(uniqueValue));
2939
+ getPopupContainer: function getPopupContainer(triggerNode) {
2940
+ return _getPopupContainer && _getPopupContainer(triggerNode) || triggerNode.parentElement;
2939
2941
  }
2940
2942
  }), items.map(function (item) {
2941
2943
  return /*#__PURE__*/React__default['default'].createElement(Option, {
@@ -2953,13 +2955,13 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2953
2955
  },
2954
2956
  onClick: showModal,
2955
2957
  type: "primary"
2956
- }, /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null))), needModalTable && isModalVisible && /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
2958
+ }, /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null))), needModalTable && isModalVisible && /*#__PURE__*/React__default['default'].createElement(antd.Modal, _objectSpread2({
2957
2959
  width: '80%',
2958
2960
  title: modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalTableTitle,
2959
2961
  visible: isModalVisible,
2960
2962
  onOk: handleOk,
2961
2963
  onCancel: handleCancel,
2962
- footer: selectMode ? [/*#__PURE__*/React__default['default'].createElement(antd.Button, {
2964
+ footer: selectMode || (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalRadioNeedFooter) ? [/*#__PURE__*/React__default['default'].createElement(antd.Button, {
2963
2965
  key: "back",
2964
2966
  onClick: handleCancel
2965
2967
  }, "\u53D6\u6D88"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
@@ -2968,7 +2970,7 @@ var SearchSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
2968
2970
  onClick: handleOk,
2969
2971
  disabled: !tableData.length || (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) || (props === null || props === void 0 ? void 0 : props.disabled)
2970
2972
  }, "\u786E\u5B9A")] : null
2971
- }, /*#__PURE__*/React__default['default'].createElement("div", {
2973
+ }, (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.modalProps) || {}), /*#__PURE__*/React__default['default'].createElement("div", {
2972
2974
  className: 'search_select_wrapper'
2973
2975
  }, /*#__PURE__*/React__default['default'].createElement("div", {
2974
2976
  className: 'search_select_wrapper_click_flag',
@@ -10236,15 +10238,22 @@ var AddSelect = function AddSelect(props) {
10236
10238
  return _ref4.apply(this, arguments);
10237
10239
  };
10238
10240
  }();
10239
- var setBusinessDefaultValue = function setBusinessDefaultValue(list, record) {
10240
- var _record$colorValues;
10241
+ var setBusinessDefaultValue = function setBusinessDefaultValue(list, recordList) {
10241
10242
  var result = list;
10242
- if (businessType == 'spu' && (record === null || record === void 0 ? void 0 : (_record$colorValues = record.colorValues) === null || _record$colorValues === void 0 ? void 0 : _record$colorValues.length) == 1) {
10243
+ if (businessType == 'spu' && ((recordList === null || recordList === void 0 ? void 0 : recordList.some(function (i) {
10244
+ var _i$colorValues;
10245
+ return (i === null || i === void 0 ? void 0 : (_i$colorValues = i.colorValues) === null || _i$colorValues === void 0 ? void 0 : _i$colorValues.length) == 1;
10246
+ })) || (recordList === null || recordList === void 0 ? void 0 : recordList.some(function (i) {
10247
+ return i === null || i === void 0 ? void 0 : i.defaultMatchingCode;
10248
+ })))) {
10243
10249
  result = list.map(function (i) {
10244
- if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
10245
- var _record$colorValues$;
10246
- i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
10247
- }
10250
+ recordList.forEach(function (record) {
10251
+ if (i.uuid == (record === null || record === void 0 ? void 0 : record.uuid)) {
10252
+ var _record$colorValues$;
10253
+ i.colorName = (_record$colorValues$ = record.colorValues[0]) === null || _record$colorValues$ === void 0 ? void 0 : _record$colorValues$.value;
10254
+ i.selectPropertyGroupCode = record === null || record === void 0 ? void 0 : record.defaultMatchingCode;
10255
+ }
10256
+ });
10248
10257
  return i;
10249
10258
  });
10250
10259
  }
@@ -10853,16 +10862,15 @@ var AddSelect = function AddSelect(props) {
10853
10862
  }
10854
10863
  }
10855
10864
  if (isAllowRepeatedSelect) {
10856
- var newUuid = uuid();
10857
- var list = popvalue.concat(selectRows).map(function (i) {
10865
+ var handleSelectRows = selectRows.map(function (i) {
10866
+ var newUuid = uuid();
10858
10867
  return _objectSpread2(_objectSpread2({}, i), {}, {
10859
- uuid: i.uuid || newUuid
10868
+ uuid: newUuid
10860
10869
  });
10861
10870
  });
10862
- var recordItem = _objectSpread2(_objectSpread2({}, selectRows[0]), {}, {
10863
- uuid: newUuid
10864
- });
10865
- setPopValue(setBusinessDefaultValue(list, recordItem));
10871
+ var list = popvalue.concat(handleSelectRows);
10872
+ var recordList = handleSelectRows;
10873
+ setPopValue(setBusinessDefaultValue(list, recordList));
10866
10874
  setSelectedRowKeys([]);
10867
10875
  } else {
10868
10876
  setPopValue(selectRows);
@@ -14938,6 +14946,7 @@ var AddSpuSelect = function AddSpuSelect(parProps) {
14938
14946
  filter: 'qp-itemCode,name-orGroup,like',
14939
14947
  otherParams: {
14940
14948
  'qp-approveStatus-eq': 1,
14949
+ 'qp-status-eq': 1,
14941
14950
  sorter: 'desc-id'
14942
14951
  },
14943
14952
  mappingTextField: 'name',
@@ -15454,8 +15463,8 @@ var TreeSearchSelect = function TreeSearchSelect(props) {
15454
15463
  maxTagPlaceholder: maxTagPlaceholder,
15455
15464
  onChange: handleChange,
15456
15465
  disabled: disabled || mode === 'view' || (ctx === null || ctx === void 0 ? void 0 : ctx.mode) === 'view',
15457
- getPopupContainer: function getPopupContainer() {
15458
- return _getPopupContainer && _getPopupContainer() || document.body;
15466
+ getPopupContainer: function getPopupContainer(triggerNode) {
15467
+ return _getPopupContainer && _getPopupContainer(triggerNode) || document.body;
15459
15468
  }
15460
15469
  })));
15461
15470
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "2.2.0-alpha.25",
3
+ "version": "2.2.0-alpha.26",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -691,6 +691,7 @@ export const AddSpuSelect = (parProps: any) => {
691
691
  filter: 'qp-itemCode,name-orGroup,like', // 过滤参数
692
692
  otherParams: {
693
693
  'qp-approveStatus-eq': 1, // 审核状态(0.待审批;1.审批通过;2.驳回;3.审批未通过)
694
+ 'qp-status-eq': 1,
694
695
  sorter: 'desc-id'
695
696
  }, // 默认参数
696
697
  mappingTextField: 'name',
@@ -117,6 +117,10 @@ export default () => {
117
117
  maxTagCount: 1,
118
118
  }
119
119
 
120
+ const singleConfirmModalTableProps = {
121
+ modalRadioNeedFooter: true
122
+ }
123
+
120
124
  const [ tabKey, setTabKey ] = useState('single')
121
125
  const [value, setValue] = useState(selectProps?.mode ? [] : null);
122
126
 
@@ -153,6 +157,11 @@ export default () => {
153
157
  <BusinessSearchSelect {...props} />
154
158
  )}
155
159
  </TabPane>
160
+ <TabPane tab='单选弹窗可点击确定' key='singleConfirm'>
161
+ {tabKey === 'singleConfirm' && (
162
+ <BusinessSearchSelect {...props} modalTableProps={singleConfirmModalTableProps} />
163
+ )}
164
+ </TabPane>
156
165
  <TabPane tab='多选' key='multiple'>
157
166
  {tabKey === 'multiple' && (
158
167
  <BusinessSearchSelect {...props} selectProps={selectPropsMultiple} />
@@ -1225,7 +1234,7 @@ export default () => {
1225
1234
 
1226
1235
  const onTabChange = (key) => {
1227
1236
  setTabKey(key)
1228
- setValue(key === 'single' ? null: [])
1237
+ setValue(key === 'multiple' ? []: null)
1229
1238
  }
1230
1239
 
1231
1240
  return (
@@ -229,13 +229,16 @@ const AddSelect = (props: any) => {
229
229
  }
230
230
  return true
231
231
  }
232
- const setBusinessDefaultValue = (list: any, record: any) => {
232
+ const setBusinessDefaultValue = (list: any, recordList: any) => {
233
233
  let result = list;
234
- if(businessType == 'spu' && record?.colorValues?.length == 1) {
234
+ if(businessType == 'spu' && (recordList?.some((i: any) => i?.colorValues?.length == 1) || recordList?.some((i: any) => i?.defaultMatchingCode))) {
235
235
  result = list.map((i: any) => {
236
- if(i.uuid == record?.uuid) {
237
- i.colorName = record.colorValues[0]?.value
238
- }
236
+ recordList.forEach((record: any) => {
237
+ if(i.uuid == record?.uuid) {
238
+ i.colorName = record.colorValues[0]?.value;
239
+ i.selectPropertyGroupCode = record?.defaultMatchingCode;
240
+ }
241
+ })
239
242
  return i
240
243
  })
241
244
  }
@@ -896,10 +899,13 @@ const AddSelect = (props: any) => {
896
899
  }
897
900
  }
898
901
  if(isAllowRepeatedSelect) {
899
- const newUuid = uuid();
900
- const list = popvalue.concat(selectRows).map((i: any) => ({...i, uuid: i.uuid || newUuid}));
901
- const recordItem = {...selectRows[0], uuid: newUuid }
902
- setPopValue(setBusinessDefaultValue(list,recordItem));
902
+ const handleSelectRows = selectRows.map((i: any) => {
903
+ const newUuid = uuid();
904
+ return {...i, uuid: newUuid}
905
+ })
906
+ const list = popvalue.concat(handleSelectRows);
907
+ const recordList = handleSelectRows
908
+ setPopValue(setBusinessDefaultValue(list,recordList));
903
909
  setSelectedRowKeys([])
904
910
  } else {
905
911
  setPopValue(selectRows);
@@ -586,9 +586,11 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
586
586
  // 处理单选
587
587
  filterRows = selectRows;
588
588
  sksResult = selectRows.map((i) => i.value)
589
- // 单选直接选中 不需要确定
590
- handleSelectOver(filterRows)
591
- handleCancel();
589
+ // 单选 默认直接选中 不需要确定 配置了modalRadioNeedFooter就需要确定
590
+ if(!modalTableProps?.modalRadioNeedFooter) {
591
+ handleSelectOver(filterRows)
592
+ handleCancel();
593
+ }
592
594
  }
593
595
 
594
596
  setSelectedRowKeys(sksResult)
@@ -759,7 +761,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
759
761
  placeholder="请选择"
760
762
  maxTagPlaceholder={maxTagPlaceholder}
761
763
  {...currentSelectProps}
762
- getPopupContainer={() => (getPopupContainer && getPopupContainer()) || document.getElementById(`search_select_div_${uniqueValue}`)}
764
+ getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || triggerNode.parentElement}
763
765
  >
764
766
  {items.map(item => (
765
767
  <Option key={item.value} label={item.text}>
@@ -780,7 +782,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
780
782
  visible={isModalVisible}
781
783
  onOk={handleOk}
782
784
  onCancel={handleCancel}
783
- footer={selectMode ? [
785
+ footer={(selectMode || modalTableProps?.modalRadioNeedFooter) ? [
784
786
  <Button key="back" onClick={handleCancel}>
785
787
  取消
786
788
  </Button>,
@@ -793,6 +795,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
793
795
  确定
794
796
  </Button>,
795
797
  ] : null}
798
+ {...(modalTableProps?.modalProps || {})}
796
799
  >
797
800
  <div className={'search_select_wrapper'}>
798
801
  <div className={'search_select_wrapper_click_flag'} onClick={() => setCaretLeftFlag(!caretLeftFlag)}>
@@ -152,7 +152,7 @@ const TreeSearchSelect = (props: any) => {
152
152
  maxTagPlaceholder={maxTagPlaceholder}
153
153
  onChange={handleChange}
154
154
  disabled={disabled || mode==='view' || ctx?.mode === 'view'}
155
- getPopupContainer={() => (getPopupContainer && getPopupContainer()) || document.body}
155
+ getPopupContainer={(triggerNode) => (getPopupContainer && getPopupContainer(triggerNode)) || document.body}
156
156
  >
157
157
  </TreeSelect>
158
158
  </div>