es-grid-template 1.8.33 → 1.8.34

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.
@@ -135,7 +135,6 @@ export declare const convertToObjTrue: (arr: any) => {
135
135
  [k: string]: any;
136
136
  };
137
137
  export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
138
- export declare function isTree(arr: any[]): boolean;
139
138
  export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
140
139
  export declare function isTreeArray(arr: any[], options?: any): boolean;
141
140
  export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
@@ -1902,76 +1902,69 @@ export const convertToObjTrue = arr => {
1902
1902
  export const getDiffent2Array = (a, b) => {
1903
1903
  return [...a.filter(x => !b.includes(x)), ...b.filter(x => !a.includes(x))];
1904
1904
  };
1905
- export function isTree(arr) {
1906
- if (!Array.isArray(arr)) {
1907
- return false;
1908
- }
1909
- function checkNode(node) {
1910
- if (typeof node !== "object" || node === null) {
1911
- return false;
1912
- }
1913
- if ("children" in node) {
1914
- if (!Array.isArray(node.children)) {
1915
- return false;
1916
- }
1917
- if (node.children.length === 0) {
1918
- return false;
1919
- }
1920
- for (const child of node.children) {
1921
- if (!checkNode(child)) {
1922
- return false;
1923
- }
1924
- }
1925
- }
1926
- return true;
1927
- }
1928
- for (const item of arr) {
1929
- if (!checkNode(item)) return false;
1930
- }
1931
- return true;
1932
- }
1933
- export function findFirst(items) {
1934
- const leftItem = items.find(item => item.getIsPinned() === 'left');
1935
- if (leftItem) return leftItem;
1936
- return null;
1937
- }
1938
1905
 
1939
- // export function isTreeArray(arr: any[]): boolean {
1906
+ // export function isTree(arr: any[]): boolean {
1907
+ // if (!Array.isArray(arr)){
1908
+ // return false
1909
+ // }
1940
1910
 
1941
- // // if (!Array.isArray(arr)) return false;
1911
+ // function checkNode(node: any): boolean {
1912
+ // if (typeof node !== "object" || node === null) {
1913
+ // return false
1914
+ // }
1942
1915
 
1943
- // // return arr.every(item => {
1944
- // // if ("children" in item) {
1945
- // // return Array.isArray(item.children) && item.children.length > 0;
1946
- // // }
1947
- // // return true; // node lá thì hợp lệ
1948
- // // });
1916
+ // if ("children" in node) {
1949
1917
 
1950
- // if (!Array.isArray(arr)) return false;
1918
+ // if (!Array.isArray(node.children)) {
1919
+ // return false
1920
+ // }
1921
+ // if (node.children.length === 0) {
1922
+ // return false
1923
+ // }
1951
1924
 
1952
- // return arr.every(item => {
1953
- // if (typeof item !== "object" || item === null) return false;
1925
+ // for (const child of node.children) {
1926
+ // if (!checkNode(child)) {
1927
+ // return false
1928
+ // }
1929
+ // }
1954
1930
 
1955
- // if ("children" in item) {
1956
- // return Array.isArray(item.children);
1957
1931
  // }
1958
1932
 
1959
- // return false; // node lá thì hợp lệ
1960
- // });
1933
+ // return true;
1934
+ // }
1935
+
1936
+ // for (const item of arr) {
1937
+ // if (!checkNode(item)) return false;
1938
+ // }
1961
1939
 
1940
+ // return true;
1962
1941
  // }
1963
1942
 
1943
+ export function findFirst(items) {
1944
+ const leftItem = items.find(item => item.getIsPinned() === 'left');
1945
+ if (leftItem) return leftItem;
1946
+ return null;
1947
+ }
1964
1948
  export function isTreeArray(arr, options) {
1965
- if (!Array.isArray(arr) || arr.length === 0) return false;
1949
+ if (!Array.isArray(arr) || arr.length === 0) {
1950
+ return false;
1951
+ }
1966
1952
  const requireNonEmpty = options?.requireNonEmptyChildren ?? false;
1967
1953
  let hasParent = false;
1968
1954
  for (const item of arr) {
1969
- if (typeof item !== 'object' || item === null) return false;
1955
+ if (typeof item !== 'object' || item === null) {
1956
+ return false;
1957
+ }
1970
1958
  if ('children' in item) {
1971
1959
  const children = item.children;
1972
- if (!Array.isArray(children)) return false;
1960
+ if (!Array.isArray(children)) {
1961
+ // return false;
1962
+ hasParent = false;
1963
+ }
1973
1964
  if (requireNonEmpty) {
1974
- if (children.length > 0) hasParent = true;
1965
+ if (children.length > 0) {
1966
+ hasParent = true;
1967
+ }
1975
1968
  } else {
1976
1969
  hasParent = true;
1977
1970
  }
@@ -135,7 +135,6 @@ export declare const convertToObjTrue: (arr: any) => {
135
135
  [k: string]: any;
136
136
  };
137
137
  export declare const getDiffent2Array: (a: any[], b: any[]) => any[];
138
- export declare function isTree(arr: any[]): boolean;
139
138
  export declare function findFirst(items: Column<any>[]): Column<any, unknown>;
140
139
  export declare function isTreeArray(arr: any[], options?: any): boolean;
141
140
  export declare function updateColumnWidthsRecursive(columns: any[], sizing: Record<string, number>): any[];
@@ -47,7 +47,6 @@ exports.isEmpty = exports.isEditable = exports.isDisable = void 0;
47
47
  exports.isEqualSet = isEqualSet;
48
48
  exports.isObjEmpty = exports.isNullOrUndefined = exports.isNameColor = exports.isFormattedNumber = void 0;
49
49
  exports.isObjEqual = isObjEqual;
50
- exports.isTree = isTree;
51
50
  exports.isTreeArray = isTreeArray;
52
51
  exports.parseBooleanToValue = exports.onRemoveBgSelectedCell = exports.onAddBgSelectedCell = exports.newGuid = void 0;
53
52
  exports.parseClipboardEvent = parseClipboardEvent;
@@ -2024,77 +2023,69 @@ exports.convertToObjTrue = convertToObjTrue;
2024
2023
  const getDiffent2Array = (a, b) => {
2025
2024
  return [...a.filter(x => !b.includes(x)), ...b.filter(x => !a.includes(x))];
2026
2025
  };
2027
- exports.getDiffent2Array = getDiffent2Array;
2028
- function isTree(arr) {
2029
- if (!Array.isArray(arr)) {
2030
- return false;
2031
- }
2032
- function checkNode(node) {
2033
- if (typeof node !== "object" || node === null) {
2034
- return false;
2035
- }
2036
- if ("children" in node) {
2037
- if (!Array.isArray(node.children)) {
2038
- return false;
2039
- }
2040
- if (node.children.length === 0) {
2041
- return false;
2042
- }
2043
- for (const child of node.children) {
2044
- if (!checkNode(child)) {
2045
- return false;
2046
- }
2047
- }
2048
- }
2049
- return true;
2050
- }
2051
- for (const item of arr) {
2052
- if (!checkNode(item)) return false;
2053
- }
2054
- return true;
2055
- }
2056
- function findFirst(items) {
2057
- const leftItem = items.find(item => item.getIsPinned() === 'left');
2058
- if (leftItem) return leftItem;
2059
- return null;
2060
- }
2061
2026
 
2062
- // export function isTreeArray(arr: any[]): boolean {
2027
+ // export function isTree(arr: any[]): boolean {
2028
+ // if (!Array.isArray(arr)){
2029
+ // return false
2030
+ // }
2063
2031
 
2064
- // // if (!Array.isArray(arr)) return false;
2032
+ // function checkNode(node: any): boolean {
2033
+ // if (typeof node !== "object" || node === null) {
2034
+ // return false
2035
+ // }
2065
2036
 
2066
- // // return arr.every(item => {
2067
- // // if ("children" in item) {
2068
- // // return Array.isArray(item.children) && item.children.length > 0;
2069
- // // }
2070
- // // return true; // node lá thì hợp lệ
2071
- // // });
2037
+ // if ("children" in node) {
2072
2038
 
2073
- // if (!Array.isArray(arr)) return false;
2039
+ // if (!Array.isArray(node.children)) {
2040
+ // return false
2041
+ // }
2042
+ // if (node.children.length === 0) {
2043
+ // return false
2044
+ // }
2074
2045
 
2075
- // return arr.every(item => {
2076
- // if (typeof item !== "object" || item === null) return false;
2046
+ // for (const child of node.children) {
2047
+ // if (!checkNode(child)) {
2048
+ // return false
2049
+ // }
2050
+ // }
2077
2051
 
2078
- // if ("children" in item) {
2079
- // return Array.isArray(item.children);
2080
2052
  // }
2081
2053
 
2082
- // return false; // node lá thì hợp lệ
2083
- // });
2054
+ // return true;
2055
+ // }
2084
2056
 
2085
- // }
2057
+ // for (const item of arr) {
2058
+ // if (!checkNode(item)) return false;
2059
+ // }
2086
2060
 
2061
+ // return true;
2062
+ // }
2063
+ exports.getDiffent2Array = getDiffent2Array;
2064
+ function findFirst(items) {
2065
+ const leftItem = items.find(item => item.getIsPinned() === 'left');
2066
+ if (leftItem) return leftItem;
2067
+ return null;
2068
+ }
2087
2069
  function isTreeArray(arr, options) {
2088
- if (!Array.isArray(arr) || arr.length === 0) return false;
2070
+ if (!Array.isArray(arr) || arr.length === 0) {
2071
+ return false;
2072
+ }
2089
2073
  const requireNonEmpty = options?.requireNonEmptyChildren ?? false;
2090
2074
  let hasParent = false;
2091
2075
  for (const item of arr) {
2092
- if (typeof item !== 'object' || item === null) return false;
2076
+ if (typeof item !== 'object' || item === null) {
2077
+ return false;
2078
+ }
2093
2079
  if ('children' in item) {
2094
2080
  const children = item.children;
2095
- if (!Array.isArray(children)) return false;
2081
+ if (!Array.isArray(children)) {
2082
+ // return false;
2083
+ hasParent = false;
2084
+ }
2096
2085
  if (requireNonEmpty) {
2097
- if (children.length > 0) hasParent = true;
2086
+ if (children.length > 0) {
2087
+ hasParent = true;
2088
+ }
2098
2089
  } else {
2099
2090
  hasParent = true;
2100
2091
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "es-grid-template",
3
- "version": "1.8.33",
3
+ "version": "1.8.34",
4
4
  "description": "es-grid-template",
5
5
  "keywords": [
6
6
  "react",