@douyinfe/semi-ui 2.26.0-beta.0 → 2.26.0
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/umd/semi-ui.js +78 -3
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/tagInput/index.d.ts +3 -0
- package/lib/cjs/tagInput/index.js +18 -2
- package/lib/es/tagInput/index.d.ts +3 -0
- package/lib/es/tagInput/index.js +18 -2
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -41422,7 +41422,66 @@ class foundation_TagInputFoundation extends foundation {
|
|
|
41422
41422
|
const {
|
|
41423
41423
|
value
|
|
41424
41424
|
} = e.target;
|
|
41425
|
-
|
|
41425
|
+
const {
|
|
41426
|
+
entering
|
|
41427
|
+
} = this.getStates();
|
|
41428
|
+
|
|
41429
|
+
if (entering) {
|
|
41430
|
+
// 如果处于输入法输入中,则先不检查输入是否有效,直接更新到inputValue,
|
|
41431
|
+
// 因为对于输入法输入中而言,此时更新到 inputValue 的不是最后的结果,比如对于中文,此时 inputValue 中的内容是拼音
|
|
41432
|
+
// 当输入法输入结束后,将在 handleInputCompositionEnd 中判断输入是否有效,处理结果
|
|
41433
|
+
// If it is composition session, it does not check whether the input is valid, and directly updates to inputValue,
|
|
41434
|
+
// Because for composition input, what is updated to inputValue at this time is not the final result.
|
|
41435
|
+
// For example, for Chinese, the content in inputValue is pinyin at this time
|
|
41436
|
+
// When the composition input is finished, it will be judged whether the input is valid in handleInputCompositionEnd and the result will be processed
|
|
41437
|
+
this._onInputChange(value, e);
|
|
41438
|
+
} else {
|
|
41439
|
+
this._checkInputChangeValid(value) && this._onInputChange(value, e);
|
|
41440
|
+
}
|
|
41441
|
+
};
|
|
41442
|
+
|
|
41443
|
+
this.handleInputCompositionStart = e => {
|
|
41444
|
+
this._adapter.setEntering(true);
|
|
41445
|
+
};
|
|
41446
|
+
|
|
41447
|
+
this.handleInputCompositionEnd = e => {
|
|
41448
|
+
this._adapter.setEntering(false);
|
|
41449
|
+
|
|
41450
|
+
const {
|
|
41451
|
+
value
|
|
41452
|
+
} = e.target;
|
|
41453
|
+
const {
|
|
41454
|
+
maxLength,
|
|
41455
|
+
onInputExceed,
|
|
41456
|
+
separator
|
|
41457
|
+
} = this.getProps();
|
|
41458
|
+
let allowChange = true;
|
|
41459
|
+
const {
|
|
41460
|
+
inputValue
|
|
41461
|
+
} = this.getStates();
|
|
41462
|
+
|
|
41463
|
+
if (isNumber_default()(maxLength)) {
|
|
41464
|
+
const inputArr = utils_getSplitedArray(inputValue, separator);
|
|
41465
|
+
let index = 0;
|
|
41466
|
+
|
|
41467
|
+
for (; index < inputArr.length; index++) {
|
|
41468
|
+
if (inputArr[index].length > maxLength) {
|
|
41469
|
+
allowChange = false;
|
|
41470
|
+
isFunction_default()(onInputExceed) && onInputExceed(value);
|
|
41471
|
+
break;
|
|
41472
|
+
}
|
|
41473
|
+
}
|
|
41474
|
+
|
|
41475
|
+
if (!allowChange) {
|
|
41476
|
+
const newInputArr = inputArr.slice(0, index);
|
|
41477
|
+
|
|
41478
|
+
if (index < inputArr.length) {
|
|
41479
|
+
newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
41480
|
+
}
|
|
41481
|
+
|
|
41482
|
+
this._adapter.setInputValue(newInputArr.join(separator));
|
|
41483
|
+
}
|
|
41484
|
+
}
|
|
41426
41485
|
};
|
|
41427
41486
|
/**
|
|
41428
41487
|
* check whether the input change is legal
|
|
@@ -43713,13 +43772,22 @@ class tagInput_TagInput extends baseComponent_BaseComponent {
|
|
|
43713
43772
|
this.foundation.handleSortEnd(callbackProps);
|
|
43714
43773
|
};
|
|
43715
43774
|
|
|
43775
|
+
this.handleInputCompositionStart = e => {
|
|
43776
|
+
this.foundation.handleInputCompositionStart(e);
|
|
43777
|
+
};
|
|
43778
|
+
|
|
43779
|
+
this.handleInputCompositionEnd = e => {
|
|
43780
|
+
this.foundation.handleInputCompositionEnd(e);
|
|
43781
|
+
};
|
|
43782
|
+
|
|
43716
43783
|
this.foundation = new tagInput_foundation(this.adapter);
|
|
43717
43784
|
this.state = {
|
|
43718
43785
|
tagsArray: props.defaultValue || [],
|
|
43719
43786
|
inputValue: '',
|
|
43720
43787
|
focusing: false,
|
|
43721
43788
|
hovering: false,
|
|
43722
|
-
active: false
|
|
43789
|
+
active: false,
|
|
43790
|
+
entering: false
|
|
43723
43791
|
};
|
|
43724
43792
|
this.inputRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
43725
43793
|
this.tagInputRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createRef();
|
|
@@ -43795,6 +43863,11 @@ class tagInput_TagInput extends baseComponent_BaseComponent {
|
|
|
43795
43863
|
active
|
|
43796
43864
|
});
|
|
43797
43865
|
},
|
|
43866
|
+
setEntering: entering => {
|
|
43867
|
+
this.setState({
|
|
43868
|
+
entering
|
|
43869
|
+
});
|
|
43870
|
+
},
|
|
43798
43871
|
getClickOutsideHandler: () => {
|
|
43799
43872
|
return this.clickOutsideHandler;
|
|
43800
43873
|
},
|
|
@@ -44084,7 +44157,9 @@ class tagInput_TagInput extends baseComponent_BaseComponent {
|
|
|
44084
44157
|
},
|
|
44085
44158
|
onFocus: e => {
|
|
44086
44159
|
this.handleInputFocus(e);
|
|
44087
|
-
}
|
|
44160
|
+
},
|
|
44161
|
+
onCompositionStart: this.handleInputCompositionStart,
|
|
44162
|
+
onCompositionEnd: this.handleInputCompositionEnd
|
|
44088
44163
|
})), this.renderClearBtn(), this.renderSuffix())
|
|
44089
44164
|
);
|
|
44090
44165
|
}
|