@douyinfe/semi-foundation 2.55.2 → 2.55.3

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.
@@ -268,7 +268,18 @@ class SelectFoundation extends _foundation.default {
268
268
  const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
269
269
  if (indexInSelectedList !== -1) {
270
270
  const option = selectedOptionList[indexInSelectedList];
271
- selections.set(option.label, option);
271
+ if (onChangeWithObject) {
272
+ // Although the value is the same and can be found in selections, it cannot ensure that other items remain unchanged. A comparison is made.
273
+ // https://github.com/DouyinFE/semi-design/pull/2139
274
+ const optionCompare = Object.assign({}, propValue[i]);
275
+ if ((0, _isEqual2.default)(optionCompare, option)) {
276
+ selections.set(option.label, option);
277
+ } else {
278
+ selections.set(optionCompare.label, optionCompare);
279
+ }
280
+ } else {
281
+ selections.set(option.label, option);
282
+ }
272
283
  } else {
273
284
  // The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
274
285
  let optionNotExist = {
@@ -259,7 +259,18 @@ export default class SelectFoundation extends BaseFoundation {
259
259
  const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
260
260
  if (indexInSelectedList !== -1) {
261
261
  const option = selectedOptionList[indexInSelectedList];
262
- selections.set(option.label, option);
262
+ if (onChangeWithObject) {
263
+ // Although the value is the same and can be found in selections, it cannot ensure that other items remain unchanged. A comparison is made.
264
+ // https://github.com/DouyinFE/semi-design/pull/2139
265
+ const optionCompare = Object.assign({}, propValue[i]);
266
+ if (_isEqual(optionCompare, option)) {
267
+ selections.set(option.label, option);
268
+ } else {
269
+ selections.set(optionCompare.label, optionCompare);
270
+ }
271
+ } else {
272
+ selections.set(option.label, option);
273
+ }
263
274
  } else {
264
275
  // The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
265
276
  let optionNotExist = {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.55.2",
3
+ "version": "2.55.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.55.2",
10
+ "@douyinfe/semi-animation": "2.55.3",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "412a3c5f25063c5862ecd34959990e25dd44e805",
27
+ "gitHead": "053bbe0f3422d555ea0aa5aa89d10ec722ac4d09",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-transform-runtime": "^7.15.8",
30
30
  "@babel/preset-env": "^7.15.8",
@@ -298,7 +298,18 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
298
298
  const indexInSelectedList = selectedOptionList.findIndex(option => option.value === selectedValue);
299
299
  if (indexInSelectedList !== -1) {
300
300
  const option = selectedOptionList[indexInSelectedList];
301
- selections.set(option.label, option);
301
+ if (onChangeWithObject) {
302
+ // Although the value is the same and can be found in selections, it cannot ensure that other items remain unchanged. A comparison is made.
303
+ // https://github.com/DouyinFE/semi-design/pull/2139
304
+ const optionCompare = { ...(propValue[i] as any) };
305
+ if (isEqual(optionCompare, option)) {
306
+ selections.set(option.label, option);
307
+ } else {
308
+ selections.set(optionCompare.label, optionCompare);
309
+ }
310
+ } else {
311
+ selections.set(option.label, option);
312
+ }
302
313
  } else {
303
314
  // The current value does not exist in the current optionList or the list before the change. Construct an option and update it to the selection
304
315
  let optionNotExist = { value: selectedValue, label: selectedValue, _notExist: true };