@douyinfe/semi-ui 2.43.0-beta.0 → 2.43.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 +29 -20
- 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/image/preview.js +1 -1
- package/lib/cjs/tree/interface.d.ts +1 -1
- package/lib/cjs/treeSelect/index.d.ts +1 -1
- package/lib/es/image/preview.js +1 -1
- package/lib/es/tree/interface.d.ts +1 -1
- package/lib/es/treeSelect/index.d.ts +1 -1
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -39223,10 +39223,15 @@ class TagInputFoundation extends foundation {
|
|
|
39223
39223
|
}
|
|
39224
39224
|
};
|
|
39225
39225
|
this.handleInputCompositionStart = e => {
|
|
39226
|
+
const {
|
|
39227
|
+
maxLength
|
|
39228
|
+
} = this.getProps();
|
|
39229
|
+
if (!isNumber_default()(maxLength)) {
|
|
39230
|
+
return;
|
|
39231
|
+
}
|
|
39226
39232
|
this._adapter.setEntering(true);
|
|
39227
39233
|
};
|
|
39228
39234
|
this.handleInputCompositionEnd = e => {
|
|
39229
|
-
this._adapter.setEntering(false);
|
|
39230
39235
|
const {
|
|
39231
39236
|
value
|
|
39232
39237
|
} = e.target;
|
|
@@ -39235,27 +39240,31 @@ class TagInputFoundation extends foundation {
|
|
|
39235
39240
|
onInputExceed,
|
|
39236
39241
|
separator
|
|
39237
39242
|
} = this.getProps();
|
|
39243
|
+
if (!isNumber_default()(maxLength)) {
|
|
39244
|
+
return;
|
|
39245
|
+
}
|
|
39246
|
+
this._adapter.setEntering(false);
|
|
39238
39247
|
let allowChange = true;
|
|
39239
|
-
const
|
|
39240
|
-
|
|
39241
|
-
|
|
39242
|
-
|
|
39243
|
-
|
|
39244
|
-
|
|
39245
|
-
|
|
39246
|
-
if (inputArr[index].length > maxLength) {
|
|
39247
|
-
allowChange = false;
|
|
39248
|
-
isFunction_default()(onInputExceed) && onInputExceed(value);
|
|
39249
|
-
break;
|
|
39250
|
-
}
|
|
39248
|
+
const inputArr = utils_getSplitedArray(value, separator);
|
|
39249
|
+
let index = 0;
|
|
39250
|
+
for (; index < inputArr.length; index++) {
|
|
39251
|
+
if (inputArr[index].length > maxLength) {
|
|
39252
|
+
allowChange = false;
|
|
39253
|
+
isFunction_default()(onInputExceed) && onInputExceed(value);
|
|
39254
|
+
break;
|
|
39251
39255
|
}
|
|
39252
|
-
|
|
39253
|
-
|
|
39254
|
-
|
|
39255
|
-
|
|
39256
|
-
|
|
39257
|
-
this._adapter.setInputValue(newInputArr.join(separator));
|
|
39256
|
+
}
|
|
39257
|
+
if (!allowChange) {
|
|
39258
|
+
const newInputArr = inputArr.slice(0, index);
|
|
39259
|
+
if (index < inputArr.length) {
|
|
39260
|
+
newInputArr.push(inputArr[index].slice(0, maxLength));
|
|
39258
39261
|
}
|
|
39262
|
+
this._adapter.setInputValue(newInputArr.join(separator));
|
|
39263
|
+
} else {
|
|
39264
|
+
// Why does it need to be updated here instead of in onChange when the value meets the maxLength limit?
|
|
39265
|
+
// Because in firefox, the state change in InputCompositionEnd causes onChange to not be triggered after
|
|
39266
|
+
// the composition input completes input.
|
|
39267
|
+
this._adapter.setInputValue(value);
|
|
39259
39268
|
}
|
|
39260
39269
|
};
|
|
39261
39270
|
/**
|
|
@@ -100796,8 +100805,8 @@ class Preview extends BaseComponent {
|
|
|
100796
100805
|
if (item.isIntersecting && src) {
|
|
100797
100806
|
item.target.src = src;
|
|
100798
100807
|
item.target.removeAttribute("data-src");
|
|
100808
|
+
this.previewObserver.unobserve(item.target);
|
|
100799
100809
|
}
|
|
100800
|
-
this.previewObserver.unobserve(item.target);
|
|
100801
100810
|
});
|
|
100802
100811
|
}, {
|
|
100803
100812
|
root: document.querySelector(`#${this.previewGroupId}`),
|