@asup/tree-of-nodes 1.0.1 → 1.0.3
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/README.md +4 -5
- package/dist/cjs/main.css +41 -0
- package/dist/cjs/main.css.map +1 -0
- package/dist/cjs/main.js +643 -1667
- package/dist/cjs/main.js.map +1 -0
- package/dist/main.css +41 -0
- package/dist/main.css.map +1 -0
- package/dist/main.js +502 -1657
- package/dist/main.js.map +1 -0
- package/dist/tree-of-nodes.d.ts +43 -39
- package/dist/tree-of-nodes.d.ts.map +1 -0
- package/package.json +7 -11
- package/dist/__mocks__/mockNodes.d.ts +0 -4
- package/dist/__mocks__/styleMock.d.ts +0 -2
- package/dist/__tests__/ContextMenu.d.ts +0 -1
- package/dist/__tests__/TreeNode.test.d.ts +0 -1
- package/dist/__tests__/TreeOfNodes.test.d.ts +0 -1
- package/dist/__tests__/WordEntry.test.d.ts +0 -1
- package/dist/cjs/__mocks__/mockNodes.d.ts +0 -4
- package/dist/cjs/__mocks__/styleMock.d.ts +0 -2
- package/dist/cjs/__tests__/ContextMenu.d.ts +0 -1
- package/dist/cjs/__tests__/TreeNode.test.d.ts +0 -1
- package/dist/cjs/__tests__/TreeOfNodes.test.d.ts +0 -1
- package/dist/cjs/__tests__/WordEntry.test.d.ts +0 -1
- package/dist/cjs/components/ContextMenu.d.ts +0 -4
- package/dist/cjs/components/ContextMenuProvider.d.ts +0 -28
- package/dist/cjs/components/TreeNode.d.ts +0 -13
- package/dist/cjs/components/TreeOfNodes.d.ts +0 -20
- package/dist/cjs/components/TreeOfNodesContext.d.ts +0 -28
- package/dist/cjs/components/WordEntry.d.ts +0 -12
- package/dist/cjs/components/index.d.ts +0 -8
- package/dist/cjs/main.d.ts +0 -1
- package/dist/cjs/style.css +0 -1
- package/dist/components/ContextMenu.d.ts +0 -4
- package/dist/components/ContextMenuProvider.d.ts +0 -28
- package/dist/components/TreeNode.d.ts +0 -13
- package/dist/components/TreeOfNodes.d.ts +0 -20
- package/dist/components/TreeOfNodesContext.d.ts +0 -28
- package/dist/components/WordEntry.d.ts +0 -12
- package/dist/components/index.d.ts +0 -8
- package/dist/main.d.ts +0 -1
- package/dist/style.css +0 -1
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AEAA;;;AAIO,MAAM,0DAAc,CAAA,GAAA,YAAK,AAAD,EAAE,UAAU,CACzC,CAAC,WAAE,QAAO,WAAE,QAAO,QAAE,KAAI,QAAE,KAAI,EAAE,EAAE,MAAqB;IACtD,0CAAY,WAAW,GAAG;QAmBjB;IAjBT,qBACE,gBAAC;QACC,KAAK;QACL,WAAW,CAAC,aAAa,EAAE,UAAU,YAAY,EAAE,CAAC,CAAC;QACrD,OAAO;YACL,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;YAChB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QACnB;kBAEC,QAAQ,GAAG,CAAC,CAAC,GAAG,kBACf,gBAAC;gBAEC,WAAU;gBACV,SAAS,IAAM;oBACb,EAAE,MAAM,IAAI,EAAE,MAAM;gBACtB;0BAEC,CAAA,WAAA,EAAE,KAAK,cAAP,sBAAA,WAAW,EAAE;eANT;;AAWf;;AD9BF;AEAA;;;AAsBO,MAAM,0DAAc,CAAA,GAAA,YAAK,AAAD,EAAE,aAAa,CAAuB,CAAC;AAK/D,MAAM,4CAAsB,CAAC,YAAE,SAAQ,EAAwB,GAAkB;IACtF,iBAAiB;IACjB,MAAM,SAAS,CAAA,GAAA,aAAK,EAAyB,IAAI;IACjD,MAAM,UAAU,CAAA,GAAA,aAAK,EAAyB,IAAI;IAClD,MAAM,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAQ,AAAD,EAAU;IACjD,MAAM,CAAC,UAAU,YAAY,GAAG,CAAA,GAAA,eAAQ,AAAD,EAAU;IACjD,MAAM,CAAC,aAAa,eAAe,GAAG,CAAA,GAAA,eAAO,E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,cAAA,gBAAC,CAAA,GAAA,yCAAiB,EAAE,QAAQ;YAC1B,OAAO;gBACL,IAAI;0BACJ;4BACA;8BACA;+BACA;gBACA,mBAAmB,CAAC,GAAG,IAAM,aAAa,GAAG;gBAC7C,YAAY;0BACZ;0BACA;YACF;sBAEC,MAAM,GAAG,CAAC,CAAC,kBACV,gBAAC,CAAA,GAAA,yCAAO;oBAEN,IAAI;oBACJ,WAAW;oBACX,gBAAgB;oBAChB,WAAW;oBACX,mBAAmB;oBACnB,mBAAmB;mBANd;;;AAYjB;;;;;APzFA;;;;AUAA;","sources":["src/main.ts","src/components/index.ts","src/components/ContextMenu.tsx","src/components/ContextMenuProvider.tsx","src/components/TreeNode.tsx","src/components/TreeOfNodesContext.ts","src/components/WordEntry.tsx","src/components/TreeOfNodes.tsx","src/functions/checkExpandedNodes.ts","src/functions/getParents.tsx","src/functions/index.ts"],"sourcesContent":["export * from './components';\nexport * from './functions';\n","import { ContextMenu } from './ContextMenu';\nimport { ContextMenuProvider, iMenuItem, MenuContext } from './ContextMenuProvider';\nimport { TreeNode } from './TreeNode';\nimport { TreeOfNodes } from './TreeOfNodes';\nimport { iNodeUpdate, TreeNodeBase, TreeNodeData } from './interface';\nimport { WordEntry } from './WordEntry';\n\nexport { ContextMenu, ContextMenuProvider, TreeNode, TreeOfNodes, WordEntry };\nexport type { TreeNodeBase, TreeNodeData, iNodeUpdate, iMenuItem, MenuContext };\n","import React from 'react';\nimport { contextMenuProps } from './ContextMenuProvider';\nimport './ContextMenu.css';\n\nexport const ContextMenu = React.forwardRef<HTMLDivElement, contextMenuProps>(\n ({ entries, visible, xPos, yPos }, ref): JSX.Element => {\n ContextMenu.displayName = 'ContextMenu';\n\n return (\n <div\n ref={ref}\n className={`context-menu ${visible ? 'visible' : ''}`}\n style={{\n top: `${yPos}px`,\n left: `${xPos}px`,\n }}\n >\n {entries.map((e, i) => (\n <div\n key={i}\n className='context-menu-item'\n onClick={() => {\n e.action && e.action();\n }}\n >\n {e.label ?? ''}\n </div>\n ))}\n </div>\n );\n },\n);\n","import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { ContextMenu } from './ContextMenu';\n\nexport interface iContextMenuSettings {\n visible?: boolean;\n x?: number;\n y?: number;\n set?: (ret: { visible?: boolean; x?: number; y?: number; menuItems?: iMenuItem[] }) => void;\n}\n\nexport interface contextMenuProps {\n entries: iMenuItem[];\n visible: boolean;\n xPos: number;\n yPos: number;\n}\n\nexport interface iMenuItem {\n label?: string;\n action?: () => void;\n}\n\nexport const MenuContext = React.createContext<iContextMenuSettings>({});\n\ninterface iContextMenuProvider {\n children: React.ReactNode;\n}\nexport const ContextMenuProvider = ({ children }: iContextMenuProvider): JSX.Element => {\n // Menu resources\n const divRef = useRef<HTMLDivElement | null>(null);\n const menuRef = useRef<HTMLDivElement | null>(null);\n const [menuXPos, setMenuXPos] = useState<number>(0);\n const [menuYPos, setMenuYPos] = useState<number>(0);\n const [menuVisible, setMenuVisible] = useState<boolean>(false);\n const [menuItems, setMenuItems] = useState<iMenuItem[]>([]);\n\n // Update menu items\n const updateMenu = useCallback(\n (ret: { visible?: boolean; x?: number; y?: number; menuItems?: iMenuItem[] }) => {\n if (divRef.current) {\n if (ret.visible !== undefined) setMenuVisible(ret.visible);\n if (ret.x) setMenuXPos(ret.x - window.scrollX - divRef.current.getBoundingClientRect().x);\n if (ret.y) setMenuYPos(ret.y - window.scrollX - divRef.current.getBoundingClientRect().y);\n if (ret.menuItems !== undefined) setMenuItems(ret.menuItems);\n }\n },\n [],\n );\n\n // Handle click off the menu\n const handleClick = useCallback((e: MouseEvent) => {\n if (\n menuRef.current &&\n ((e.target instanceof Element && !menuRef.current?.contains(e.target)) ||\n !(e.target instanceof Element))\n ) {\n setMenuVisible(false);\n }\n }, []);\n\n // Update the document click handler\n useEffect(() => {\n if (menuVisible) document.addEventListener('mousedown', handleClick);\n else document.removeEventListener('mousedown', handleClick);\n return () => {\n document.removeEventListener('mousedown', handleClick);\n };\n }, [handleClick, menuVisible]);\n\n return (\n <MenuContext.Provider\n value={{\n visible: menuVisible,\n x: menuXPos,\n y: menuYPos,\n set: updateMenu,\n }}\n >\n <div\n className='menu-context-provider'\n style={{ position: 'relative' }}\n ref={divRef}\n >\n {children}\n <ContextMenu\n ref={menuRef}\n entries={menuItems}\n visible={menuVisible}\n xPos={menuXPos}\n yPos={menuYPos}\n />\n </div>\n </MenuContext.Provider>\n );\n};\n","import React, { Key, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Spinner } from 'react-bootstrap';\nimport {\n CaretDownFill,\n CaretRight,\n CaretRightFill,\n ExclamationCircleFill,\n} from 'react-bootstrap-icons';\nimport { iMenuItem, MenuContext } from './ContextMenuProvider';\nimport { iNodeUpdate } from './interface';\nimport { TreeOfNodesContext } from './TreeOfNodesContext';\nimport { WordEntry } from './WordEntry';\n\ninterface TreeNodeProps {\n id: Key;\n indentLevel?: number;\n canRemove?: boolean;\n canRename?: boolean;\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRenameChildren?: boolean;\n refresh?: () => void;\n}\n\nexport const TreeNode = ({\n id,\n canRemove,\n canRename,\n canAddChildren,\n canRemoveChildren,\n canRenameChildren,\n}: TreeNodeProps): JSX.Element => {\n // Contexts\n const treeContext = useContext(TreeOfNodesContext);\n const menuContext = useContext(MenuContext);\n\n // Node information\n const thisNode = useMemo(\n () => treeContext.nodeList.find((n) => n.id === id),\n [id, treeContext.nodeList],\n );\n const childNodes = useMemo(\n () => treeContext.nodeList.filter((n) => n.parentId === id),\n [id, treeContext.nodeList],\n );\n\n // State\n const loading = useMemo<boolean>(\n () => treeContext.nodeList.findIndex((n) => n.id === id) === -1,\n [id, treeContext.nodeList],\n );\n const [error, setError] = useState<boolean>(false);\n const [errorText, setErrotText] = useState<string | null>(null);\n const expanded = useMemo(() => {\n return (treeContext.expandedNodes?.findIndex((e) => e === id) ?? -1) > -1;\n }, [id, treeContext.expandedNodes]);\n\n // // Apply selected borer\n const currentBorder = useMemo<string>(() => {\n return id === treeContext.selectedId ? '1px solid black' : '';\n }, [id, treeContext.selectedId]);\n\n // New node parameters\n const newNameRef = useRef<HTMLInputElement | null>(null);\n const [showNewNode, setShowNewNode] = useState<boolean>(false);\n const [savingNewNode, setSavingNewNode] = useState<boolean>(false);\n\n // Rename parameters\n const currentNameRef = useRef<HTMLInputElement | null>(null);\n const [renaming, setRenaming] = useState<boolean>(false);\n const [updatingNode, setUpdatingNode] = useState<boolean>(false);\n\n // Context functions\n const handleReturn = useCallback((ret: iNodeUpdate) => {\n if (!ret.success) {\n setError(true);\n setErrotText(ret.ErrorText ?? 'An unknown error has occured');\n } else {\n setError(false);\n setErrotText(null);\n }\n }, []);\n\n const confirmNewNode = useCallback(\n async (label: string) => {\n setSavingNewNode(true);\n if (treeContext.onAddChild) {\n handleReturn(await treeContext.onAddChild(id, label));\n }\n setSavingNewNode(false);\n setShowNewNode(false);\n },\n [handleReturn, id, treeContext],\n );\n\n const renameNode = useCallback(\n async (newLabel: string) => {\n setRenaming(false);\n setUpdatingNode(true);\n if (treeContext.onRename) {\n handleReturn(await treeContext.onRename(id, newLabel));\n }\n setUpdatingNode(false);\n },\n [handleReturn, id, treeContext],\n );\n\n const deleteThis = useCallback(async () => {\n setUpdatingNode(true);\n if (treeContext.onRemove) {\n handleReturn(await treeContext.onRemove(id));\n }\n setUpdatingNode(false);\n }, [handleReturn, id, treeContext]);\n\n // Context actions\n const addChild = useCallback(() => {\n if (menuContext.set) {\n menuContext.set({ visible: false });\n setShowNewNode(true);\n treeContext.handleExpandClick && treeContext.handleExpandClick(id, true);\n }\n }, [id, menuContext, treeContext]);\n useEffect(() => {\n if (showNewNode === true && newNameRef.current) newNameRef.current.focus();\n }, [showNewNode]);\n const renameThis = useCallback(() => {\n if (menuContext.set) {\n menuContext.set({ visible: false });\n setRenaming(true);\n }\n }, [menuContext]);\n useEffect(() => {\n if (renaming === true && currentNameRef.current) currentNameRef.current.focus();\n }, [renaming]);\n const removeThis = useCallback(() => {\n if (menuContext.set) {\n menuContext.set({ visible: false });\n deleteThis();\n }\n }, [menuContext, deleteThis]);\n\n // Context menu\n const showMenu = useCallback(\n (e: React.MouseEvent<HTMLSpanElement>) => {\n e.preventDefault();\n e.stopPropagation();\n const menuItems: iMenuItem[] = [];\n if (canAddChildren) {\n menuItems.push({ label: 'Add', action: addChild });\n }\n if (canRename) {\n menuItems.push({ label: 'Rename', action: renameThis });\n }\n if (canRemove && (childNodes === undefined || childNodes.length === 0)) {\n menuItems.push({ label: 'Delete', action: removeThis });\n }\n if (typeof menuContext.set === 'function') {\n menuContext.set({\n visible: true,\n y: e.pageY,\n x: e.pageX,\n menuItems: menuItems,\n });\n }\n },\n [\n addChild,\n canAddChildren,\n canRemove,\n canRename,\n childNodes,\n menuContext,\n removeThis,\n renameThis,\n ],\n );\n\n // Return node\n return (\n <div\n id={`${treeContext.id}-treenode-${id}`}\n className='treenode'\n onClickCapture={() => treeContext.handleSelect && treeContext.handleSelect(id)}\n onContextMenuCapture={() => treeContext.handleSelect && treeContext.handleSelect(id)}\n onFocusCapture={() => treeContext.handleSelect && treeContext.handleSelect(id)}\n >\n {error ? (\n <>\n <ExclamationCircleFill color='var(--bs-danger)' />{' '}\n {errorText && errorText !== '' ? errorText : 'An unknown error has occured'}\n </>\n ) : loading ? (\n <>\n <Spinner\n size='sm'\n animation='border'\n />{' '}\n Loading...\n </>\n ) : (\n <span onContextMenu={showMenu}>\n {childNodes !== undefined && childNodes.length > 0 ? (\n !expanded ? (\n <CaretRightFill\n role='button'\n aria-expanded={false}\n id={`${treeContext.id}-treenode-caret-${id}`}\n onClick={() => treeContext.handleExpandClick && treeContext.handleExpandClick(id)}\n />\n ) : (\n <CaretDownFill\n role='button'\n aria-expanded={true}\n id={`${treeContext.id}-treenode-caret-${id}`}\n onClick={() => treeContext.handleExpandClick && treeContext.handleExpandClick(id)}\n />\n )\n ) : (\n <CaretRight\n role='button'\n aria-expanded={false}\n aria-disabled={true}\n />\n )}\n {thisNode && (\n <WordEntry\n id={`${treeContext.id}-treenode-entry-${id}`}\n ref={currentNameRef}\n value={thisNode.label}\n editing={renaming}\n saving={updatingNode}\n setValue={(ret) => renameNode(ret)}\n sendEscape={() => setRenaming(false)}\n style={{\n border: currentBorder,\n margin: currentBorder === '' ? '1px' : '',\n backgroundColor: currentBorder === '' ? '' : 'lightgrey',\n }}\n />\n )}\n </span>\n )}\n {childNodes !== undefined &&\n childNodes.map((h, i) => (\n <span\n key={h.id}\n id={`${treeContext.id}-treenode-child-${h.id}`}\n style={{\n marginLeft: '16px',\n display: 'block',\n maxHeight: expanded ? '99999px' : '0px',\n height: expanded ? 'auto' : '0px',\n overflowY: 'hidden',\n visibility: expanded ? 'inherit' : 'hidden',\n opacity: expanded ? 1 : 0,\n transition: 'visibility .3s, opacity .3s ease-in-out, max-height 0.3s ease-in-out',\n }}\n >\n <TreeNode\n id={h.id}\n canRemove={canRemoveChildren}\n canRename={canRenameChildren}\n canAddChildren={canAddChildren}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n </span>\n ))}\n {showNewNode && (\n <div>\n <WordEntry\n style={{ marginLeft: '14px' }}\n id={`treenode-new-${id}`}\n ref={newNameRef}\n editing={true}\n setValue={(ret) => {\n confirmNewNode(ret);\n }}\n saving={savingNewNode}\n sendEscape={() => {\n setShowNewNode(false);\n }}\n />\n </div>\n )}\n </div>\n );\n};\n","import { createContext, Key } from 'react';\nimport { iNodeUpdate, TreeNodeData } from './interface';\n\nexport interface TreeOfNodesContextProps<T> {\n id: string;\n nodeList: TreeNodeData<T>[];\n selectedId?: Key;\n handleSelect?: (ret: Key) => void;\n expandedNodes?: Key[];\n handleExpandClick?: (ret: Key, force?: boolean) => void;\n onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;\n onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;\n onRemove?: (id: Key) => Promise<iNodeUpdate>;\n}\n\nexport const TreeOfNodesContext = createContext<TreeOfNodesContextProps<unknown>>({\n id: 'tree-of-nodes',\n nodeList: [],\n});\n","import React, { Key, useCallback, useEffect, useMemo, useState } from 'react';\nimport { Spinner } from 'react-bootstrap';\n\ninterface WordEntryProps {\n id: Key;\n value?: string;\n editing?: boolean;\n saving?: boolean;\n setValue?: (ret: string) => void;\n sendEscape?: () => void;\n style?: React.CSSProperties;\n}\n\nexport const WordEntry = React.forwardRef<HTMLInputElement, WordEntryProps>(\n ({ id, value, editing, saving, setValue, sendEscape, style }, ref): JSX.Element => {\n WordEntry.displayName = 'WordEntry';\n const currentStyle = useMemo<React.CSSProperties>(() => {\n return {\n display: 'inline-block',\n padding: '1px',\n paddingLeft: '3px',\n paddingRight: '3px',\n border: '1px',\n borderRadius: '3px',\n ...style,\n };\n }, [style]);\n\n const [currentValue, setCurrentValue] = useState<string>(value ?? '');\n useEffect(() => {\n setCurrentValue(value ?? '');\n }, [value]);\n\n const returnData = useCallback(() => {\n setValue && setValue(currentValue);\n }, [currentValue, setValue]);\n\n const keyPress = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.code === 'Escape') {\n setCurrentValue(value ?? '');\n sendEscape && sendEscape();\n } else if (e.code === 'Enter') {\n returnData();\n }\n },\n [returnData, sendEscape, value],\n );\n\n // Simple if not editing\n if (!editing) {\n return (\n <span\n style={currentStyle}\n id={String(id)}\n >\n {value}\n </span>\n );\n }\n\n return (\n <div\n style={currentStyle}\n id={`${id}-holder`}\n >\n {saving && (\n <Spinner\n id={`${id}-spinner`}\n size='sm'\n animation='border'\n />\n )}\n <input\n id={String(id)}\n ref={ref}\n type='text'\n style={{\n lineHeight: '0.75rem',\n border: '1px dotted black',\n width: 'auto',\n minWidth: '0',\n }}\n value={currentValue}\n disabled={saving}\n onChange={(e) => setCurrentValue(e.currentTarget.value)}\n onBlur={returnData}\n onKeyDownCapture={keyPress}\n />\n </div>\n );\n },\n);\n","import { Key, useCallback, useEffect, useState } from 'react';\nimport { checkExpandedNodes } from '../functions/checkExpandedNodes';\nimport { ContextMenuProvider } from './ContextMenuProvider';\nimport { iNodeUpdate, TreeNodeData } from './interface';\nimport { TreeNode } from './TreeNode';\nimport { TreeOfNodesContext } from './TreeOfNodesContext';\n\ninterface TreeOfNodesProps<T> {\n id: string;\n nodeList: TreeNodeData<T>[];\n roots: Key[];\n selectedId?: Key;\n handleSelect?: (ret: Key) => void;\n onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;\n onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;\n onRemove?: (childId: Key) => Promise<iNodeUpdate>;\n canAddRoot?: boolean;\n canRemoveRoot?: boolean;\n canRenameRoot?: boolean;\n canAddChildren?: boolean;\n canRemoveChildren?: boolean;\n canRenameChildren?: boolean;\n}\n\nexport const TreeOfNodes = <T extends unknown>({\n id,\n nodeList,\n roots,\n // canAddRoot = false,\n canRemoveRoot = false,\n canRenameRoot = false,\n canAddChildren = false,\n canRemoveChildren = false,\n canRenameChildren = false,\n selectedId,\n handleSelect = () => {\n return;\n },\n onAdd,\n onRename,\n onRemove,\n}: TreeOfNodesProps<T>) => {\n const [expandedNodes, setExpandedNodes] = useState<Key[]>([]);\n useEffect(() => {\n selectedId !== undefined &&\n setExpandedNodes(checkExpandedNodes(nodeList, selectedId, expandedNodes));\n }, []);\n\n // Change expansion and update context\n const changeExpand = useCallback(\n (eKey: Key, force?: boolean) => {\n const newExpandedNodes = [...expandedNodes];\n const ix = newExpandedNodes.findIndex((nKey) => nKey === eKey);\n if ((ix === -1 && force === undefined) || force === true) newExpandedNodes.push(eKey);\n else newExpandedNodes.splice(ix, 1);\n setExpandedNodes(newExpandedNodes);\n },\n [expandedNodes],\n );\n\n return (\n <ContextMenuProvider>\n <TreeOfNodesContext.Provider\n value={{\n id: id,\n nodeList,\n selectedId,\n handleSelect,\n expandedNodes,\n handleExpandClick: (r, f) => changeExpand(r, f),\n onAddChild: onAdd,\n onRename,\n onRemove,\n }}\n >\n {roots.map((r) => (\n <TreeNode\n key={r}\n id={r}\n canRemove={canRemoveRoot}\n canAddChildren={canAddChildren}\n canRename={canRenameRoot}\n canRemoveChildren={canRemoveChildren}\n canRenameChildren={canRenameChildren}\n />\n ))}\n </TreeOfNodesContext.Provider>\n </ContextMenuProvider>\n );\n};\n","import { TreeNodeBase } from 'components';\nimport { Key } from 'react';\nimport { getParents } from './getParents';\n\nexport const checkExpandedNodes = (\n nodeList: TreeNodeBase[],\n selectedId: Key,\n expandedNodes: Key[],\n): Key[] => {\n const k = [\n ...expandedNodes,\n ...getParents(selectedId, [], nodeList)\n .map((n) => n.id)\n .filter((k) => !expandedNodes.includes(k)),\n ].sort((a, b) => `${a}`.localeCompare(`${b}`));\n console.log(`checkExpandedNodes: ${k.join(',')}`);\n return k;\n};\n","import { Key } from 'react';\nimport { TreeNodeBase } from '../components/interface';\n\nexport const getParents = (\n id: Key,\n included: TreeNodeBase[],\n hierarchyNodes: TreeNodeBase[],\n): TreeNodeBase[] => {\n // Get current node\n const current = hierarchyNodes.find((h) => h.id === id);\n if (current === undefined) return [];\n // Set return as children, current node or parent's return\n const ret =\n current.parentId === undefined ||\n current.parentId === null ||\n hierarchyNodes.findIndex((h) => h.id === current?.parentId) === -1\n ? [...included, current]\n : getParents(\n current.parentId,\n [...included.filter((c) => c.id !== current.parentId && c.id !== current.id), current],\n hierarchyNodes,\n );\n return ret;\n};\n","import { getParents } from './getParents';\n\nexport { getParents };\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/tree-of-nodes.d.ts
CHANGED
|
@@ -1,22 +1,53 @@
|
|
|
1
|
-
import React, { Key } from
|
|
2
|
-
|
|
1
|
+
import React, { Key } from "react";
|
|
2
|
+
interface iContextMenuSettings {
|
|
3
|
+
visible?: boolean;
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
set?: (ret: {
|
|
7
|
+
visible?: boolean;
|
|
8
|
+
x?: number;
|
|
9
|
+
y?: number;
|
|
10
|
+
menuItems?: iMenuItem[];
|
|
11
|
+
}) => void;
|
|
12
|
+
}
|
|
3
13
|
interface contextMenuProps {
|
|
4
14
|
entries: iMenuItem[];
|
|
5
15
|
visible: boolean;
|
|
6
16
|
xPos: number;
|
|
7
17
|
yPos: number;
|
|
8
18
|
}
|
|
9
|
-
interface iMenuItem {
|
|
19
|
+
export interface iMenuItem {
|
|
10
20
|
label?: string;
|
|
11
21
|
action?: () => void;
|
|
12
22
|
}
|
|
23
|
+
export const MenuContext: React.Context<iContextMenuSettings>;
|
|
13
24
|
interface iContextMenuProvider {
|
|
14
25
|
children: React.ReactNode;
|
|
15
26
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
export const ContextMenuProvider: ({ children }: iContextMenuProvider) => JSX.Element;
|
|
28
|
+
export const ContextMenu: React.ForwardRefExoticComponent<contextMenuProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
export interface iNodeUpdate {
|
|
30
|
+
success: boolean;
|
|
31
|
+
ErrorText?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface TreeNodeBase {
|
|
34
|
+
id: Key;
|
|
35
|
+
label: string;
|
|
36
|
+
parentId?: Key;
|
|
37
|
+
}
|
|
38
|
+
export interface TreeNodeData<T> extends TreeNodeBase {
|
|
39
|
+
data: T;
|
|
40
|
+
}
|
|
41
|
+
interface WordEntryProps {
|
|
42
|
+
id: Key;
|
|
43
|
+
value?: string;
|
|
44
|
+
editing?: boolean;
|
|
45
|
+
saving?: boolean;
|
|
46
|
+
setValue?: (ret: string) => void;
|
|
47
|
+
sendEscape?: () => void;
|
|
48
|
+
style?: React.CSSProperties;
|
|
49
|
+
}
|
|
50
|
+
export const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
20
51
|
interface TreeNodeProps {
|
|
21
52
|
id: Key;
|
|
22
53
|
indentLevel?: number;
|
|
@@ -27,25 +58,9 @@ interface TreeNodeProps {
|
|
|
27
58
|
canRenameChildren?: boolean;
|
|
28
59
|
refresh?: () => void;
|
|
29
60
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
interface
|
|
33
|
-
success: boolean;
|
|
34
|
-
ErrorText?: string;
|
|
35
|
-
}
|
|
36
|
-
interface TreeNodeBase {
|
|
37
|
-
id: Key;
|
|
38
|
-
label: string;
|
|
39
|
-
parentId?: Key;
|
|
40
|
-
}
|
|
41
|
-
interface TreeNodeData<T> {
|
|
42
|
-
id: Key;
|
|
43
|
-
label: string;
|
|
44
|
-
parentId?: Key;
|
|
45
|
-
data: T;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface iTreeOfNodes<T> {
|
|
61
|
+
export const TreeNode: ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps) => JSX.Element;
|
|
62
|
+
export const getParents: (id: Key, included: TreeNodeBase[], hierarchyNodes: TreeNodeBase[]) => TreeNodeBase[];
|
|
63
|
+
interface TreeOfNodesProps<T> {
|
|
49
64
|
id: string;
|
|
50
65
|
nodeList: TreeNodeData<T>[];
|
|
51
66
|
roots: Key[];
|
|
@@ -61,17 +76,6 @@ interface iTreeOfNodes<T> {
|
|
|
61
76
|
canRemoveChildren?: boolean;
|
|
62
77
|
canRenameChildren?: boolean;
|
|
63
78
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
interface WordEntryProps {
|
|
67
|
-
id: Key;
|
|
68
|
-
value?: string;
|
|
69
|
-
editing?: boolean;
|
|
70
|
-
saving?: boolean;
|
|
71
|
-
setValue?: (ret: string) => void;
|
|
72
|
-
sendEscape?: () => void;
|
|
73
|
-
style?: React.CSSProperties;
|
|
74
|
-
}
|
|
75
|
-
declare const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
79
|
+
export const TreeOfNodes: <T extends unknown>({ id, nodeList, roots, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, selectedId, handleSelect, onAdd, onRename, onRemove, }: TreeOfNodesProps<T>) => J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IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,OAAO,MAAM,uOAiEZ,CAAC","sources":["src/src/components/ContextMenuProvider.tsx","src/src/components/ContextMenu.tsx","src/src/components/interface.ts","src/src/components/TreeOfNodesContext.ts","src/src/components/WordEntry.tsx","src/src/components/TreeNode.tsx","src/src/functions/getParents.tsx","src/src/functions/checkExpandedNodes.ts","src/src/components/TreeOfNodes.tsx","src/src/components/index.ts","src/src/functions/index.ts","src/src/main.ts","src/main.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,"export * from './components';\nexport * from './functions';\n"],"names":[],"version":3,"file":"tree-of-nodes.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asup/tree-of-nodes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "REACT Typescript Treeview component",
|
|
5
5
|
"author": "Paul Thomas <@PaulDThomas>",
|
|
6
6
|
"private": false,
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/PaulDThomas/tree-of-nodes#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@swc/helpers": "^0.4.14",
|
|
23
24
|
"bootstrap": "^5.2.2",
|
|
24
25
|
"react": "^18.0.0",
|
|
25
26
|
"react-bootstrap": "^2.5.0",
|
|
@@ -32,11 +33,10 @@
|
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@parcel/packager-raw-url": "^2.7.0",
|
|
36
|
+
"@parcel/packager-ts": "^2.8.3",
|
|
35
37
|
"@parcel/transformer-sass": "^2.7.0",
|
|
38
|
+
"@parcel/transformer-typescript-types": "^2.8.0",
|
|
36
39
|
"@parcel/transformer-webmanifest": "^2.7.0",
|
|
37
|
-
"@rollup/plugin-commonjs": "^23.0.2",
|
|
38
|
-
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
39
|
-
"@rollup/plugin-typescript": "^9.0.2",
|
|
40
40
|
"@testing-library/jest-dom": "^5.16.5",
|
|
41
41
|
"@testing-library/react": "^13.4.0",
|
|
42
42
|
"@testing-library/user-event": "^14.4.3",
|
|
@@ -57,11 +57,6 @@
|
|
|
57
57
|
"postcss": "^8.4.18",
|
|
58
58
|
"prettier": "^2.7.1",
|
|
59
59
|
"process": "^0.11.10",
|
|
60
|
-
"rollup": "^3.2.5",
|
|
61
|
-
"rollup-plugin-dts": "^5.0.0",
|
|
62
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
63
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
64
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
65
60
|
"ts-jest": "^29.0.3",
|
|
66
61
|
"ts-node": "^10.9.1",
|
|
67
62
|
"typescript": "^4.9.3"
|
|
@@ -94,8 +89,9 @@
|
|
|
94
89
|
]
|
|
95
90
|
},
|
|
96
91
|
"scripts": {
|
|
97
|
-
"build": "
|
|
92
|
+
"build": "parcel build src/main.ts",
|
|
98
93
|
"start": "parcel demo/index.html --dist-dir demo/dist",
|
|
99
|
-
"test": "jest --watch"
|
|
94
|
+
"test": "jest --watch",
|
|
95
|
+
"test:coverage-report": "npm test -- --coverage --watchAll=false"
|
|
100
96
|
}
|
|
101
97
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface iContextMenuSettings {
|
|
3
|
-
visible?: boolean;
|
|
4
|
-
x?: number;
|
|
5
|
-
y?: number;
|
|
6
|
-
set?: (ret: {
|
|
7
|
-
visible?: boolean;
|
|
8
|
-
x?: number;
|
|
9
|
-
y?: number;
|
|
10
|
-
menuItems?: iMenuItem[];
|
|
11
|
-
}) => void;
|
|
12
|
-
}
|
|
13
|
-
export interface contextMenuProps {
|
|
14
|
-
entries: iMenuItem[];
|
|
15
|
-
visible: boolean;
|
|
16
|
-
xPos: number;
|
|
17
|
-
yPos: number;
|
|
18
|
-
}
|
|
19
|
-
export interface iMenuItem {
|
|
20
|
-
label?: string;
|
|
21
|
-
action?: () => void;
|
|
22
|
-
}
|
|
23
|
-
export declare const MenuContext: React.Context<iContextMenuSettings>;
|
|
24
|
-
interface iContextMenuProvider {
|
|
25
|
-
children: React.ReactNode;
|
|
26
|
-
}
|
|
27
|
-
export declare const ContextMenuProvider: ({ children }: iContextMenuProvider) => JSX.Element;
|
|
28
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
interface TreeNodeProps {
|
|
3
|
-
id: Key;
|
|
4
|
-
indentLevel?: number;
|
|
5
|
-
canRemove?: boolean;
|
|
6
|
-
canRename?: boolean;
|
|
7
|
-
canAddChildren?: boolean;
|
|
8
|
-
canRemoveChildren?: boolean;
|
|
9
|
-
canRenameChildren?: boolean;
|
|
10
|
-
refresh?: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const TreeNode: ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps) => JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
import { iNodeUpdate, TreeNodeData } from './TreeOfNodesContext';
|
|
3
|
-
interface iTreeOfNodes<T> {
|
|
4
|
-
id: string;
|
|
5
|
-
nodeList: TreeNodeData<T>[];
|
|
6
|
-
roots: Key[];
|
|
7
|
-
selectedId?: Key;
|
|
8
|
-
handleSelect?: (ret: Key) => void;
|
|
9
|
-
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
10
|
-
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
11
|
-
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
12
|
-
canAddRoot?: boolean;
|
|
13
|
-
canRemoveRoot?: boolean;
|
|
14
|
-
canRenameRoot?: boolean;
|
|
15
|
-
canAddChildren?: boolean;
|
|
16
|
-
canRemoveChildren?: boolean;
|
|
17
|
-
canRenameChildren?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const TreeOfNodes: <T extends unknown>({ id, nodeList, roots, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, selectedId, handleSelect, onAdd, onRename, onRemove, }: iTreeOfNodes<T>) => JSX.Element;
|
|
20
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
export interface iNodeUpdate {
|
|
3
|
-
success: boolean;
|
|
4
|
-
ErrorText?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface TreeNodeBase {
|
|
7
|
-
id: Key;
|
|
8
|
-
label: string;
|
|
9
|
-
parentId?: Key;
|
|
10
|
-
}
|
|
11
|
-
export interface TreeNodeData<T> {
|
|
12
|
-
id: Key;
|
|
13
|
-
label: string;
|
|
14
|
-
parentId?: Key;
|
|
15
|
-
data: T;
|
|
16
|
-
}
|
|
17
|
-
export interface TreeOfNodesContextData<T> {
|
|
18
|
-
id: string;
|
|
19
|
-
nodeList: TreeNodeData<T>[];
|
|
20
|
-
selectedId?: Key;
|
|
21
|
-
handleSelect?: (ret: Key) => void;
|
|
22
|
-
expandedNodes?: Key[];
|
|
23
|
-
handleExpandClick?: (ret: Key, force?: boolean) => void;
|
|
24
|
-
onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
25
|
-
onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;
|
|
26
|
-
onRemove?: (id: Key) => Promise<iNodeUpdate>;
|
|
27
|
-
}
|
|
28
|
-
export declare const TreeOfNodesContext: import("react").Context<TreeOfNodesContextData<unknown>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { Key } from 'react';
|
|
2
|
-
interface WordEntryProps {
|
|
3
|
-
id: Key;
|
|
4
|
-
value?: string;
|
|
5
|
-
editing?: boolean;
|
|
6
|
-
saving?: boolean;
|
|
7
|
-
setValue?: (ret: string) => void;
|
|
8
|
-
sendEscape?: () => void;
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
}
|
|
11
|
-
export declare const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
12
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ContextMenu } from './ContextMenu';
|
|
2
|
-
import { ContextMenuProvider } from './ContextMenuProvider';
|
|
3
|
-
import { TreeNode } from './TreeNode';
|
|
4
|
-
import { TreeOfNodes } from './TreeOfNodes';
|
|
5
|
-
import { iNodeUpdate, TreeNodeBase, TreeNodeData } from './TreeOfNodesContext';
|
|
6
|
-
import { WordEntry } from './WordEntry';
|
|
7
|
-
export { ContextMenu, ContextMenuProvider, TreeNode, TreeOfNodes, WordEntry };
|
|
8
|
-
export type { TreeNodeBase, TreeNodeData, iNodeUpdate };
|
package/dist/cjs/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
package/dist/cjs/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.context-menu{background-color:#fbfdf6;border:1px solid #111418;border-radius:8px;opacity:1;position:absolute;visibility:hidden}.context-menu.visible{visibility:"inherit"}.context-menu-item{color:#111418;cursor:pointer;min-width:80px;padding:0 4px}.context-menu-item:first-child{padding-top:2px}.context-menu-item:last-child{padding-bottom:2px}.context-menu-item:hover{background-color:#fbe9e6}.context-menu-item:hover:first-child{border-radius:6px 6px 0 0}.context-menu-item:hover:last-child{border-radius:0 0 6px 6px}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface iContextMenuSettings {
|
|
3
|
-
visible?: boolean;
|
|
4
|
-
x?: number;
|
|
5
|
-
y?: number;
|
|
6
|
-
set?: (ret: {
|
|
7
|
-
visible?: boolean;
|
|
8
|
-
x?: number;
|
|
9
|
-
y?: number;
|
|
10
|
-
menuItems?: iMenuItem[];
|
|
11
|
-
}) => void;
|
|
12
|
-
}
|
|
13
|
-
export interface contextMenuProps {
|
|
14
|
-
entries: iMenuItem[];
|
|
15
|
-
visible: boolean;
|
|
16
|
-
xPos: number;
|
|
17
|
-
yPos: number;
|
|
18
|
-
}
|
|
19
|
-
export interface iMenuItem {
|
|
20
|
-
label?: string;
|
|
21
|
-
action?: () => void;
|
|
22
|
-
}
|
|
23
|
-
export declare const MenuContext: React.Context<iContextMenuSettings>;
|
|
24
|
-
interface iContextMenuProvider {
|
|
25
|
-
children: React.ReactNode;
|
|
26
|
-
}
|
|
27
|
-
export declare const ContextMenuProvider: ({ children }: iContextMenuProvider) => JSX.Element;
|
|
28
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
interface TreeNodeProps {
|
|
3
|
-
id: Key;
|
|
4
|
-
indentLevel?: number;
|
|
5
|
-
canRemove?: boolean;
|
|
6
|
-
canRename?: boolean;
|
|
7
|
-
canAddChildren?: boolean;
|
|
8
|
-
canRemoveChildren?: boolean;
|
|
9
|
-
canRenameChildren?: boolean;
|
|
10
|
-
refresh?: () => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const TreeNode: ({ id, canRemove, canRename, canAddChildren, canRemoveChildren, canRenameChildren, }: TreeNodeProps) => JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
import { iNodeUpdate, TreeNodeData } from './TreeOfNodesContext';
|
|
3
|
-
interface iTreeOfNodes<T> {
|
|
4
|
-
id: string;
|
|
5
|
-
nodeList: TreeNodeData<T>[];
|
|
6
|
-
roots: Key[];
|
|
7
|
-
selectedId?: Key;
|
|
8
|
-
handleSelect?: (ret: Key) => void;
|
|
9
|
-
onAdd?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
10
|
-
onRename?: (childId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
11
|
-
onRemove?: (childId: Key) => Promise<iNodeUpdate>;
|
|
12
|
-
canAddRoot?: boolean;
|
|
13
|
-
canRemoveRoot?: boolean;
|
|
14
|
-
canRenameRoot?: boolean;
|
|
15
|
-
canAddChildren?: boolean;
|
|
16
|
-
canRemoveChildren?: boolean;
|
|
17
|
-
canRenameChildren?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const TreeOfNodes: <T extends unknown>({ id, nodeList, roots, canRemoveRoot, canRenameRoot, canAddChildren, canRemoveChildren, canRenameChildren, selectedId, handleSelect, onAdd, onRename, onRemove, }: iTreeOfNodes<T>) => JSX.Element;
|
|
20
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
export interface iNodeUpdate {
|
|
3
|
-
success: boolean;
|
|
4
|
-
ErrorText?: string;
|
|
5
|
-
}
|
|
6
|
-
export interface TreeNodeBase {
|
|
7
|
-
id: Key;
|
|
8
|
-
label: string;
|
|
9
|
-
parentId?: Key;
|
|
10
|
-
}
|
|
11
|
-
export interface TreeNodeData<T> {
|
|
12
|
-
id: Key;
|
|
13
|
-
label: string;
|
|
14
|
-
parentId?: Key;
|
|
15
|
-
data: T;
|
|
16
|
-
}
|
|
17
|
-
export interface TreeOfNodesContextData<T> {
|
|
18
|
-
id: string;
|
|
19
|
-
nodeList: TreeNodeData<T>[];
|
|
20
|
-
selectedId?: Key;
|
|
21
|
-
handleSelect?: (ret: Key) => void;
|
|
22
|
-
expandedNodes?: Key[];
|
|
23
|
-
handleExpandClick?: (ret: Key, force?: boolean) => void;
|
|
24
|
-
onAddChild?: (parentId: Key, newName: string) => Promise<iNodeUpdate>;
|
|
25
|
-
onRename?: (id: Key, newName: string) => Promise<iNodeUpdate>;
|
|
26
|
-
onRemove?: (id: Key) => Promise<iNodeUpdate>;
|
|
27
|
-
}
|
|
28
|
-
export declare const TreeOfNodesContext: import("react").Context<TreeOfNodesContextData<unknown>>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { Key } from 'react';
|
|
2
|
-
interface WordEntryProps {
|
|
3
|
-
id: Key;
|
|
4
|
-
value?: string;
|
|
5
|
-
editing?: boolean;
|
|
6
|
-
saving?: boolean;
|
|
7
|
-
setValue?: (ret: string) => void;
|
|
8
|
-
sendEscape?: () => void;
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
}
|
|
11
|
-
export declare const WordEntry: React.ForwardRefExoticComponent<WordEntryProps & React.RefAttributes<HTMLInputElement>>;
|
|
12
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ContextMenu } from './ContextMenu';
|
|
2
|
-
import { ContextMenuProvider } from './ContextMenuProvider';
|
|
3
|
-
import { TreeNode } from './TreeNode';
|
|
4
|
-
import { TreeOfNodes } from './TreeOfNodes';
|
|
5
|
-
import { iNodeUpdate, TreeNodeBase, TreeNodeData } from './TreeOfNodesContext';
|
|
6
|
-
import { WordEntry } from './WordEntry';
|
|
7
|
-
export { ContextMenu, ContextMenuProvider, TreeNode, TreeOfNodes, WordEntry };
|
|
8
|
-
export type { TreeNodeBase, TreeNodeData, iNodeUpdate };
|
package/dist/main.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.context-menu{background-color:#fbfdf6;border:1px solid #111418;border-radius:8px;opacity:1;position:absolute;visibility:hidden}.context-menu.visible{visibility:"inherit"}.context-menu-item{color:#111418;cursor:pointer;min-width:80px;padding:0 4px}.context-menu-item:first-child{padding-top:2px}.context-menu-item:last-child{padding-bottom:2px}.context-menu-item:hover{background-color:#fbe9e6}.context-menu-item:hover:first-child{border-radius:6px 6px 0 0}.context-menu-item:hover:last-child{border-radius:0 0 6px 6px}
|