@bit-sun/business-component 3.1.10-alpha.10 → 3.1.10-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/index.esm.js CHANGED
@@ -4105,7 +4105,9 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
4105
4105
  _ref$noNeedSplit = _ref.noNeedSplit,
4106
4106
  noNeedSplit = _ref$noNeedSplit === void 0 ? false : _ref$noNeedSplit,
4107
4107
  _ref$method = _ref.method,
4108
- method = _ref$method === void 0 ? 'get' : _ref$method;
4108
+ method = _ref$method === void 0 ? 'get' : _ref$method,
4109
+ _ref$onlyOneDateSelec = _ref.onlyOneDateSelected,
4110
+ onlyOneDateSelected = _ref$onlyOneDateSelec === void 0 ? false : _ref$onlyOneDateSelec;
4109
4111
  var resultSourceKey = handleSourceName(sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || (ctx === null || ctx === void 0 ? void 0 : ctx.name) || 'supplierCode');
4110
4112
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
4111
4113
  var initVal = value || (selectMode ? [] : null);
@@ -4466,6 +4468,10 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
4466
4468
  if (type === 1) {
4467
4469
  var _ctx$form;
4468
4470
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
4471
+ if (onlyOneDateSelected === true && source.length === 1) {
4472
+ var _ctx$form2;
4473
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(resultSourceKey, source[0]['value']);
4474
+ }
4469
4475
  setItems(source);
4470
4476
  setItemsTotal(Number((res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : res.totalCount) || source.length));
4471
4477
  } else {
@@ -4583,10 +4589,10 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
4583
4589
  };
4584
4590
  var handleSelectOver = function handleSelectOver(selectedValue) {
4585
4591
  if (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) {
4586
- var _ctx$form2;
4592
+ var _ctx$form3;
4587
4593
  // 解决选择最后1页的sku,返回后,不显示名称问题
4588
4594
  var source = _.uniqBy(items.concat(selectedValue), 'value');
4589
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
4595
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form3 = ctx.form) === null || _ctx$form3 === void 0 ? void 0 : _ctx$form3.setFieldSource(resultSourceKey, source);
4590
4596
  setItems(source);
4591
4597
  formaData(selectedValue, source);
4592
4598
  } else {
package/dist/index.js CHANGED
@@ -4128,7 +4128,9 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
4128
4128
  _ref$noNeedSplit = _ref.noNeedSplit,
4129
4129
  noNeedSplit = _ref$noNeedSplit === void 0 ? false : _ref$noNeedSplit,
4130
4130
  _ref$method = _ref.method,
4131
- method = _ref$method === void 0 ? 'get' : _ref$method;
4131
+ method = _ref$method === void 0 ? 'get' : _ref$method,
4132
+ _ref$onlyOneDateSelec = _ref.onlyOneDateSelected,
4133
+ onlyOneDateSelected = _ref$onlyOneDateSelec === void 0 ? false : _ref$onlyOneDateSelec;
4132
4134
  var resultSourceKey = handleSourceName(sourceName || (requestConfig === null || requestConfig === void 0 ? void 0 : requestConfig.sourceName) || (ctx === null || ctx === void 0 ? void 0 : ctx.name) || 'supplierCode');
4133
4135
  var selectMode = selectProps === null || selectProps === void 0 ? void 0 : selectProps.mode; // 设定当前选择器 为单选或者多选模式 无设定为单选模式(默认)
4134
4136
  var initVal = value || (selectMode ? [] : null);
@@ -4489,6 +4491,10 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
4489
4491
  if (type === 1) {
4490
4492
  var _ctx$form;
4491
4493
  ctx === null || ctx === void 0 ? void 0 : (_ctx$form = ctx.form) === null || _ctx$form === void 0 ? void 0 : _ctx$form.setFieldSource(resultSourceKey, source);
4494
+ if (onlyOneDateSelected === true && source.length === 1) {
4495
+ var _ctx$form2;
4496
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldValue(resultSourceKey, source[0]['value']);
4497
+ }
4492
4498
  setItems(source);
4493
4499
  setItemsTotal(Number((res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : res.totalCount) || source.length));
4494
4500
  } else {
@@ -4606,10 +4612,10 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
4606
4612
  };
4607
4613
  var handleSelectOver = function handleSelectOver(selectedValue) {
4608
4614
  if (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.length) {
4609
- var _ctx$form2;
4615
+ var _ctx$form3;
4610
4616
  // 解决选择最后1页的sku,返回后,不显示名称问题
4611
4617
  var source = ___default['default'].uniqBy(items.concat(selectedValue), 'value');
4612
- ctx === null || ctx === void 0 ? void 0 : (_ctx$form2 = ctx.form) === null || _ctx$form2 === void 0 ? void 0 : _ctx$form2.setFieldSource(resultSourceKey, source);
4618
+ ctx === null || ctx === void 0 ? void 0 : (_ctx$form3 = ctx.form) === null || _ctx$form3 === void 0 ? void 0 : _ctx$form3.setFieldSource(resultSourceKey, source);
4613
4619
  setItems(source);
4614
4620
  formaData(selectedValue, source);
4615
4621
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.1.10-alpha.10",
3
+ "version": "3.1.10-alpha.11",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -44,7 +44,8 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
44
44
  extralHeaders = {},// 额外请求头参数
45
45
  specialBracket = false,// 是否使用特殊括弧显示选项 【value】text
46
46
  noNeedSplit = false,// label显示不需要任何特殊化
47
- method = 'get'
47
+ method = 'get',
48
+ onlyOneDateSelected = false,
48
49
  } = requestConfig || {};
49
50
  const resultSourceKey = handleSourceName(sourceName || requestConfig?.sourceName || ctx?.name || 'supplierCode')
50
51
 
@@ -372,6 +373,9 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
372
373
  } else {
373
374
  if (type === 1) {
374
375
  ctx?.form?.setFieldSource(resultSourceKey, source)
376
+ if (onlyOneDateSelected === true && source.length === 1) {
377
+ ctx?.form?.setFieldValue(resultSourceKey, source[0]['value']);
378
+ }
375
379
  setItems(source)
376
380
  setItemsTotal(Number(res?.total || res?.totalCount || source.length))
377
381
  } else {