@elliemae/ds-treeview 3.52.0-rc.8 → 3.52.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.
@@ -34,12 +34,12 @@ module.exports = __toCommonJS(useTree_exports);
34
34
  var React = __toESM(require("react"));
35
35
  var import_react = require("react");
36
36
  var import_tree_model = __toESM(require("tree-model"));
37
- var import_lodash = require("lodash");
37
+ var import_lodash_es = require("lodash-es");
38
38
  var import_tree_helpers = require("./tree-helpers.js");
39
39
  var import_group_expands_helpers = require("./group-expands-helpers.js");
40
40
  const useTree = (data, props, states) => {
41
41
  const { setExpandedGroups } = states;
42
- const unfrozenData = (0, import_react.useMemo)(() => (0, import_lodash.cloneDeep)(data), [data]);
42
+ const unfrozenData = (0, import_react.useMemo)(() => (0, import_lodash_es.cloneDeep)(data), [data]);
43
43
  const visibleItemsRef = (0, import_react.useRef)([]);
44
44
  const tree = (0, import_react.useMemo)(() => new import_tree_model.default(), []);
45
45
  const [treeData, setTreeData] = (0, import_react.useState)({
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/useTree.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { useState, useCallback, useRef, useMemo, useEffect } from 'react';\nimport TreeModel from 'tree-model';\nimport { cloneDeep } from 'lodash';\nimport { walkVisibles, enrichNodeModelInPlace, flattenTreeForDnD } from './tree-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nimport type { DSTreeviewInternalsT } from '../sharedTypes.js';\nimport { updateExpandedState } from './group-expands-helpers.js';\n\nexport const useTree = (\n data: DSTreeviewT.SimpleItem[],\n props: DSTreeviewT.Props,\n states: {\n setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;\n },\n) => {\n const { setExpandedGroups } = states;\n const unfrozenData = useMemo(() => cloneDeep(data), [data]);\n\n const visibleItemsRef = useRef<DSTreeviewT.Item[]>([]);\n // convert data into a TreeModel with extra isExpanded prop\n // root element type is an exception, children model is based on what the dev passed on\n // since root is an excepcion we must typecast\n const tree = useMemo(() => new TreeModel(), []);\n const [treeData, setTreeData] = useState({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n\n useEffect(() => {\n setTreeData({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n }, [unfrozenData]);\n\n // expose a way to rerender the tree\n // used for expand functionality\n const [rerenderItems, setRerenderItems] = useState({});\n const triggerTreeRerender = useCallback(() => {\n setRerenderItems({});\n }, []);\n\n // when re-rendering we re-parse the list\n // Here we are initializing the tree with a function since for some reason,\n // tree.parse is re-executing every time the treeview is re-rendered. I honestly don't know why.\n const [treeRoot, setTreeRoot] = useState(() => tree.parse(treeData));\n useEffect(() => {\n setTreeRoot(tree.parse(treeData));\n }, [treeData, rerenderItems, tree]);\n\n const [visibleItems, setVisibleItems] = useState<DSTreeviewT.Item[]>([]);\n\n const { searchQuery, highlightOnlyQuery, onVisibleItemsChange, selection, expanded, onExpandChange } = props;\n\n const updateUserExpandedState = useCallback(() => {\n updateExpandedState(treeRoot, onExpandChange);\n }, [treeRoot, onExpandChange]);\n // we add missing properties to the received Items\n // not the best of the patterns, but it works\n // this is where we convert \"SimpleItems\" to \"Items\"\n // this was done to avoid breaking changes back in v1\n useEffect(() => {\n const parsedVisibleItems: DSTreeviewT.Item[] = [];\n const newExpandedHashMap: DSTreeviewT.ExpandedItems = {};\n const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking\n treeRoot.walk((node) => {\n enrichNodeModelInPlace(node, searchQuery, selection, expanded);\n if (node.model.id && node.model.isGroup && node.model.isExpanded) newExpandedHashMap[node.model.id] = true;\n return shouldContinueWalking;\n });\n\n walkVisibles(\n treeRoot,\n (node) => {\n parsedVisibleItems.push({ ...node.model, node });\n },\n true,\n highlightOnlyQuery,\n );\n setVisibleItems(parsedVisibleItems);\n visibleItemsRef.current = parsedVisibleItems;\n onVisibleItemsChange(parsedVisibleItems);\n\n setExpandedGroups(newExpandedHashMap);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n treeRoot,\n rerenderItems,\n searchQuery,\n highlightOnlyQuery,\n selection,\n expanded,\n setExpandedGroups,\n // onVisibleItemsChange // evaluate potential performance hit?\n ]);\n\n const flattenedItems = useMemo(() => flattenTreeForDnD(treeRoot), [treeRoot]);\n\n return {\n visibleItems,\n flattenedItems,\n tree,\n treeRoot,\n rerenderItems,\n triggerTreeRerender,\n updateUserExpandedState,\n visibleItemsRef,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkE;AAClE,wBAAsB;AACtB,oBAA0B;AAC1B,0BAAwE;AAGxE,mCAAoC;AAE7B,MAAM,UAAU,CACrB,MACA,OACA,WAGG;AACH,QAAM,EAAE,kBAAkB,IAAI;AAC9B,QAAM,mBAAe,sBAAQ,UAAM,yBAAU,IAAI,GAAG,CAAC,IAAI,CAAC;AAE1D,QAAM,sBAAkB,qBAA2B,CAAC,CAAC;AAIrD,QAAM,WAAO,sBAAQ,MAAM,IAAI,kBAAAA,QAAU,GAAG,CAAC,CAAC;AAC9C,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS;AAAA,IACvC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAgC;AAEhC,8BAAU,MAAM;AACd,gBAAY;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ,CAAgC;AAAA,EAClC,GAAG,CAAC,YAAY,CAAC;AAIjB,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,CAAC,CAAC;AACrD,QAA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,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { useState, useCallback, useRef, useMemo, useEffect } from 'react';\nimport TreeModel from 'tree-model';\nimport { cloneDeep } from 'lodash-es';\nimport { walkVisibles, enrichNodeModelInPlace, flattenTreeForDnD } from './tree-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nimport type { DSTreeviewInternalsT } from '../sharedTypes.js';\nimport { updateExpandedState } from './group-expands-helpers.js';\n\nexport const useTree = (\n data: DSTreeviewT.SimpleItem[],\n props: DSTreeviewT.Props,\n states: {\n setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;\n },\n) => {\n const { setExpandedGroups } = states;\n const unfrozenData = useMemo(() => cloneDeep(data), [data]);\n\n const visibleItemsRef = useRef<DSTreeviewT.Item[]>([]);\n // convert data into a TreeModel with extra isExpanded prop\n // root element type is an exception, children model is based on what the dev passed on\n // since root is an excepcion we must typecast\n const tree = useMemo(() => new TreeModel(), []);\n const [treeData, setTreeData] = useState({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n\n useEffect(() => {\n setTreeData({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n }, [unfrozenData]);\n\n // expose a way to rerender the tree\n // used for expand functionality\n const [rerenderItems, setRerenderItems] = useState({});\n const triggerTreeRerender = useCallback(() => {\n setRerenderItems({});\n }, []);\n\n // when re-rendering we re-parse the list\n // Here we are initializing the tree with a function since for some reason,\n // tree.parse is re-executing every time the treeview is re-rendered. I honestly don't know why.\n const [treeRoot, setTreeRoot] = useState(() => tree.parse(treeData));\n useEffect(() => {\n setTreeRoot(tree.parse(treeData));\n }, [treeData, rerenderItems, tree]);\n\n const [visibleItems, setVisibleItems] = useState<DSTreeviewT.Item[]>([]);\n\n const { searchQuery, highlightOnlyQuery, onVisibleItemsChange, selection, expanded, onExpandChange } = props;\n\n const updateUserExpandedState = useCallback(() => {\n updateExpandedState(treeRoot, onExpandChange);\n }, [treeRoot, onExpandChange]);\n // we add missing properties to the received Items\n // not the best of the patterns, but it works\n // this is where we convert \"SimpleItems\" to \"Items\"\n // this was done to avoid breaking changes back in v1\n useEffect(() => {\n const parsedVisibleItems: DSTreeviewT.Item[] = [];\n const newExpandedHashMap: DSTreeviewT.ExpandedItems = {};\n const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking\n treeRoot.walk((node) => {\n enrichNodeModelInPlace(node, searchQuery, selection, expanded);\n if (node.model.id && node.model.isGroup && node.model.isExpanded) newExpandedHashMap[node.model.id] = true;\n return shouldContinueWalking;\n });\n\n walkVisibles(\n treeRoot,\n (node) => {\n parsedVisibleItems.push({ ...node.model, node });\n },\n true,\n highlightOnlyQuery,\n );\n setVisibleItems(parsedVisibleItems);\n visibleItemsRef.current = parsedVisibleItems;\n onVisibleItemsChange(parsedVisibleItems);\n\n setExpandedGroups(newExpandedHashMap);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n treeRoot,\n rerenderItems,\n searchQuery,\n highlightOnlyQuery,\n selection,\n expanded,\n setExpandedGroups,\n // onVisibleItemsChange // evaluate potential performance hit?\n ]);\n\n const flattenedItems = useMemo(() => flattenTreeForDnD(treeRoot), [treeRoot]);\n\n return {\n visibleItems,\n flattenedItems,\n tree,\n treeRoot,\n rerenderItems,\n triggerTreeRerender,\n updateUserExpandedState,\n visibleItemsRef,\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkE;AAClE,wBAAsB;AACtB,uBAA0B;AAC1B,0BAAwE;AAGxE,mCAAoC;AAE7B,MAAM,UAAU,CACrB,MACA,OACA,WAGG;AACH,QA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AAI,KAAK,MAAM,MAAM,KAAK,MAAM,WAAW,KAAK,MAAM,WAAY,oBAAmB,KAAK,MAAM,EAAE,IAAI;AACtG,aAAO;AAAA,IACT,CAAC;AAED;AAAA,MACE;AAAA,MACA,CAAC,SAAS;AACR,2BAAmB,KAAK,EAAE,GAAG,KAAK,OAAO,KAAK,CAAC;AAAA,MACjD;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,oBAAgB,kBAAkB;AAClC,oBAAgB,UAAU;AAC1B,yBAAqB,kBAAkB;AAEvC,sBAAkB,kBAAkB;AAAA,EAEtC,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA,EAEF,CAAC;AAED,QAAM,qBAAiB,sBAAQ,UAAM,uCAAkB,QAAQ,GAAG,CAAC,QAAQ,CAAC;AAE5E,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["TreeModel"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { useState, useCallback, useRef, useMemo, useEffect } from "react";
3
3
  import TreeModel from "tree-model";
4
- import { cloneDeep } from "lodash";
4
+ import { cloneDeep } from "lodash-es";
5
5
  import { walkVisibles, enrichNodeModelInPlace, flattenTreeForDnD } from "./tree-helpers.js";
6
6
  import { updateExpandedState } from "./group-expands-helpers.js";
7
7
  const useTree = (data, props, states) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/utils/useTree.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState, useCallback, useRef, useMemo, useEffect } from 'react';\nimport TreeModel from 'tree-model';\nimport { cloneDeep } from 'lodash';\nimport { walkVisibles, enrichNodeModelInPlace, flattenTreeForDnD } from './tree-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nimport type { DSTreeviewInternalsT } from '../sharedTypes.js';\nimport { updateExpandedState } from './group-expands-helpers.js';\n\nexport const useTree = (\n data: DSTreeviewT.SimpleItem[],\n props: DSTreeviewT.Props,\n states: {\n setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;\n },\n) => {\n const { setExpandedGroups } = states;\n const unfrozenData = useMemo(() => cloneDeep(data), [data]);\n\n const visibleItemsRef = useRef<DSTreeviewT.Item[]>([]);\n // convert data into a TreeModel with extra isExpanded prop\n // root element type is an exception, children model is based on what the dev passed on\n // since root is an excepcion we must typecast\n const tree = useMemo(() => new TreeModel(), []);\n const [treeData, setTreeData] = useState({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n\n useEffect(() => {\n setTreeData({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n }, [unfrozenData]);\n\n // expose a way to rerender the tree\n // used for expand functionality\n const [rerenderItems, setRerenderItems] = useState({});\n const triggerTreeRerender = useCallback(() => {\n setRerenderItems({});\n }, []);\n\n // when re-rendering we re-parse the list\n // Here we are initializing the tree with a function since for some reason,\n // tree.parse is re-executing every time the treeview is re-rendered. I honestly don't know why.\n const [treeRoot, setTreeRoot] = useState(() => tree.parse(treeData));\n useEffect(() => {\n setTreeRoot(tree.parse(treeData));\n }, [treeData, rerenderItems, tree]);\n\n const [visibleItems, setVisibleItems] = useState<DSTreeviewT.Item[]>([]);\n\n const { searchQuery, highlightOnlyQuery, onVisibleItemsChange, selection, expanded, onExpandChange } = props;\n\n const updateUserExpandedState = useCallback(() => {\n updateExpandedState(treeRoot, onExpandChange);\n }, [treeRoot, onExpandChange]);\n // we add missing properties to the received Items\n // not the best of the patterns, but it works\n // this is where we convert \"SimpleItems\" to \"Items\"\n // this was done to avoid breaking changes back in v1\n useEffect(() => {\n const parsedVisibleItems: DSTreeviewT.Item[] = [];\n const newExpandedHashMap: DSTreeviewT.ExpandedItems = {};\n const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking\n treeRoot.walk((node) => {\n enrichNodeModelInPlace(node, searchQuery, selection, expanded);\n if (node.model.id && node.model.isGroup && node.model.isExpanded) newExpandedHashMap[node.model.id] = true;\n return shouldContinueWalking;\n });\n\n walkVisibles(\n treeRoot,\n (node) => {\n parsedVisibleItems.push({ ...node.model, node });\n },\n true,\n highlightOnlyQuery,\n );\n setVisibleItems(parsedVisibleItems);\n visibleItemsRef.current = parsedVisibleItems;\n onVisibleItemsChange(parsedVisibleItems);\n\n setExpandedGroups(newExpandedHashMap);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n treeRoot,\n rerenderItems,\n searchQuery,\n highlightOnlyQuery,\n selection,\n expanded,\n setExpandedGroups,\n // onVisibleItemsChange // evaluate potential performance hit?\n ]);\n\n const flattenedItems = useMemo(() => flattenTreeForDnD(treeRoot), [treeRoot]);\n\n return {\n visibleItems,\n flattenedItems,\n tree,\n treeRoot,\n rerenderItems,\n triggerTreeRerender,\n updateUserExpandedState,\n visibleItemsRef,\n };\n};\n"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { useState, useCallback, useRef, useMemo, useEffect } from 'react';\nimport TreeModel from 'tree-model';\nimport { cloneDeep } from 'lodash-es';\nimport { walkVisibles, enrichNodeModelInPlace, flattenTreeForDnD } from './tree-helpers.js';\nimport type { DSTreeviewT } from '../react-desc-prop-types.js';\nimport type { DSTreeviewInternalsT } from '../sharedTypes.js';\nimport { updateExpandedState } from './group-expands-helpers.js';\n\nexport const useTree = (\n data: DSTreeviewT.SimpleItem[],\n props: DSTreeviewT.Props,\n states: {\n setExpandedGroups: DSTreeviewInternalsT.StateSetter<DSTreeviewT.ExpandedItems>;\n },\n) => {\n const { setExpandedGroups } = states;\n const unfrozenData = useMemo(() => cloneDeep(data), [data]);\n\n const visibleItemsRef = useRef<DSTreeviewT.Item[]>([]);\n // convert data into a TreeModel with extra isExpanded prop\n // root element type is an exception, children model is based on what the dev passed on\n // since root is an excepcion we must typecast\n const tree = useMemo(() => new TreeModel(), []);\n const [treeData, setTreeData] = useState({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n\n useEffect(() => {\n setTreeData({\n id: '__ds_tree_root',\n name: '__root',\n isExpanded: true,\n children: unfrozenData,\n } as unknown as DSTreeviewT.Item);\n }, [unfrozenData]);\n\n // expose a way to rerender the tree\n // used for expand functionality\n const [rerenderItems, setRerenderItems] = useState({});\n const triggerTreeRerender = useCallback(() => {\n setRerenderItems({});\n }, []);\n\n // when re-rendering we re-parse the list\n // Here we are initializing the tree with a function since for some reason,\n // tree.parse is re-executing every time the treeview is re-rendered. I honestly don't know why.\n const [treeRoot, setTreeRoot] = useState(() => tree.parse(treeData));\n useEffect(() => {\n setTreeRoot(tree.parse(treeData));\n }, [treeData, rerenderItems, tree]);\n\n const [visibleItems, setVisibleItems] = useState<DSTreeviewT.Item[]>([]);\n\n const { searchQuery, highlightOnlyQuery, onVisibleItemsChange, selection, expanded, onExpandChange } = props;\n\n const updateUserExpandedState = useCallback(() => {\n updateExpandedState(treeRoot, onExpandChange);\n }, [treeRoot, onExpandChange]);\n // we add missing properties to the received Items\n // not the best of the patterns, but it works\n // this is where we convert \"SimpleItems\" to \"Items\"\n // this was done to avoid breaking changes back in v1\n useEffect(() => {\n const parsedVisibleItems: DSTreeviewT.Item[] = [];\n const newExpandedHashMap: DSTreeviewT.ExpandedItems = {};\n const shouldContinueWalking = true; // tree-model ask we return true if we want to continue walking\n treeRoot.walk((node) => {\n enrichNodeModelInPlace(node, searchQuery, selection, expanded);\n if (node.model.id && node.model.isGroup && node.model.isExpanded) newExpandedHashMap[node.model.id] = true;\n return shouldContinueWalking;\n });\n\n walkVisibles(\n treeRoot,\n (node) => {\n parsedVisibleItems.push({ ...node.model, node });\n },\n true,\n highlightOnlyQuery,\n );\n setVisibleItems(parsedVisibleItems);\n visibleItemsRef.current = parsedVisibleItems;\n onVisibleItemsChange(parsedVisibleItems);\n\n setExpandedGroups(newExpandedHashMap);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n treeRoot,\n rerenderItems,\n searchQuery,\n highlightOnlyQuery,\n selection,\n expanded,\n setExpandedGroups,\n // onVisibleItemsChange // evaluate potential performance hit?\n ]);\n\n const flattenedItems = useMemo(() => flattenTreeForDnD(treeRoot), [treeRoot]);\n\n return {\n visibleItems,\n flattenedItems,\n tree,\n treeRoot,\n rerenderItems,\n triggerTreeRerender,\n updateUserExpandedState,\n visibleItemsRef,\n };\n};\n"],
5
5
  "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,aAAa,QAAQ,SAAS,iBAAiB;AAClE,OAAO,eAAe;AACtB,SAAS,iBAAiB;AAC1B,SAAS,cAAc,wBAAwB,yBAAyB;AAGxE,SAAS,2BAA2B;AAE7B,MAAM,UAAU,CACrB,MACA,OACA,WAGG;AACH,QAAM,EAAE,kBAAkB,IAAI;AAC9B,QAAM,eAAe,QAAQ,MAAM,UAAU,IAAI,GAAG,CAAC,IAAI,CAAC;AAE1D,QAAM,kBAAkB,OAA2B,CAAC,CAAC;AAIrD,QAAM,OAAO,QAAQ,MAAM,IAAI,UAAU,GAAG,CAAC,CAAC;AAC9C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS;AAAA,IACvC,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ,CAAgC;AAEhC,YAAU,MAAM;AACd,gBAAY;AAAA,MACV,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,UAAU;AAAA,IACZ,CAAgC;AAAA,EAClC,GAAG,CAAC,YAAY,CAAC;AAIjB,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,CAAC,CAAC;AACrD,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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-treeview",
3
- "version": "3.52.0-rc.8",
3
+ "version": "3.52.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Tree View",
6
6
  "files": [
@@ -44,26 +44,26 @@
44
44
  "react-virtual": "~2.10.4",
45
45
  "tree-model": "~1.0.7",
46
46
  "uid": "~2.0.1",
47
- "@elliemae/ds-button-v2": "3.52.0-rc.8",
48
- "@elliemae/ds-circular-progress-indicator": "3.52.0-rc.8",
49
- "@elliemae/ds-controlled-form": "3.52.0-rc.8",
50
- "@elliemae/ds-classnames": "3.52.0-rc.8",
51
- "@elliemae/ds-drag-and-drop": "3.52.0-rc.8",
52
- "@elliemae/ds-form": "3.52.0-rc.8",
53
- "@elliemae/ds-props-helpers": "3.52.0-rc.8",
54
- "@elliemae/ds-icons": "3.52.0-rc.8",
55
- "@elliemae/ds-system": "3.52.0-rc.8",
56
- "@elliemae/ds-truncated-tooltip-text": "3.52.0-rc.8",
57
- "@elliemae/ds-typescript-helpers": "3.52.0-rc.8"
47
+ "@elliemae/ds-button-v2": "3.52.0",
48
+ "@elliemae/ds-classnames": "3.52.0",
49
+ "@elliemae/ds-circular-progress-indicator": "3.52.0",
50
+ "@elliemae/ds-controlled-form": "3.52.0",
51
+ "@elliemae/ds-drag-and-drop": "3.52.0",
52
+ "@elliemae/ds-truncated-tooltip-text": "3.52.0",
53
+ "@elliemae/ds-props-helpers": "3.52.0",
54
+ "@elliemae/ds-form": "3.52.0",
55
+ "@elliemae/ds-typescript-helpers": "3.52.0",
56
+ "@elliemae/ds-icons": "3.52.0",
57
+ "@elliemae/ds-system": "3.52.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@elliemae/pui-cli": "9.0.0-next.55",
60
+ "@elliemae/pui-cli": "9.0.0-next.63",
61
61
  "jest": "~29.7.0",
62
62
  "styled-components": "~5.3.9",
63
- "@elliemae/ds-monorepo-devops": "3.52.0-rc.8"
63
+ "@elliemae/ds-monorepo-devops": "3.52.0"
64
64
  },
65
65
  "peerDependencies": {
66
- "lodash": "^4.17.21",
66
+ "lodash-es": "^4.17.21",
67
67
  "react": "^18.3.1",
68
68
  "react-dom": "^18.3.1",
69
69
  "styled-components": "~5.3.9"