@infinite-table/infinite-react 3.0.2 → 3.0.4
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/index.d.ts +4 -4
- package/index.dev.js +18 -16
- package/index.dev.mjs +18 -16
- package/index.js +2 -2
- package/index.mjs +2 -2
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1521,7 +1521,7 @@ declare class DataSourceCache<DataType, PrimaryKeyType = string> {
|
|
|
1521
1521
|
isEmpty: () => boolean;
|
|
1522
1522
|
removeInfo: (primaryKey: PrimaryKeyType) => void;
|
|
1523
1523
|
getMutationsForPrimaryKey: (primaryKey: PrimaryKeyType) => DataSourceMutation<DataType>[] | undefined;
|
|
1524
|
-
getMutations: () => Map<
|
|
1524
|
+
getMutations: () => Map<PrimaryKeyType, DataSourceMutation<DataType>[]>;
|
|
1525
1525
|
}
|
|
1526
1526
|
|
|
1527
1527
|
declare type BooleanDeepCollectionStateKeys<KeyType> = true | KeyType[][];
|
|
@@ -1572,13 +1572,13 @@ declare class GroupRowsState<KeyType extends any = any> extends BooleanDeepColle
|
|
|
1572
1572
|
}
|
|
1573
1573
|
|
|
1574
1574
|
declare class Indexer<DataType, PrimaryKeyType = string> {
|
|
1575
|
-
primaryKeyToData: Map<
|
|
1575
|
+
primaryKeyToData: Map<PrimaryKeyType, DataType>;
|
|
1576
1576
|
private add;
|
|
1577
1577
|
clear: () => void;
|
|
1578
|
-
getDataForPrimaryKey: (primaryKey: PrimaryKeyType
|
|
1578
|
+
getDataForPrimaryKey: (primaryKey: PrimaryKeyType) => DataType | undefined;
|
|
1579
1579
|
indexArray: (arr: DataType[], options: {
|
|
1580
1580
|
toPrimaryKey: (data: DataType) => PrimaryKeyType;
|
|
1581
|
-
cache?: DataSourceCache<DataType,
|
|
1581
|
+
cache?: DataSourceCache<DataType, PrimaryKeyType> | undefined;
|
|
1582
1582
|
}) => DataType[];
|
|
1583
1583
|
}
|
|
1584
1584
|
|
package/index.dev.js
CHANGED
|
@@ -11003,7 +11003,7 @@ var DataSourceCache = class {
|
|
|
11003
11003
|
};
|
|
11004
11004
|
this.delete = (primaryKey, originalData, metadata) => {
|
|
11005
11005
|
this.allFieldsAffected = true;
|
|
11006
|
-
const pk =
|
|
11006
|
+
const pk = primaryKey;
|
|
11007
11007
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
11008
11008
|
value.push({
|
|
11009
11009
|
type: "delete",
|
|
@@ -11014,7 +11014,7 @@ var DataSourceCache = class {
|
|
|
11014
11014
|
this.primaryKeyToData.set(pk, value);
|
|
11015
11015
|
};
|
|
11016
11016
|
this.insert = (primaryKey, data, position2, metadata) => {
|
|
11017
|
-
const pk =
|
|
11017
|
+
const pk = primaryKey;
|
|
11018
11018
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
11019
11019
|
this.allFieldsAffected = true;
|
|
11020
11020
|
value.push({
|
|
@@ -11032,7 +11032,7 @@ var DataSourceCache = class {
|
|
|
11032
11032
|
const keys = Object.keys(data);
|
|
11033
11033
|
keys.forEach((key) => this.affectedFields.add(key));
|
|
11034
11034
|
}
|
|
11035
|
-
const pk =
|
|
11035
|
+
const pk = primaryKey;
|
|
11036
11036
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
11037
11037
|
value.push({
|
|
11038
11038
|
type: "update",
|
|
@@ -11041,7 +11041,7 @@ var DataSourceCache = class {
|
|
|
11041
11041
|
originalData,
|
|
11042
11042
|
metadata
|
|
11043
11043
|
});
|
|
11044
|
-
this.primaryKeyToData.set(
|
|
11044
|
+
this.primaryKeyToData.set(primaryKey, value);
|
|
11045
11045
|
};
|
|
11046
11046
|
this.clear = () => {
|
|
11047
11047
|
this.allFieldsAffected = false;
|
|
@@ -11052,10 +11052,10 @@ var DataSourceCache = class {
|
|
|
11052
11052
|
return this.primaryKeyToData.size === 0;
|
|
11053
11053
|
};
|
|
11054
11054
|
this.removeInfo = (primaryKey) => {
|
|
11055
|
-
this.primaryKeyToData.delete(
|
|
11055
|
+
this.primaryKeyToData.delete(primaryKey);
|
|
11056
11056
|
};
|
|
11057
11057
|
this.getMutationsForPrimaryKey = (primaryKey) => {
|
|
11058
|
-
const data = this.primaryKeyToData.get(
|
|
11058
|
+
const data = this.primaryKeyToData.get(primaryKey);
|
|
11059
11059
|
return data;
|
|
11060
11060
|
};
|
|
11061
11061
|
this.getMutations = () => {
|
|
@@ -11066,7 +11066,9 @@ var DataSourceCache = class {
|
|
|
11066
11066
|
const clone = new DataSourceCache();
|
|
11067
11067
|
clone.allFieldsAffected = cache.allFieldsAffected;
|
|
11068
11068
|
clone.affectedFields = new Set(cache.affectedFields);
|
|
11069
|
-
clone.primaryKeyToData = light ? cache.primaryKeyToData : new Map(
|
|
11069
|
+
clone.primaryKeyToData = light ? cache.primaryKeyToData : new Map(
|
|
11070
|
+
cache.primaryKeyToData
|
|
11071
|
+
);
|
|
11070
11072
|
return clone;
|
|
11071
11073
|
}
|
|
11072
11074
|
};
|
|
@@ -13110,7 +13112,7 @@ function concludeReducer(params) {
|
|
|
13110
13112
|
}
|
|
13111
13113
|
if (cache) {
|
|
13112
13114
|
cache.clear();
|
|
13113
|
-
state.cache =
|
|
13115
|
+
state.cache = void 0;
|
|
13114
13116
|
}
|
|
13115
13117
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
13116
13118
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
@@ -13363,7 +13365,7 @@ function concludeReducer(params) {
|
|
|
13363
13365
|
if (originalDataArrayChanged) {
|
|
13364
13366
|
state.originalDataArrayChangedInfo = {
|
|
13365
13367
|
timestamp: now,
|
|
13366
|
-
mutations
|
|
13368
|
+
mutations: (mutations == null ? void 0 : mutations.size) ? mutations : void 0
|
|
13367
13369
|
};
|
|
13368
13370
|
}
|
|
13369
13371
|
return state;
|
|
@@ -13963,24 +13965,24 @@ var Indexer = class {
|
|
|
13963
13965
|
constructor() {
|
|
13964
13966
|
this.primaryKeyToData = /* @__PURE__ */ new Map();
|
|
13965
13967
|
this.add = (primaryKey, data) => {
|
|
13966
|
-
this.primaryKeyToData.set(
|
|
13968
|
+
this.primaryKeyToData.set(primaryKey, data);
|
|
13967
13969
|
};
|
|
13968
13970
|
this.clear = () => {
|
|
13969
13971
|
this.primaryKeyToData.clear();
|
|
13970
13972
|
};
|
|
13971
13973
|
this.getDataForPrimaryKey = (primaryKey) => {
|
|
13972
|
-
return this.primaryKeyToData.get(
|
|
13974
|
+
return this.primaryKeyToData.get(primaryKey);
|
|
13973
13975
|
};
|
|
13974
13976
|
this.indexArray = (arr, options) => {
|
|
13975
13977
|
const { cache, toPrimaryKey } = options;
|
|
13976
|
-
if (cache) {
|
|
13978
|
+
if (cache && !cache.isEmpty()) {
|
|
13977
13979
|
arr = arr.concat();
|
|
13978
13980
|
}
|
|
13979
13981
|
for (let i = 0; i < arr.length; i++) {
|
|
13980
13982
|
let item = arr[i];
|
|
13981
13983
|
let deleted = false;
|
|
13982
13984
|
if (item != null) {
|
|
13983
|
-
const pk =
|
|
13985
|
+
const pk = toPrimaryKey(item);
|
|
13984
13986
|
const cacheInfo = cache == null ? void 0 : cache.getMutationsForPrimaryKey(pk);
|
|
13985
13987
|
if (cacheInfo && cacheInfo.length) {
|
|
13986
13988
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
@@ -13995,7 +13997,7 @@ var Indexer = class {
|
|
|
13995
13997
|
arr[i] = item;
|
|
13996
13998
|
}
|
|
13997
13999
|
if (info.type === "insert") {
|
|
13998
|
-
const insertPK =
|
|
14000
|
+
const insertPK = toPrimaryKey(info.data);
|
|
13999
14001
|
this.add(insertPK, info.data);
|
|
14000
14002
|
if (info.position === "before") {
|
|
14001
14003
|
arr.splice(i, 0, info.data);
|
|
@@ -14446,7 +14448,7 @@ function DataSourceCmp({ children }) {
|
|
|
14446
14448
|
componentState.originalDataArray,
|
|
14447
14449
|
componentState.originalDataArrayChangedInfo
|
|
14448
14450
|
);
|
|
14449
|
-
if (componentState.onDataMutations && componentState.originalDataArrayChangedInfo.mutations) {
|
|
14451
|
+
if (componentState.onDataMutations && componentState.originalDataArrayChangedInfo.mutations && componentState.originalDataArrayChangedInfo.mutations.size) {
|
|
14450
14452
|
componentState.onDataMutations({
|
|
14451
14453
|
primaryKeyField: typeof componentState.primaryKey === "string" ? componentState.primaryKey : void 0,
|
|
14452
14454
|
dataArray: componentState.originalDataArray,
|
|
@@ -17581,7 +17583,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17581
17583
|
const valid = (0, import_react49.useMemo)(() => {
|
|
17582
17584
|
let valid2 = isValidLicense(licenseKey, {
|
|
17583
17585
|
publishedAt: 1624970570587,
|
|
17584
|
-
version: "3.0.
|
|
17586
|
+
version: "3.0.4"
|
|
17585
17587
|
});
|
|
17586
17588
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17587
17589
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -10988,7 +10988,7 @@ var DataSourceCache = class {
|
|
|
10988
10988
|
};
|
|
10989
10989
|
this.delete = (primaryKey, originalData, metadata) => {
|
|
10990
10990
|
this.allFieldsAffected = true;
|
|
10991
|
-
const pk =
|
|
10991
|
+
const pk = primaryKey;
|
|
10992
10992
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
10993
10993
|
value.push({
|
|
10994
10994
|
type: "delete",
|
|
@@ -10999,7 +10999,7 @@ var DataSourceCache = class {
|
|
|
10999
10999
|
this.primaryKeyToData.set(pk, value);
|
|
11000
11000
|
};
|
|
11001
11001
|
this.insert = (primaryKey, data, position2, metadata) => {
|
|
11002
|
-
const pk =
|
|
11002
|
+
const pk = primaryKey;
|
|
11003
11003
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
11004
11004
|
this.allFieldsAffected = true;
|
|
11005
11005
|
value.push({
|
|
@@ -11017,7 +11017,7 @@ var DataSourceCache = class {
|
|
|
11017
11017
|
const keys = Object.keys(data);
|
|
11018
11018
|
keys.forEach((key) => this.affectedFields.add(key));
|
|
11019
11019
|
}
|
|
11020
|
-
const pk =
|
|
11020
|
+
const pk = primaryKey;
|
|
11021
11021
|
const value = this.primaryKeyToData.get(pk) || [];
|
|
11022
11022
|
value.push({
|
|
11023
11023
|
type: "update",
|
|
@@ -11026,7 +11026,7 @@ var DataSourceCache = class {
|
|
|
11026
11026
|
originalData,
|
|
11027
11027
|
metadata
|
|
11028
11028
|
});
|
|
11029
|
-
this.primaryKeyToData.set(
|
|
11029
|
+
this.primaryKeyToData.set(primaryKey, value);
|
|
11030
11030
|
};
|
|
11031
11031
|
this.clear = () => {
|
|
11032
11032
|
this.allFieldsAffected = false;
|
|
@@ -11037,10 +11037,10 @@ var DataSourceCache = class {
|
|
|
11037
11037
|
return this.primaryKeyToData.size === 0;
|
|
11038
11038
|
};
|
|
11039
11039
|
this.removeInfo = (primaryKey) => {
|
|
11040
|
-
this.primaryKeyToData.delete(
|
|
11040
|
+
this.primaryKeyToData.delete(primaryKey);
|
|
11041
11041
|
};
|
|
11042
11042
|
this.getMutationsForPrimaryKey = (primaryKey) => {
|
|
11043
|
-
const data = this.primaryKeyToData.get(
|
|
11043
|
+
const data = this.primaryKeyToData.get(primaryKey);
|
|
11044
11044
|
return data;
|
|
11045
11045
|
};
|
|
11046
11046
|
this.getMutations = () => {
|
|
@@ -11051,7 +11051,9 @@ var DataSourceCache = class {
|
|
|
11051
11051
|
const clone = new DataSourceCache();
|
|
11052
11052
|
clone.allFieldsAffected = cache.allFieldsAffected;
|
|
11053
11053
|
clone.affectedFields = new Set(cache.affectedFields);
|
|
11054
|
-
clone.primaryKeyToData = light ? cache.primaryKeyToData : new Map(
|
|
11054
|
+
clone.primaryKeyToData = light ? cache.primaryKeyToData : new Map(
|
|
11055
|
+
cache.primaryKeyToData
|
|
11056
|
+
);
|
|
11055
11057
|
return clone;
|
|
11056
11058
|
}
|
|
11057
11059
|
};
|
|
@@ -13095,7 +13097,7 @@ function concludeReducer(params) {
|
|
|
13095
13097
|
}
|
|
13096
13098
|
if (cache) {
|
|
13097
13099
|
cache.clear();
|
|
13098
|
-
state.cache =
|
|
13100
|
+
state.cache = void 0;
|
|
13099
13101
|
}
|
|
13100
13102
|
const { filterFunction, filterValue, filterTypes, operatorsByFilterType } = state;
|
|
13101
13103
|
const shouldFilter = !!filterFunction || Array.isArray(filterValue) && filterValue.length;
|
|
@@ -13348,7 +13350,7 @@ function concludeReducer(params) {
|
|
|
13348
13350
|
if (originalDataArrayChanged) {
|
|
13349
13351
|
state.originalDataArrayChangedInfo = {
|
|
13350
13352
|
timestamp: now,
|
|
13351
|
-
mutations
|
|
13353
|
+
mutations: (mutations == null ? void 0 : mutations.size) ? mutations : void 0
|
|
13352
13354
|
};
|
|
13353
13355
|
}
|
|
13354
13356
|
return state;
|
|
@@ -13948,24 +13950,24 @@ var Indexer = class {
|
|
|
13948
13950
|
constructor() {
|
|
13949
13951
|
this.primaryKeyToData = /* @__PURE__ */ new Map();
|
|
13950
13952
|
this.add = (primaryKey, data) => {
|
|
13951
|
-
this.primaryKeyToData.set(
|
|
13953
|
+
this.primaryKeyToData.set(primaryKey, data);
|
|
13952
13954
|
};
|
|
13953
13955
|
this.clear = () => {
|
|
13954
13956
|
this.primaryKeyToData.clear();
|
|
13955
13957
|
};
|
|
13956
13958
|
this.getDataForPrimaryKey = (primaryKey) => {
|
|
13957
|
-
return this.primaryKeyToData.get(
|
|
13959
|
+
return this.primaryKeyToData.get(primaryKey);
|
|
13958
13960
|
};
|
|
13959
13961
|
this.indexArray = (arr, options) => {
|
|
13960
13962
|
const { cache, toPrimaryKey } = options;
|
|
13961
|
-
if (cache) {
|
|
13963
|
+
if (cache && !cache.isEmpty()) {
|
|
13962
13964
|
arr = arr.concat();
|
|
13963
13965
|
}
|
|
13964
13966
|
for (let i = 0; i < arr.length; i++) {
|
|
13965
13967
|
let item = arr[i];
|
|
13966
13968
|
let deleted = false;
|
|
13967
13969
|
if (item != null) {
|
|
13968
|
-
const pk =
|
|
13970
|
+
const pk = toPrimaryKey(item);
|
|
13969
13971
|
const cacheInfo = cache == null ? void 0 : cache.getMutationsForPrimaryKey(pk);
|
|
13970
13972
|
if (cacheInfo && cacheInfo.length) {
|
|
13971
13973
|
for (let cacheIndex = 0, cacheLength = cacheInfo.length; cacheIndex < cacheLength; cacheIndex++) {
|
|
@@ -13980,7 +13982,7 @@ var Indexer = class {
|
|
|
13980
13982
|
arr[i] = item;
|
|
13981
13983
|
}
|
|
13982
13984
|
if (info.type === "insert") {
|
|
13983
|
-
const insertPK =
|
|
13985
|
+
const insertPK = toPrimaryKey(info.data);
|
|
13984
13986
|
this.add(insertPK, info.data);
|
|
13985
13987
|
if (info.position === "before") {
|
|
13986
13988
|
arr.splice(i, 0, info.data);
|
|
@@ -14431,7 +14433,7 @@ function DataSourceCmp({ children }) {
|
|
|
14431
14433
|
componentState.originalDataArray,
|
|
14432
14434
|
componentState.originalDataArrayChangedInfo
|
|
14433
14435
|
);
|
|
14434
|
-
if (componentState.onDataMutations && componentState.originalDataArrayChangedInfo.mutations) {
|
|
14436
|
+
if (componentState.onDataMutations && componentState.originalDataArrayChangedInfo.mutations && componentState.originalDataArrayChangedInfo.mutations.size) {
|
|
14435
14437
|
componentState.onDataMutations({
|
|
14436
14438
|
primaryKeyField: typeof componentState.primaryKey === "string" ? componentState.primaryKey : void 0,
|
|
14437
14439
|
dataArray: componentState.originalDataArray,
|
|
@@ -17570,7 +17572,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17570
17572
|
const valid = useMemo11(() => {
|
|
17571
17573
|
let valid2 = isValidLicense(licenseKey, {
|
|
17572
17574
|
publishedAt: 1624970570587,
|
|
17573
|
-
version: "3.0.
|
|
17575
|
+
version: "3.0.4"
|
|
17574
17576
|
});
|
|
17575
17577
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17576
17578
|
return true;
|