@zhongguo168a/yxeditor-common 0.0.102 → 0.0.104
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.d.ts +5 -1
- package/dist/index.esm.js +18 -5
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -718,7 +718,7 @@ declare class Dictionary<K = string, V = any> {
|
|
|
718
718
|
/**
|
|
719
719
|
* 如果使用了 onSet or onDelete,需要注意清理
|
|
720
720
|
*/
|
|
721
|
-
clear(): void;
|
|
721
|
+
clear(useIter?: boolean): void;
|
|
722
722
|
/**
|
|
723
723
|
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
724
724
|
* @param target
|
|
@@ -863,6 +863,10 @@ declare class List<T = any> {
|
|
|
863
863
|
removeList(other: List<T>): void;
|
|
864
864
|
sort(compareFn?: (a: T, b: T) => number): void;
|
|
865
865
|
reverse(): void;
|
|
866
|
+
/**
|
|
867
|
+
* useIter默认为true,因为如果是false的话,没有触发onSet,导致数据污染
|
|
868
|
+
* @param useIter 使用遍历的方式可以触发onSet
|
|
869
|
+
*/
|
|
866
870
|
clear(useIter?: boolean): void;
|
|
867
871
|
/**
|
|
868
872
|
* 克隆自身所有项到【target】对象,并返回【target】对象
|
package/dist/index.esm.js
CHANGED
|
@@ -2862,9 +2862,18 @@ class Dictionary {
|
|
|
2862
2862
|
/**
|
|
2863
2863
|
* 如果使用了 onSet or onDelete,需要注意清理
|
|
2864
2864
|
*/
|
|
2865
|
-
clear() {
|
|
2866
|
-
this._data
|
|
2867
|
-
|
|
2865
|
+
clear(useIter = true) {
|
|
2866
|
+
let data = this._data;
|
|
2867
|
+
if (useIter) {
|
|
2868
|
+
for (const key in data) {
|
|
2869
|
+
const item = data[key];
|
|
2870
|
+
this.delete(item);
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
else {
|
|
2874
|
+
this._data = {};
|
|
2875
|
+
this.size = 0;
|
|
2876
|
+
}
|
|
2868
2877
|
}
|
|
2869
2878
|
/**
|
|
2870
2879
|
* 克隆自身所有项到【target】对象,并返回【target】对象
|
|
@@ -3332,7 +3341,11 @@ class List {
|
|
|
3332
3341
|
reverse() {
|
|
3333
3342
|
this._data.reverse();
|
|
3334
3343
|
}
|
|
3335
|
-
|
|
3344
|
+
/**
|
|
3345
|
+
* useIter默认为true,因为如果是false的话,没有触发onSet,导致数据污染
|
|
3346
|
+
* @param useIter 使用遍历的方式可以触发onSet
|
|
3347
|
+
*/
|
|
3348
|
+
clear(useIter = true) {
|
|
3336
3349
|
let data = this._data;
|
|
3337
3350
|
if (useIter) {
|
|
3338
3351
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -3349,7 +3362,7 @@ class List {
|
|
|
3349
3362
|
* @param target
|
|
3350
3363
|
* @param useIter 使用遍历的方式可以触发onSet
|
|
3351
3364
|
*/
|
|
3352
|
-
clone(target, useIter =
|
|
3365
|
+
clone(target, useIter = true) {
|
|
3353
3366
|
let data = this._data;
|
|
3354
3367
|
if (useIter) {
|
|
3355
3368
|
for (let i = 0; i < data.length; i++) {
|